*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --navy: #1b3a5c;
    --navy-dark: #122840;
    --gold: #e8a020;
    --gold-hover: #d4911a;
    --bg: #f4f3ef;
    --card-bg: #ffffff;
    --text: #2d2d2d;
    --muted: #6b7280;
    --border: #e2e0d8;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Header ─── */
header {
    background: var(--navy);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 80px;
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: .5px;
    white-space: nowrap;
}
.logo span { color: var(--gold); }

nav { display: flex; gap: 4px; flex: 1; }

nav a {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: .9rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}
nav a:hover, nav a.active {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.header-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* ─── Auth pages ─── */
.profile-page { display: flex; flex-direction: column; gap: 40px; }

.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px;
}
.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.profile-meta { flex: 1; }
.profile-meta h1 { font-size: 1.4rem; font-weight: 700; color: var(--navy); }
.profile-email { font-size: .9rem; color: var(--muted); margin-top: 4px; }
.profile-since { font-size: .82rem; color: var(--muted); margin-top: 2px; }

.profile-orders h2 { font-size: 1.2rem; font-weight: 700; color: var(--navy); margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.profile-orders h2 .count { font-size: .85rem; font-weight: 500; color: var(--muted); }

.orders-list { display: flex; flex-direction: column; gap: 12px; }

.order-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 24px;
}
.order-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.order-id { font-weight: 700; color: var(--navy); margin-right: 10px; }
.order-date { font-size: .85rem; color: var(--muted); }

.order-status { font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.order-status--pending  { background: #fef9c3; color: #854d0e; }
.order-status--paid     { background: #dcfce7; color: #166534; }
.order-status--shipped  { background: #dbeafe; color: #1e40af; }
.order-status--cancelled{ background: #fee2e2; color: #991b1b; }

.order-items { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; }
.order-item { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.order-item-title { flex: 1; color: var(--text); }
.order-item-qty { color: var(--muted); }
.order-item-price { font-weight: 600; color: var(--navy); }

.order-total { margin-top: 12px; text-align: right; font-size: .9rem; color: var(--muted); }
.order-total strong { color: var(--navy); font-size: 1rem; }

.orders-empty { color: var(--muted); font-size: .95rem; }
.orders-empty a { color: var(--navy); font-weight: 500; text-decoration: none; }
.orders-empty a:hover { text-decoration: underline; }

.profile-btn { text-decoration: none; }

.edit-section { margin-bottom: 20px; }
.edit-section-title { font-size: .82rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.edit-section input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: .95rem; font-family: inherit; outline: none; transition: border-color .15s; }
.edit-section input:focus { border-color: var(--navy); }

.profile-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.gear-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .15s, color .15s, transform .3s;
}
.gear-btn svg { width: 18px; height: 18px; }
.gear-btn:hover { border-color: var(--navy); color: var(--navy); }
.gear-btn:hover svg { transform: rotate(60deg); }

.auth-wrap {
    display: flex;
    justify-content: center;
    padding-top: 40px;
}
.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 24px rgba(0,0,0,.07);
}
.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 28px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-label { font-size: .85rem; font-weight: 600; color: var(--text); }
.form-group input {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
}
.form-group input:focus { border-color: var(--navy); }
.form-error { font-size: .8rem; color: #dc2626; }
.btn-submit {
    width: 100%;
    background: var(--navy);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    transition: background .15s;
}
.btn-submit:hover { background: var(--navy-dark); }
.auth-link { text-align: center; font-size: .87rem; color: var(--muted); margin-top: 20px; }
.auth-link a { color: var(--navy); font-weight: 500; text-decoration: none; }
.auth-link a:hover { text-decoration: underline; }

.profile-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    color: rgba(255,255,255,.85);
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0 16px;
    border-radius: 8px;
    border: 1.5px solid rgba(255,255,255,.3);
    transition: background .15s;
    user-select: none;
    height: 44px;
}
.profile-btn:hover { background: rgba(255,255,255,.1); }
.profile-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.profile-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    min-width: 140px;
    overflow: hidden;
    z-index: 150;
}
.profile-dropdown.open { display: block; }
.profile-dropdown a {
    display: block;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: .88rem;
    transition: background .12s;
}
.profile-dropdown a:hover { background: var(--bg); }

.cart-btn {
    background: rgba(255,255,255,.12);
    border: 1.5px solid rgba(255,255,255,.3);
    color: #fff;
    padding: 5px 16px;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    transition: background .15s;
    height: 44px;
}
.cart-btn:hover { background: rgba(255,255,255,.2); }
.cart-icon-row { display: flex; align-items: center; gap: 6px; }
.cart-count {
    background: var(--gold);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

@keyframes toastShow {
    0%   { opacity: 0; transform: translateX(-50%) translateY(16px); }
    12%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    80%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(16px); }
}

.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: #1e293b;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: .9rem;
    opacity: 0;
    z-index: 300;
    pointer-events: none;
}
.toast.show { animation: toastShow 2.5s ease forwards; }

.btn-outline {
    border: 1.5px solid rgba(255,255,255,.5);
    color: #fff;
    background: transparent;
    padding: 0 16px;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s;
    height: 44px;
    display: flex;
    align-items: center;
}
.btn-outline:hover { background: rgba(255,255,255,.12); border-color: #fff; }

/* ─── Main ─── */
main { flex: 1; max-width: 1200px; width: 100%; margin: 0 auto; padding: 36px 24px; }

/* ─── Page heading ─── */
.page-heading {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 28px;
}
.page-heading h1 { font-size: 1.7rem; font-weight: 700; color: var(--navy); }
.page-heading .count { font-size: .9rem; color: var(--muted); }

/* ─── Catalog hero ─── */
.catalog-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: var(--navy);
    border-radius: 14px;
    padding: 28px 32px;
    margin-bottom: 32px;
}

.catalog-hero-text h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
}
.catalog-hero-text .count {
    font-size: .85rem;
    color: rgba(255,255,255,.55);
    margin-top: 4px;
    display: block;
}

/* ─── Search ─── */
.search-bar {
    position: relative;
    flex: 1;
    max-width: 460px;
}
.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--muted);
    pointer-events: none;
}
.search-bar input {
    width: 100%;
    padding: 11px 16px 11px 42px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: .95rem;
    font-family: inherit;
    background: rgba(255,255,255,.12);
    color: #fff;
    outline: none;
    transition: background .15s, border-color .15s;
}
.search-bar input::placeholder { color: rgba(255,255,255,.45); }
.search-bar input:focus {
    background: rgba(255,255,255,.18);
    border-color: var(--gold);
}
.search-icon { color: rgba(255,255,255,.5); }

.author-filter { display: flex; flex-direction: column; gap: 6px; width: 190px; flex-shrink: 0; position: relative; }

.author-dropdown { position: relative; }

.author-dropdown-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: .9rem;
    font-family: inherit;
    background: rgba(255,255,255,.12);
    color: #fff;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
    overflow: hidden;
}
.author-dropdown-btn:hover { background: rgba(255,255,255,.18); }
.author-dropdown-btn span { overflow: hidden; text-overflow: ellipsis; }
.author-dropdown-btn svg { flex-shrink: 0; opacity: .6; transition: transform .2s; }
.author-dropdown.open .author-dropdown-btn { border-color: var(--gold); }
.author-dropdown.open .author-dropdown-btn svg { transform: rotate(180deg); }

.author-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 220px;
    background: var(--navy-dark);
    border: 1.5px solid rgba(255,255,255,.15);
    border-radius: 10px;
    overflow: hidden;
    z-index: 150;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.author-dropdown.open .author-dropdown-menu { display: block; }

.author-search-wrap {
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.author-search {
    width: 100%;
    padding: 10px 32px 10px 14px;
    border: none;
    background: rgba(255,255,255,.07);
    color: #fff;
    font-size: .88rem;
    font-family: inherit;
    outline: none;
}
.author-search::placeholder { color: rgba(255,255,255,.4); }
.author-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255,255,255,.5);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color .15s;
}
.author-clear-btn:hover { color: #fff; }

.author-list { max-height: 200px; overflow-y: auto; padding: 6px 0; }
.author-list::-webkit-scrollbar { width: 4px; }
.author-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }

.author-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: .88rem;
    color: rgba(255,255,255,.85);
    cursor: pointer;
    transition: background .12s;
}
.author-option:hover { background: rgba(255,255,255,.08); }
.author-option input[type="checkbox"] { accent-color: var(--gold); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }

.genre-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.genre-tag {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--muted);
    font-size: .82rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.genre-tag:hover { border-color: var(--navy); color: var(--navy); }
.genre-tag.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.price-filter { display: flex; flex-direction: column; gap: 6px; width: 200px; flex-shrink: 0; }
.price-filter-label { display: flex; justify-content: space-between; font-size: .8rem; color: rgba(255,255,255,.7); }
.price-values { color: var(--gold); font-weight: 600; }

.range-wrap {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
}
.range-track {
    position: absolute;
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,.2);
    border-radius: 2px;
}
.range-fill {
    position: absolute;
    height: 100%;
    background: var(--gold);
    border-radius: 2px;
}
.range-wrap input[type="range"] {
    position: absolute;
    width: 100%;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    background: none;
    height: 4px;
    outline: none;
}
.range-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2.5px solid var(--gold);
    cursor: pointer;
    pointer-events: all;
    transition: transform .15s;
}
.range-wrap input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

@media (max-width: 768px) {
    .book-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
}

@media (max-width: 640px) {
    .nav-api { display: none; }

    .header-inner { gap: 8px; padding: 0 14px; height: 60px; }
    .logo { font-size: 1.1rem; }
    nav a { padding: 6px 8px; font-size: .85rem; }
    .btn-outline { padding: 0 12px; font-size: .85rem; height: 38px; }
    .cart-btn { padding: 4px 10px; height: 38px; }
    .profile-btn { padding: 0 10px; height: 38px; font-size: .82rem; }
    .profile-btn span:last-child { display: none; }

    main { padding: 16px 12px; }

    .catalog-hero {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 18px 16px;
        border-radius: 10px;
        margin-bottom: 20px;
    }
    .author-filter { width: 100%; }
    .price-filter { width: 100%; }
    .search-bar { max-width: 100%; }

    .genre-tags { gap: 6px; margin-bottom: 16px; }
    .genre-tag { font-size: .78rem; padding: 5px 10px; }

    .book-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .book-info { padding: 10px; gap: 4px; }
    .book-title { font-size: .85rem; }
    .book-price { font-size: .9rem; }
    .btn-cart { font-size: .78rem; padding: 8px 0; }
    .book-genre-tag { font-size: .62rem; }
}

@media (max-width: 400px) {
    .book-grid { grid-template-columns: 1fr; }
}

/* ─── Book grid ─── */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.book-card {
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .18s, box-shadow .18s;
}
.book-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }

.book-cover {
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, #dde3ec 0%, #c8d0de 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.book-cover img { width: 100%; height: 100%; object-fit: contain; }
.book-cover .no-cover {
    font-size: 3rem;
    opacity: .35;
    user-select: none;
}

.book-info { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.book-title {
    font-size: .95rem;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.book-author { font-size: .8rem; color: var(--muted); }
.book-genres { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.book-genre-tag {
    font-size: .68rem;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 10px;
    background: #eef1f7;
    color: var(--navy);
    white-space: nowrap;
}

.book-price { font-size: 1.05rem; font-weight: 700; color: var(--navy); margin-top: auto; padding-top: 8px; }

.btn-primary {
    background: var(--gold);
    color: #fff;
    border: none;
    padding: 9px 0;
    border-radius: 0 0 10px 10px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: block;
    transition: background .15s;
}
.btn-primary:hover { background: var(--gold-hover); }

.btn-cart {
    background: var(--gold);
    color: #fff;
    border: none;
    padding: 9px 0;
    border-radius: 0 0 10px 10px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background .15s;
}
.btn-cart:hover { background: var(--gold-hover); }

/* ─── Detail page ─── */
.detail-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 48px;
    align-items: start;
}

.detail-cover {
    background: linear-gradient(135deg, #dde3ec 0%, #c8d0de 100%);
    border-radius: 10px;
    aspect-ratio: 2/3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.detail-cover .no-cover { font-size: 5rem; opacity: .3; }

.detail-info { display: flex; flex-direction: column; gap: 16px; }
.detail-info h1 { font-size: 1.9rem; font-weight: 700; color: var(--navy); line-height: 1.25; }
.detail-author { font-size: 1rem; color: var(--muted); }
.detail-author a { color: var(--navy); text-decoration: none; font-weight: 500; }
.detail-author a:hover { text-decoration: underline; }

.detail-price { font-size: 2rem; font-weight: 700; color: var(--navy); }

.stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
}
.stock-badge.in-stock { background: #dcfce7; color: #166534; }
.stock-badge.out-of-stock { background: #fee2e2; color: #991b1b; }

.detail-description {
    font-size: .95rem;
    line-height: 1.7;
    color: #444;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.btn-buy {
    background: var(--gold);
    color: #fff;
    border: none;
    padding: 14px 36px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background .15s;
    align-self: flex-start;
}
.btn-buy:hover { background: var(--gold-hover); }

/* ─── Breadcrumb ─── */
.breadcrumb {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: .85rem;
    color: var(--muted);
    margin-bottom: 24px;
}
.breadcrumb a { color: var(--navy); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--border); }

/* ─── Footer ─── */
footer {
    background: var(--navy-dark);
    color: rgba(255,255,255,.5);
    text-align: center;
    padding: 20px 24px;
    font-size: .82rem;
    margin-top: 48px;
}

/* ─── Modal ─── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--card-bg);
    border-radius: 14px;
    max-width: 760px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: modalIn .2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
    z-index: 1;
}
.modal-close:hover { color: var(--text); }

.modal-body {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 32px;
    padding: 32px;
}

.modal-cover {
    background: linear-gradient(135deg, #dde3ec 0%, #c8d0de 100%);
    border-radius: 10px;
    aspect-ratio: 2/3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.modal-cover img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.modal-cover .no-cover { font-size: 3.5rem; opacity: .3; }

.modal-info { display: flex; flex-direction: column; gap: 12px; }
.modal-title { font-size: 1.4rem; font-weight: 700; color: var(--navy); line-height: 1.3; }
.modal-author { font-size: .9rem; color: var(--muted); }
.modal-price { font-size: 1.7rem; font-weight: 700; color: var(--navy); }
.modal-genres { display: flex; flex-wrap: wrap; gap: 6px; }
.modal-genre-tag {
    padding: 3px 10px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    color: var(--muted);
    font-size: .75rem;
    font-weight: 500;
}

.modal-description {
    font-size: .9rem;
    line-height: 1.65;
    color: #555;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    flex: 1;
}

.book-card { cursor: pointer; }

@media (max-width: 640px) {
    .detail-grid { grid-template-columns: 1fr; }
    .detail-cover { max-width: 220px; }
    .modal-body { grid-template-columns: 1fr; }
    .modal-cover { max-width: 160px; }
    .cart-card { padding: 20px 16px; }
}

.cart-btn { text-decoration: none; }

.cart-sum { font-size: .68rem; color: var(--gold); font-weight: 700; letter-spacing: .03em; line-height: 1; height: .85em; display: block; }

.cart-page { max-width: 760px; margin: 0 auto; }

.cart-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px 36px;
    box-shadow: 0 4px 24px rgba(0,0,0,.07);
}

.cart-items { display: flex; flex-direction: column; }

.cart-item-cover {
    width: 48px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 4px;
    background: linear-gradient(135deg, #dde3ec 0%, #c8d0de 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.cart-item-cover img { width: 100%; height: 100%; object-fit: contain; }
.cart-item-cover span { font-size: 1.4rem; opacity: .4; }

.cart-item-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-title { font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-author { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.cart-item-qty { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.qty-btn {
    width: 26px;
    height: 26px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: none;
    color: var(--text);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .15s, background .15s;
}
.qty-btn:hover { border-color: var(--navy); background: var(--bg); }
.qty-val { min-width: 24px; text-align: center; font-weight: 600; color: var(--text); }
.cart-item-price { color: var(--muted); white-space: nowrap; font-size: .85rem; }
.cart-item-subtotal { font-weight: 700; color: var(--navy); white-space: nowrap; min-width: 80px; text-align: right; }

.cart-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 1.3rem;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color .15s, background .15s;
    flex-shrink: 0;
}
.cart-remove-btn:hover { color: #dc2626; background: #fee2e2; }

.cart-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    margin-top: 4px;
    gap: 16px;
}
.cart-total { font-size: 1rem; color: var(--muted); }
.cart-total strong { color: var(--navy); font-size: 1.2rem; font-weight: 700; }

/* ─── Pagination ─── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 36px;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    font-family: inherit;
}

.page-btn:hover:not(:disabled) { border-color: var(--navy); color: var(--navy); }
.page-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.page-btn:disabled { opacity: .4; cursor: default; }
