
/* ============================================================
   Croplod Library - Complete Styles
   ============================================================ */

/* --- Header Search --- */
.lib-header-search { display: flex; align-items: center; position: relative; }
.lib-header-search-input { display: none; }
@media (min-width: 768px) {
    .lib-header-search { display: flex; }
    .lib-header-search-input {
        display: block; width: 240px; height: 36px;
        padding: 0 40px 0 12px; font-size: 13px;
        color: var(--text-primary); background: var(--bg-tertiary);
        border: 1px solid transparent; border-radius: 18px;
        outline: none; font-family: var(--font-family);
        transition: all 200ms ease;
    }
    .lib-header-search-input:focus {
        width: 320px; background: var(--bg-card);
        border-color: var(--border-primary);
        box-shadow: var(--search-shadow-focus);
    }
    .lib-header-search .account-header-action-btn {
        position: absolute; left: 0; width: 36px; height: 36px;
    }
}

/* --- Book Grid --- */
.lib-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

/* --- Book Card --- */
.lib-book-card {
    text-decoration: none; color: inherit;
    display: block; transition: transform 150ms ease;
}
.lib-book-card:hover { transform: translateY(-2px); }
.lib-book-cover {
    width: 100%; aspect-ratio: 2/3; border-radius: 12px;
    overflow: hidden; background: var(--bg-tertiary);
    margin-bottom: 10px; position: relative;
    box-shadow: var(--card-shadow);
}
.lib-book-cover img {
    width: 100%; height: 100%; object-fit: cover;
}
.lib-book-cover-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-tertiary); font-size: 32px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}
.lib-book-badge {
    position: absolute; top: 8px; right: 8px;
    padding: 3px 8px; border-radius: 6px;
    font-size: 11px; font-weight: 600;
}
.lib-book-badge-free {
    background: var(--color-success-500); color: white;
}
.lib-book-badge-paid {
    background: var(--color-primary-500); color: white;
}
.lib-book-badge-new {
    background: var(--color-warning-500); color: white;
}
.lib-book-title {
    font-size: 14px; font-weight: 600;
    color: var(--text-primary); margin-bottom: 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    line-height: 1.4;
}
.lib-book-author {
    font-size: 12px; color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lib-book-rating {
    display: flex; align-items: center; gap: 4px;
    font-size: 12px; color: var(--text-secondary); margin-top: 4px;
}
.lib-book-rating svg { width: 12px; height: 12px; color: #fbbf24; }
.lib-book-price {
    font-size: 13px; font-weight: 600; color: var(--color-primary-500);
    margin-top: 4px;
}
.lib-book-price-free {
    color: var(--color-success-500);
}

/* --- Sections --- */
.lib-section { margin-bottom: 40px; }
.lib-section-header {
    display: flex; align-items: center;
    justify-content: space-between; margin-bottom: 16px;
}
.lib-section-title {
    font-size: 18px; font-weight: 600; color: var(--text-primary);
}
.lib-section-link {
    font-size: 14px; color: var(--color-primary-500);
    text-decoration: none; font-weight: 500;
    display: flex; align-items: center; gap: 4px;
}
.lib-section-link:hover { text-decoration: underline; }

/* --- Hero --- */
.lib-hero {
    padding: 48px 0 32px; text-align: center;
}
.lib-hero h1 {
    font-size: 32px; font-weight: 700;
    color: var(--text-primary); margin-bottom: 12px;
}
.lib-hero p {
    font-size: 16px; color: var(--text-secondary);
    max-width: 520px; margin: 0 auto 28px; line-height: 1.8;
}
.lib-hero-search {
    max-width: 520px; margin: 0 auto; position: relative;
}
.lib-hero-search input {
    width: 100%; height: 52px; padding: 0 52px 0 20px;
    font-size: 15px; color: var(--text-primary);
    background: var(--bg-tertiary); border: none;
    border-radius: 26px; outline: none;
    font-family: var(--font-family);
    transition: all 200ms ease;
}
.lib-hero-search input:focus {
    background: var(--bg-card);
    box-shadow: var(--search-shadow-focus);
}
.lib-hero-search button {
    position: absolute; left: 4px; top: 50%;
    transform: translateY(-50%); width: 44px; height: 44px;
    border-radius: 50%; border: none;
    background: var(--color-primary-500); color: white;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: background 150ms ease;
}
.lib-hero-search button:hover {
    background: var(--color-primary-600);
}

/* --- Quick Links --- */
.lib-quick-links {
    display: flex; flex-wrap: wrap; gap: 10px;
    justify-content: center; margin-bottom: 40px;
}
.lib-quick-link {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px; background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 24px; text-decoration: none;
    color: var(--text-primary); font-size: 14px;
    font-weight: 500; transition: all 150ms ease;
}
.lib-quick-link:hover {
    background: var(--bg-hover); border-color: var(--border-secondary);
}

/* --- Categories Grid --- */
.lib-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.lib-category-card {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; background: var(--bg-card);
    border: 1px solid var(--border-subtle); border-radius: 12px;
    text-decoration: none; color: var(--text-primary);
    font-size: 14px; font-weight: 500;
    transition: all 150ms ease;
}
.lib-category-card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: var(--border-secondary);
}
.lib-category-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}

/* --- Book Detail --- */
.lib-detail { padding-top: 24px; }
.lib-detail-back {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 14px; color: var(--text-secondary);
    text-decoration: none; margin-bottom: 24px;
}
.lib-detail-back:hover { color: var(--text-primary); }
.lib-detail-hero {
    display: flex; gap: 32px; margin-bottom: 32px;
}
.lib-detail-cover {
    width: 220px; flex-shrink: 0;
}
.lib-detail-cover img {
    width: 100%; aspect-ratio: 2/3; object-fit: cover;
    border-radius: 12px; box-shadow: var(--card-shadow-elevated);
}
.lib-detail-cover-placeholder {
    width: 100%; aspect-ratio: 2/3;
    background: var(--bg-tertiary); border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-tertiary);
}
.lib-detail-info { flex: 1; }
.lib-detail-title {
    font-size: 28px; font-weight: 700;
    color: var(--text-primary); margin-bottom: 8px; line-height: 1.4;
}
.lib-detail-title-en {
    font-size: 16px; color: var(--text-tertiary);
    margin-bottom: 12px; direction: ltr; text-align: left;
}
.lib-detail-author {
    font-size: 15px; color: var(--text-secondary); margin-bottom: 16px;
}
.lib-detail-author a {
    color: var(--color-primary-500); text-decoration: none;
}
.lib-detail-author a:hover { text-decoration: underline; }
.lib-detail-meta {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.lib-detail-meta-item {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 13px; color: var(--text-secondary);
    padding: 4px 12px; background: var(--bg-tertiary); border-radius: 8px;
}
.lib-detail-rating {
    display: flex; align-items: center; gap: 8px; margin-bottom: 20px;
}
.lib-detail-rating-stars {
    display: flex; gap: 2px;
}
.lib-detail-rating-stars svg { width: 18px; height: 18px; }
.lib-detail-rating-text { font-size: 14px; color: var(--text-secondary); }
.lib-detail-price {
    display: flex; align-items: center; gap: 12px; margin-bottom: 20px;
}
.lib-detail-price-current {
    font-size: 24px; font-weight: 700; color: var(--color-primary-500);
}
.lib-detail-price-original {
    font-size: 16px; color: var(--text-tertiary); text-decoration: line-through;
}
.lib-detail-price-free {
    font-size: 20px; font-weight: 700; color: var(--color-success-500);
}
.lib-detail-actions {
    display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px;
}
.lib-detail-actions .btn { min-width: 140px; }
.lib-detail-desc {
    font-size: 15px; color: var(--text-secondary);
    line-height: 1.9; margin-bottom: 32px;
}
.lib-detail-section { margin-bottom: 32px; }
.lib-detail-section-title {
    font-size: 18px; font-weight: 600;
    color: var(--text-primary); margin-bottom: 16px;
}
.lib-info-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 1px; background: var(--border-subtle);
    border-radius: 12px; overflow: hidden;
}
.lib-info-item {
    display: flex; justify-content: space-between;
    padding: 12px 16px; background: var(--bg-card);
}
.lib-info-label { font-size: 13px; color: var(--text-secondary); }
.lib-info-value {
    font-size: 13px; font-weight: 500; color: var(--text-primary);
}

/* --- Review Card --- */
.lib-review-card {
    padding: 16px; background: var(--bg-card);
    border: 1px solid var(--border-subtle); border-radius: 12px;
    margin-bottom: 12px;
}
.lib-review-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.lib-review-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary-400), var(--color-secondary-400));
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.lib-review-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.lib-review-date { font-size: 12px; color: var(--text-tertiary); }
.lib-review-stars { display: flex; gap: 2px; margin-bottom: 8px; }
.lib-review-stars svg { width: 14px; height: 14px; }
.lib-review-text { font-size: 14px; color: var(--text-secondary); line-height: 1.8; }

/* --- Explore Page --- */
.lib-explore-header { margin-bottom: 24px; }
.lib-explore-title {
    font-size: 24px; font-weight: 700;
    color: var(--text-primary); margin-bottom: 16px;
}
.lib-explore-filters {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px;
}
.lib-explore-filter {
    padding: 8px 16px; border: 1px solid var(--border-primary);
    border-radius: 20px; background: transparent;
    color: var(--text-primary); font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 150ms ease;
    font-family: var(--font-family); text-decoration: none;
    display: inline-block;
}
.lib-explore-filter:hover {
    background: var(--bg-hover);
}
.lib-explore-filter.active {
    background: var(--color-primary-500); color: white;
    border-color: var(--color-primary-500);
}

/* --- Reader --- */
.lib-reader { height: 100vh; display: flex; flex-direction: column; }
.lib-reader-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 16px; background: var(--bg-primary);
    border-bottom: 1px solid var(--border-subtle);
    min-height: 48px; z-index: 10;
}
.lib-reader-toolbar-title {
    font-size: 14px; font-weight: 600; color: var(--text-primary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lib-reader-toolbar-actions { display: flex; gap: 4px; }
.lib-reader-toolbar-btn {
    width: 36px; height: 36px; border-radius: 8px;
    border: none; background: transparent;
    color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 150ms ease;
}
.lib-reader-toolbar-btn:hover { background: var(--bg-hover); }
.lib-reader-toolbar-btn.active { color: var(--color-primary-500); background: var(--bg-hover); }
.lib-reader-sidebar {
    position: fixed; top: 0; right: -320px; width: 320px;
    height: 100vh; background: var(--bg-card);
    border-left: 1px solid var(--border-primary);
    z-index: 100; transition: right 300ms ease;
    overflow-y: auto; padding: 16px;
}
.lib-reader-sidebar.open { right: 0; }
.lib-reader-sidebar-title {
    font-size: 16px; font-weight: 600; color: var(--text-primary);
    margin-bottom: 16px;
}
.lib-reader-toc-item {
    display: block; padding: 10px 12px;
    font-size: 14px; color: var(--text-secondary);
    text-decoration: none; border-radius: 8px;
    transition: all 150ms ease; margin-bottom: 2px;
}
.lib-reader-toc-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.lib-reader-toc-item.active { color: var(--color-primary-500); background: var(--bg-hover); font-weight: 600; }
.lib-reader-content {
    flex: 1; overflow-y: auto; padding: 32px;
    max-width: 720px; margin: 0 auto; width: 100%;
    font-size: 18px; line-height: 2; color: var(--text-primary);
}
.lib-reader-progress {
    padding: 8px 16px; background: var(--bg-primary);
    border-top: 1px solid var(--border-subtle);
    display: flex; align-items: center; gap: 12px;
}
.lib-reader-progress-bar {
    flex: 1; height: 4px; background: var(--bg-tertiary);
    border-radius: 2px; overflow: hidden;
}
.lib-reader-progress-fill {
    height: 100%; background: var(--color-primary-500);
    border-radius: 2px; transition: width 300ms ease;
}
.lib-reader-progress-text { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; }
.lib-reader-settings {
    position: fixed; bottom: 60px; left: 50%;
    transform: translateX(-50%); background: var(--bg-card);
    border: 1px solid var(--border-primary); border-radius: 16px;
    padding: 20px; box-shadow: var(--card-shadow-elevated);
    z-index: 90; min-width: 300px; display: none;
}
.lib-reader-settings.open { display: block; }
.lib-reader-settings-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.lib-reader-settings-label {
    font-size: 13px; color: var(--text-secondary);
}
.lib-reader-settings-control {
    display: flex; align-items: center; gap: 8px;
}
.lib-reader-settings-btn {
    width: 32px; height: 32px; border-radius: 8px;
    border: 1px solid var(--border-primary); background: var(--bg-card);
    color: var(--text-primary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 600;
}
.lib-reader-settings-btn:hover { background: var(--bg-hover); }

/* --- Stats Grid --- */
.lib-stats-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 32px;
}

/* --- Author/Publisher Card --- */
.lib-entity-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; background: var(--bg-card);
    border: 1px solid var(--border-subtle); border-radius: 12px;
    text-decoration: none; color: var(--text-primary);
    transition: all 150ms ease;
}
.lib-entity-card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: var(--border-secondary);
}
.lib-entity-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary-400), var(--color-secondary-400));
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.lib-entity-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.lib-entity-name { font-size: 15px; font-weight: 600; }
.lib-entity-meta { font-size: 12px; color: var(--text-tertiary); }

/* --- Empty State Enhanced --- */
.lib-empty-state {
    text-align: center; padding: 60px 24px;
}
.lib-empty-state-icon {
    width: 80px; height: 80px; margin: 0 auto 20px;
    background: var(--bg-tertiary); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-tertiary);
}
.lib-empty-state-title {
    font-size: 18px; font-weight: 600;
    color: var(--text-primary); margin-bottom: 8px;
}
.lib-empty-state-desc {
    font-size: 14px; color: var(--text-secondary);
    max-width: 400px; margin: 0 auto 20px;
}

/* --- Tab Bar --- */
.lib-tabs {
    display: flex; gap: 0; border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px; overflow-x: auto;
}
.lib-tab {
    padding: 12px 20px; font-size: 14px; font-weight: 500;
    color: var(--text-secondary); text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 150ms ease; white-space: nowrap;
}
.lib-tab:hover { color: var(--text-primary); }
.lib-tab.active {
    color: var(--color-primary-500);
    border-bottom-color: var(--color-primary-500);
}

/* --- Loading Skeleton --- */
.lib-skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Star Rating Interactive --- */
.lib-star-rating { display: flex; gap: 4px; cursor: pointer; }
.lib-star-rating svg { width: 20px; height: 20px; color: var(--text-tertiary); transition: color 150ms; }
.lib-star-rating svg.filled { color: #fbbf24; }
.lib-star-rating:hover svg { color: #fbbf24; }

/* --- Responsive --- */
@media (max-width: 639px) {
    .lib-hero { padding: 32px 0 24px; }
    .lib-hero h1 { font-size: 24px; }
    .lib-hero p { font-size: 14px; }
    .lib-books-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
    .lib-categories-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
    .lib-quick-links { gap: 8px; }
    .lib-quick-link { padding: 8px 14px; font-size: 13px; }
    .lib-detail-hero { flex-direction: column; align-items: center; text-align: center; }
    .lib-detail-cover { width: 180px; }
    .lib-detail-title { font-size: 22px; }
    .lib-detail-meta { justify-content: center; }
    .lib-detail-actions { justify-content: center; }
    .lib-info-grid { grid-template-columns: 1fr; }
    .lib-entity-card { flex-direction: column; text-align: center; }
    .lib-reader-sidebar { width: 100%; right: -100%; }
    .lib-reader-settings { min-width: calc(100% - 32px); }
    .lib-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Plus-specific styles */
.plus-hero{padding:32px 0;text-align:center}
.plus-hero h1{font-size:24px;font-weight:700;color:var(--text-primary);margin-bottom:8px}
.plus-hero p{font-size:14px;color:var(--text-secondary)}
.plus-breaking{background:var(--color-error-500);color:white;padding:12px 20px;border-radius:12px;margin-bottom:24px;display:flex;align-items:center;gap:12px}
.plus-breaking-dot{width:8px;height:8px;border-radius:50%;background:white;animation:pulse 1.5s infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:0.5}}
.plus-section{margin-bottom:32px}
.plus-section-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}
.plus-section-title{font-size:16px;font-weight:600;color:var(--text-primary)}
.plus-section-link{font-size:13px;color:var(--color-primary-500);text-decoration:none}
.plus-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}
.plus-article-card{background:var(--bg-card);border:1px solid var(--border-subtle);border-radius:12px;overflow:hidden;text-decoration:none;color:inherit;transition:all 150ms ease}
.plus-article-card:hover{box-shadow:var(--card-shadow-hover)}
.plus-article-image{width:100%;aspect-ratio:16/9;object-fit:cover;background:var(--bg-tertiary)}
.plus-article-body{padding:14px}
.plus-article-category{font-size:11px;color:var(--color-primary-500);font-weight:600;margin-bottom:6px}
.plus-article-title{font-size:15px;font-weight:600;color:var(--text-primary);margin-bottom:6px;line-height:1.5}
.plus-article-meta{display:flex;align-items:center;gap:10px;font-size:12px;color:var(--text-tertiary)}
.plus-categories-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:10px}
.plus-category-card{display:flex;align-items:center;gap:8px;padding:12px 14px;background:var(--bg-card);border:1px solid var(--border-subtle);border-radius:10px;text-decoration:none;color:var(--text-primary);font-size:13px;font-weight:500;transition:all 150ms ease}
.plus-category-card:hover{box-shadow:var(--card-shadow-hover)}
@media(max-width:639px){.plus-grid{grid-template-columns:1fr}.plus-categories-grid{grid-template-columns:repeat(2,1fr)}}
