/* ==========================================================================
   Exam Uttoron - Ebooks & PDF Store Stylesheet
   Modern 3D Animated Book Shelf & Responsive Store Design
   ========================================================================== */

:root {
    --st-ink: #0f172a;
    --st-muted: #64748b;
    --st-border: #e2e8f0;
    --st-accent: #2563eb;
    --st-accent-hover: #1d4ed8;
    --st-bg: #f8fafc;
    --st-card-bg: #ffffff;
}

.st-page {
    background: var(--st-bg);
    color: var(--st-ink);
    padding: 36px 20px 80px;
    min-height: 70vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.st-wrap {
    max-width: 1240px;
    margin: 0 auto;
}

/* --------------------------------------------------------------------------
   1. Store Hero Banner
   -------------------------------------------------------------------------- */
.st-hero-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: #ffffff;
    border: 1px solid var(--st-border);
    border-radius: 18px;
    padding: 28px 32px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.03);
}

.st-hero-content {
    max-width: 760px;
}

.st-eyebrow {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--st-accent);
    font-weight: 750;
    margin-bottom: 6px;
}

.st-page h1 {
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 800;
    letter-spacing: -0.025em;
    margin: 4px 0 8px;
    color: var(--st-ink);
    line-height: 1.25;
}

.st-muted {
    color: var(--st-muted);
    font-size: 14.5px;
    line-height: 1.6;
    margin: 0;
}

.st-hero-actions {
    flex-shrink: 0;
}

.st-purchases-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    background: #f1f5f9;
    color: #334155 !important;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.18s ease;
}

.st-purchases-btn:hover {
    background: #e2e8f0;
    color: #0f172a !important;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

/* Legacy Header Support */
.st-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 26px;
}

.st-link {
    color: var(--st-accent);
    font-weight: 650;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.15s ease;
}

.st-link:hover {
    color: var(--st-accent-hover);
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   2. Search & Category Filter Card
   -------------------------------------------------------------------------- */
.st-filters-card {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    background: #ffffff;
    border: 1px solid var(--st-border);
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
    flex-wrap: wrap;
    align-items: center;
}

.st-search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 240px;
}

.st-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 15px;
    pointer-events: none;
}

.st-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.15s;
}

.st-search-clear:hover {
    color: #ef4444;
}

.st-filters-card input[type="search"] {
    width: 100%;
    padding: 11px 36px 11px 40px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: var(--st-ink);
    font-size: 14px;
    transition: all 0.18s ease;
}

.st-filters-card input[type="search"]:focus {
    outline: none;
    background: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.st-category-wrap {
    min-width: 180px;
}

.st-category-wrap select {
    width: 100%;
    padding: 11px 16px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: var(--st-ink);
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.18s ease;
}

.st-category-wrap select:focus {
    outline: none;
    background: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.st-btn-search {
    padding: 11px 22px;
}

/* --------------------------------------------------------------------------
   3. Modern 3D Animated Book Shelf Grid
   -------------------------------------------------------------------------- */
.st-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 280px));
    gap: 24px;
    margin-top: 10px;
    justify-content: start;
}

.st-book-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    position: relative;
    max-width: 320px;
    width: 100%;
}

.st-book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px -4px rgba(15, 23, 42, 0.12);
    border-color: #93c5fd;
}

/* --------------------------------------------------------------------------
   4. Realistic 3D Book Mockup Display (A4 Ratio)
   -------------------------------------------------------------------------- */
.st-book-mockup-link {
    display: block;
    text-decoration: none;
    perspective: 1000px;
}

.st-book-3d {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1.414; /* Standard A4 book aspect ratio */
    max-width: 210px;
    margin: 0 auto 16px auto;
    border-radius: 3px 10px 10px 3px;
    overflow: hidden;
    background: #0f172a;
    box-shadow: 
        -2px 0 4px rgba(0, 0, 0, 0.12),
        2px 2px 0 #e2e8f0,
        3px 3px 0 #cbd5e1,
        6px 12px 22px rgba(15, 23, 42, 0.22);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.st-book-card:hover .st-book-3d {
    transform: rotate(-1deg) scale(1.02);
    box-shadow: 
        -3px 0 6px rgba(0, 0, 0, 0.16),
        3px 3px 0 #cbd5e1,
        5px 5px 0 #94a3b8,
        8px 18px 30px rgba(15, 23, 42, 0.3);
}

.st-book-3d__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Realistic Book Spine (Left border depth) */
.st-book-3d__spine {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 12px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.15) 60%, rgba(255, 255, 255, 0.15) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 3;
    pointer-events: none;
}

/* Hinge Crease */
.st-book-3d__crease {
    position: absolute;
    top: 0;
    left: 16px;
    bottom: 0;
    width: 1px;
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 1px 0 0 rgba(255, 255, 255, 0.1);
    z-index: 3;
    pointer-events: none;
}

/* Right Edge Trim (Paper pages depth) */
.st-book-3d__pages-trim {
    position: absolute;
    top: 2px;
    right: 0;
    bottom: 2px;
    width: 3px;
    background: repeating-linear-gradient(to bottom, #f8fafc 0px, #f8fafc 2px, #cbd5e1 3px);
    border-radius: 0 4px 4px 0;
    z-index: 3;
    pointer-events: none;
}

/* Glossy Diagonal Sheen */
.st-book-3d__sheen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(115deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.05) 30%, transparent 65%);
    pointer-events: none;
    z-index: 4;
}

/* Floating Format Pill */
.st-book-3d__format-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(245, 158, 11, 0.6);
    color: #fde68a;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 999px;
    z-index: 5;
}

.st-book-3d__format-badge--free {
    border-color: rgba(16, 185, 129, 0.6);
    color: #a7f3d0;
}

/* Textured Fallback Cover */
.st-book-3d__fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #09122a 0%, #172554 45%, #1e3a8a 75%, #09122a 100%);
    color: #ffffff;
    padding: 18px 14px 16px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid rgba(245, 158, 11, 0.35);
    box-sizing: border-box;
}

.st-book-3d__fallback-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.st-book-3d__fallback-badge {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #fde68a;
    text-transform: uppercase;
}

.st-book-3d__fallback-pill {
    background: #f59e0b;
    color: #0f172a;
    font-size: 8.5px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.st-book-3d__fallback-title {
    font-family: 'Hind Siliguri', sans-serif;
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.35;
    color: #ffffff;
    margin: auto 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.st-book-3d__fallback-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 8px;
    font-size: 10px;
    color: #94a3b8;
}

/* --------------------------------------------------------------------------
   5. Book Card Body, Pricing & Action CTA
   -------------------------------------------------------------------------- */
.st-book-card__body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.st-book-card__category {
    font-size: 11.5px;
    font-weight: 700;
    color: #2563eb;
    margin-bottom: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.st-book-card__title {
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 40px;
}

.st-book-card__title a {
    color: #0f172a;
    text-decoration: none;
    transition: color 0.15s ease;
}

.st-book-card__title a:hover {
    color: #2563eb;
}

.st-book-card__pricing {
    margin-bottom: 12px;
}

.st-book-card__price-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.st-book-card__price {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}

.st-book-card__mrp {
    font-size: 13px;
    color: #94a3b8;
    text-decoration: line-through;
}

.st-book-card__discount {
    font-size: 11px;
    font-weight: 800;
    color: #dc2626;
    background: #fee2e2;
    padding: 2px 6px;
    border-radius: 4px;
}

.st-book-card__badge-free {
    font-size: 11px;
    font-weight: 700;
    color: #059669;
    background: #d1fae5;
    padding: 2px 6px;
    border-radius: 4px;
}

.st-book-card__action {
    margin-top: auto;
}

.st-book-card__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff !important;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.18s ease;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
}

.st-book-card__btn:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

.st-book-card__btn--free {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 3px 10px rgba(5, 150, 105, 0.25);
}

.st-book-card__btn--free:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    box-shadow: 0 6px 16px rgba(5, 150, 105, 0.35);
}

/* --------------------------------------------------------------------------
   6. General Buttons & Form Controls (Preserving All Previous Functionality)
   -------------------------------------------------------------------------- */
.st-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    background: var(--st-accent);
    color: #ffffff !important;
    border: 1px solid transparent;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1.4;
    transition: all 0.18s ease;
}

.st-btn:hover {
    background: var(--st-accent-hover);
}

.st-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.st-btn-outline {
    background: #ffffff;
    color: var(--st-accent) !important;
    border-color: #cbd5e1;
}

.st-btn-outline:hover {
    background: #f1f5f9;
}

/* --------------------------------------------------------------------------
   7. Legacy Card & Grid Fallbacks (For Other Views or Backward Compatibility)
   -------------------------------------------------------------------------- */
.st-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 300px));
    gap: 24px;
}

.st-card {
    border: 1px solid var(--st-border);
    border-radius: 14px;
    background: #ffffff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.st-cover {
    aspect-ratio: 4/3;
    background: #edf0fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.st-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.st-cover-icon {
    width: 70px;
    height: 85px;
    display: grid;
    place-items: center;
    border: 2px solid #c5b7e9;
    border-radius: 9px;
    color: #7356b9;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: #f6f2ff;
    box-shadow: 8px 8px 0 #ddd5f1;
}

.st-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
}

.st-body h2 {
    font-size: 16px;
    line-height: 1.5;
    font-weight: 750;
    margin: 0;
    color: var(--st-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.st-body a {
    text-decoration: none;
}

.st-meta {
    font-size: 11px;
    font-weight: 650;
    color: var(--st-muted);
}

.st-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--st-ink);
}

.st-card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding-top: 7px;
}

.st-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 650;
    color: #6652a3;
    background: #f1edfa;
    padding: 4px 8px;
    border-radius: 5px;
}

/* --------------------------------------------------------------------------
   8. Empty State, Details View, Checkout & Orders
   -------------------------------------------------------------------------- */
.st-empty {
    padding: 60px 24px;
    text-align: center;
    background: #ffffff;
    border: 1px solid var(--st-border);
    border-radius: 16px;
    margin: 20px 0;
}

.st-empty h2 {
    font-size: 20px;
    font-weight: 750;
    margin-bottom: 8px;
}

.st-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
    gap: 28px;
    align-items: start;
}

.st-panel {
    padding: 26px;
    border: 1px solid var(--st-border);
    border-radius: 16px;
    background: #ffffff;
}

.st-description {
    white-space: pre-line;
    font-size: 15px;
    color: #334155;
    line-height: 1.7;
}

.st-product-cover {
    max-height: 380px;
    margin-bottom: 22px;
    border-radius: 12px;
    aspect-ratio: 16/9;
}

.st-form {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.st-form label {
    font-size: 13px;
    font-weight: 650;
}

.st-form select,
.st-form input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
}

.st-alert {
    padding: 13px 16px;
    background: #fff5d9;
    border: 1px solid #f1dfac;
    color: #735113;
    border-radius: 9px;
    font-size: 13px;
    margin: 18px 0;
}

.st-error {
    color: #a72a2a;
    font-size: 13px;
}

.st-status {
    background: #f2f5fb;
    padding: 18px;
    border-radius: 9px;
    line-height: 1.7;
    font-size: 14px;
    margin: 18px 0;
    overflow-wrap: anywhere;
}

.st-status strong {
    display: block;
    font-size: 18px;
}

.st-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.st-order-wrap {
    max-width: 760px;
    margin: auto;
}

.st-orders {
    display: grid;
    gap: 12px;
}

.st-order-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid var(--st-border);
    border-radius: 12px;
}

.st-order-row h2 {
    font-size: 15px;
    font-weight: 750;
    margin-bottom: 5px;
}

.st-pagination {
    margin-top: 32px;
}

.st-policy {
    font-size: 12px;
    color: var(--st-muted);
    margin-top: 16px;
}

.st-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--st-border);
    padding-bottom: 18px;
    margin-bottom: 18px;
}

.st-back {
    display: inline-flex;
    margin-bottom: 20px;
}

.st-status[role="status"]:empty {
    display: none;
}

/* --------------------------------------------------------------------------
   9. Responsive Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
    .st-hero-banner {
        flex-direction: column;
        align-items: flex-start;
        padding: 22px;
    }
    .st-hero-actions {
        width: 100%;
    }
    .st-purchases-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 800px) {
    .st-detail {
        grid-template-columns: 1fr;
    }
    .st-page {
        padding: 22px 14px 80px;
    }
    .st-panel {
        padding: 20px;
    }
}

@media (max-width: 640px) {
    .st-books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .st-book-card {
        padding: 12px 10px;
        border-radius: 14px;
    }
    .st-book-3d {
        max-width: 160px;
        margin-bottom: 12px;
    }
    .st-book-card__title {
        font-size: 13.5px;
        min-height: 38px;
    }
    .st-book-card__price {
        font-size: 16px;
    }
    .st-book-card__btn {
        padding: 8px 10px;
        font-size: 12.5px;
    }
    .st-filters-card {
        flex-direction: column;
        align-items: stretch;
    }
    .st-category-wrap,
    .st-btn-search {
        width: 100%;
    }
}

@media (max-width: 380px) {
    .st-books-grid {
        grid-template-columns: 1fr;
    }
    .st-book-3d {
        max-width: 200px;
    }
}

/* --------------------------------------------------------------------------
   10. Dark Mode Overrides
   -------------------------------------------------------------------------- */
html[data-site-theme="dark"] .st-page {
    --st-bg: #0f172a;
    --st-ink: #f1f5f9;
    --st-muted: #94a3b8;
    --st-border: #334155;
    --st-card-bg: #1e293b;
}

html[data-site-theme="dark"] .st-hero-banner,
html[data-site-theme="dark"] .st-filters-card,
html[data-site-theme="dark"] .st-panel,
html[data-site-theme="dark"] .st-empty,
html[data-site-theme="dark"] .st-order-row {
    background: #1e293b;
    border-color: #334155;
}

html[data-site-theme="dark"] .st-purchases-btn {
    background: #0f172a;
    border-color: #334155;
    color: #cbd5e1 !important;
}

html[data-site-theme="dark"] .st-purchases-btn:hover {
    background: #334155;
    color: #f8fafc !important;
}

html[data-site-theme="dark"] .st-filters-card input[type="search"],
html[data-site-theme="dark"] .st-category-wrap select {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

html[data-site-theme="dark"] .st-book-card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

html[data-site-theme="dark"] .st-book-card__title a,
html[data-site-theme="dark"] .st-book-card__price {
    color: #f1f5f9;
}

html[data-site-theme="dark"] .st-book-card__category {
    color: #60a5fa;
}

html[data-site-theme="dark"] .st-book-3d {
    box-shadow: 
        -2px 0 4px rgba(0, 0, 0, 0.3),
        2px 2px 0 #334155,
        3px 3px 0 #475569,
        6px 12px 22px rgba(0, 0, 0, 0.4);
}
