
/* ==========================================================================
   CLASS 12 ECONOMICS — DIGITAL NOTEBOOK ENGINE
   Hardware-Accelerated 3D Layout & High-Performance Rendering
   ========================================================================== */

:root {
    --desk-bg: #dcd4c6;
    --paper-cream: #fffef8;
    --paper-line: rgba(70, 115, 175, 0.22);
    --margin-red: rgba(205, 55, 75, 0.65);
    --ink-blue: #1b3565;
    --ink-red: #b91c1c;
    --ink-green: #15803d;
    --ink-dark: #24292e;
    --shadow-book: 0 20px 40px rgba(45, 30, 20, 0.22), 0 6px 14px rgba(0, 0, 0, 0.08);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--desk-bg);
    font-family: 'Patrick Hand', 'Kalam', cursive, sans-serif;
    color: var(--ink-blue);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    -webkit-user-select: none;
}

/* ==========================================================================
   STAGE (WOODEN STUDY DESK)
   ========================================================================== */

.book-stage {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: radial-gradient(ellipse at 50% 30%, #ede7dc 0%, #dcd3c5 60%, #c4b9a8 100%);
    position: relative;
    overflow: hidden;
}

/* ==========================================================================
   TOP BAR
   ========================================================================== */

.nb-top-bar {
    width: min(1200px, 96vw);
    height: 46px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    padding: 0 8px;
    flex-shrink: 0;
}

.nb-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nb-brand-icon {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.nb-brand-text {
    display: flex;
    flex-direction: column;
}

.nb-brand-title {
    font-family: 'Caveat', cursive;
    font-size: 22px;
    font-weight: 700;
    color: #1a2f57;
    line-height: 1.1;
    letter-spacing: 0.5px;
}

.nb-brand-sub {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    color: #5c6c84;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.nb-top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nb-engine-badge {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #1e3a8a;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(30, 58, 138, 0.2);
    padding: 3px 9px;
    border-radius: 12px;
    letter-spacing: 0.5px;
}

.nb-tool-btn {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #334155;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
}

.nb-tool-btn:hover {
    background: #ffffff;
    border-color: #1e3a8a;
    color: #1e3a8a;
    transform: translateY(-1px);
}

/* ==========================================================================
   THE BOOK CONTAINER (DESKTOP 2-PAGE SPREAD)
   ========================================================================== */

.book-wrapper {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 4px 0;
}

.book {
    position: relative;
    width: min(1180px, 94vw);
    height: 100%;
    max-height: min(720px, calc(100vh - 126px));
    aspect-ratio: 1.48 / 1;
    display: flex;
    perspective: 2500px;
    transform-style: preserve-3d;
    box-shadow: var(--shadow-book);
    border-radius: 8px;
    contain: layout;
}

/* ==========================================================================
   STATIONARY PAGES
   ========================================================================== */

.page {
    position: relative;
    width: 50%;
    height: 100%;
    flex-shrink: 0;
    overflow: hidden;
    background-color: var(--paper-cream);
    contain: layout paint;
    transform: translateZ(0);
}

.page-left {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    box-shadow: inset -15px 0 20px -8px rgba(40, 25, 15, 0.12);
}

.page-right {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    box-shadow: inset 15px 0 20px -8px rgba(40, 25, 15, 0.12);
}

/* Center spine groove */
.book::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(50% - 12px);
    width: 24px;
    background: linear-gradient(90deg, 
        rgba(0, 0, 0, 0.12) 0%, 
        rgba(0, 0, 0, 0.03) 35%, 
        rgba(255, 255, 255, 0.12) 50%, 
        rgba(0, 0, 0, 0.03) 65%, 
        rgba(0, 0, 0, 0.12) 100%);
    pointer-events: none;
    z-index: 35;
}

/* ==========================================================================
   METALLIC SPIRAL WIRE BINDING (CENTER SPINE)
   ========================================================================== */

.notebook-spine {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 36px;
    transform: translateX(-50%);
    z-index: 45;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 15px 0;
}

.spine-wire-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
}

/* Realistic dual metallic coil rings */
.spiral-coil {
    display: block;
    width: 32px;
    height: 12px;
    border-radius: 8px;
    background: linear-gradient(135deg, 
        #9ca3af 0%, 
        #f3f4f6 28%, 
        #4b5563 60%, 
        #1f2937 90%, 
        #111827 100%);
    box-shadow: 
        0 3px 5px rgba(0, 0, 0, 0.3),
        inset 0 1px 2px rgba(255, 255, 255, 0.9);
    transform: rotate(-4deg);
}

/* ==========================================================================
   3D FLIPPING LEAF (HARDWARE ACCELERATED)
   ========================================================================== */

.flip-page {
    position: absolute;
    top: 0;
    height: 100%;
    z-index: 60;
    transform-style: preserve-3d;
    display: none;
    pointer-events: none;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

.flip-page.desktop-flip {
    left: 50%;
    width: 50%;
    transform-origin: left center;
}

.flip-page.active {
    display: block;
}

.flip-front,
.flip-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
    background-color: var(--paper-cream);
    transform-style: flat;
    will-change: opacity, transform;
}

.flip-front {
    transform: rotateY(0deg);
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    box-shadow: inset 15px 0 20px -8px rgba(40, 25, 15, 0.12);
}

.flip-back {
    transform: rotateY(180deg);
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    box-shadow: inset -15px 0 20px -8px rgba(40, 25, 15, 0.12);
}

/* 3D Paper Curvature & Lighting Overlay (High-performance opacity layer) */
.page-lighting-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    z-index: 30;
}

.flip-front .page-lighting-overlay {
    background: linear-gradient(to right, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0.06) 40%, transparent 100%);
}

.flip-back .page-lighting-overlay {
    background: linear-gradient(to left, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0.06) 40%, transparent 100%);
}

/* ==========================================================================
   NAVIGATION CONTROLS BAR
   ========================================================================== */

.book-controls-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 100;
    flex-shrink: 0;
}

.book-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.nb-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fdfaf2;
    border: 2px solid #233b6e;
    color: #1b3565;
    font-family: 'Kalam', cursive;
    font-size: 18px;
    font-weight: 700;
    padding: 6px 20px;
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.nb-nav-btn:hover:not(:disabled) {
    background: #1b3565;
    color: #fffdf5;
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 6px 14px rgba(27, 53, 101, 0.22);
}

.nb-nav-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.nb-nav-btn:disabled,
.nb-nav-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: #94a3b8;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.5);
    box-shadow: none;
}

.btn-arrow {
    font-size: 20px;
    line-height: 1;
}

.key-hint {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 2px;
}

.page-indicator-pill {
    font-family: 'Caveat', cursive;
    font-size: 22px;
    font-weight: 600;
    color: #1e293b;
    background: rgba(255, 255, 255, 0.85);
    border: 1px dashed rgba(30, 41, 59, 0.4);
    padding: 4px 18px;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.page-indicator-pill:hover {
    background: #ffffff;
    border-color: #1e3a8a;
    color: #1e3a8a;
    transform: scale(1.05);
}

.nav-hint-bar {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    color: #64748b;
    text-align: center;
}

.nav-hint-bar b {
    color: #1e293b;
}