/* ==========================================================================
   CLASS 12 ECONOMICS — RESPONSIVE DESIGN & MOBILE ENGINE
   Desktop (2-page spread) vs Mobile (1-page single notebook)
   ========================================================================== */

/* --------------------------------------------------------------------------
   TABLET ADAPTATION (769px to 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .book {
        width: 96vw;
        max-height: min(650px, calc(100vh - 120px));
    }

    .page-content {
        font-size: 18px;
        line-height: 30px;
    }

    .nb-title {
        font-size: 40px;
    }

    .formula-math {
        font-size: 28px;
    }
}

/* --------------------------------------------------------------------------
   MOBILE SINGLE-PAGE ENGINE (< 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .book-stage {
        padding: 6px 8px;
        justify-content: space-between;
    }

    .nb-top-bar {
        height: 40px;
        padding: 0 4px;
    }

    .nb-brand-title {
        font-size: 19px;
    }

    .nb-brand-sub {
        font-size: 9px;
    }

    .nb-engine-badge {
        display: none;
    }

    .nb-tool-btn {
        padding: 3px 8px;
        font-size: 11px;
    }

    /* Book Container on Mobile: Fullscreen single-page canvas */
    .book-wrapper {
        flex: 1;
        width: 100%;
        max-width: 480px;
        height: calc(100vh - 110px);
        padding: 0;
    }

    .book {
        width: 100%;
        height: 100%;
        max-height: none;
        aspect-ratio: auto;
        perspective: 1800px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        border-radius: 6px;
    }

    /* Hide desktop left page and center spine */
    .page-left {
        display: none !important;
    }

    .notebook-spine {
        display: none !important;
    }

    .book::after {
        display: none !important;
    }

    /* Right page becomes the full-width single page */
    .page-right {
        width: 100%;
        height: 100%;
        border-radius: 6px;
        box-shadow: none;
    }

    /* Left spiral holes for mobile notepad look */
    .page-right .spiral-holes,
    .flip-front .spiral-holes,
    .flip-back .spiral-holes {
        left: 2px;
        width: 20px;
    }

    .spiral-holes i {
        width: 10px;
        height: 10px;
    }

    /* Red margin line on mobile */
    .page-right .page-paper::before,
    .flip-front .page-paper::before,
    .flip-back .page-paper::before {
        left: 36px;
    }

    /* Header on mobile */
    .page-right .page-top-info,
    .flip-front .page-top-info,
    .flip-back .page-top-info {
        left: 48px;
        right: 18px;
        top: 10px;
        height: 34px;
    }

    .nb-subject-stamp {
        font-size: 16px;
    }

    .nb-date-stamp {
        display: none; /* Hide date on small mobile header to save space */
    }

    .page-box {
        padding: 1px 6px;
    }

    .page-box span {
        font-size: 8px;
    }

    .page-box b {
        font-size: 15px;
    }

    /* Page Content on mobile */
    .page-right .page-content,
    .flip-front .page-content,
    .flip-back .page-content {
        left: 48px;
        right: 18px;
        top: 50px;
        bottom: 14px;
        font-size: 18px;
        line-height: 30px;
    }

    /* Mobile 3D Leaf Flip */
    .flip-page.mobile-flip {
        left: 0;
        width: 100%;
        height: 100%;
        transform-origin: left center;
        border-radius: 6px;
    }

    .flip-page.mobile-flip .flip-front,
    .flip-page.mobile-flip .flip-back {
        border-radius: 6px;
    }

    /* Mobile Controls Bar */
    .book-controls-container {
        gap: 4px;
    }

    .book-controls {
        gap: 12px;
        width: 100%;
        justify-content: space-between;
        padding: 0 8px;
    }

    .nb-nav-btn {
        font-size: 16px;
        padding: 8px 16px;
        min-height: 42px; /* Touch-friendly tap target */
    }

    .key-hint {
        display: none; /* Hide desktop keyboard hints on mobile */
    }

    .page-indicator-pill {
        font-size: 18px;
        padding: 4px 12px;
    }

    .nav-hint-bar {
        font-size: 10px;
    }

    /* Mobile Content Tweaks */
    .nb-title {
        font-size: 34px;
    }

    .nb-subtitle {
        font-size: 18px;
    }

    .nb-cover-card {
        padding: 8px 12px;
        margin-bottom: 12px;
    }

    .nb-cover-card p {
        font-size: 16px;
        line-height: 24px;
    }

    .nb-heading {
        font-size: 26px;
    }

    .formula-math {
        font-size: 26px;
    }

    .nb-ruled-list li {
        font-size: 16px;
    }

    .nb-formula-box {
        padding: 10px 14px;
    }
}

/* --------------------------------------------------------------------------
   VERY SMALL SCREENS (< 380px)
   -------------------------------------------------------------------------- */
@media (max-width: 380px) {
    .page-right .page-paper::before,
    .flip-front .page-paper::before,
    .flip-back .page-paper::before {
        left: 28px;
    }

    .page-right .page-top-info,
    .flip-front .page-top-info,
    .flip-back .page-top-info {
        left: 36px;
        right: 10px;
    }

    .page-right .page-content,
    .flip-front .page-content,
    .flip-back .page-content {
        left: 36px;
        right: 10px;
        font-size: 16px;
        line-height: 28px;
    }

    .nb-nav-btn {
        padding: 6px 10px;
        font-size: 14px;
    }

    .page-indicator-pill {
        font-size: 16px;
        padding: 2px 8px;
    }
}