/**
 * Mobile Lesson Styles - Bible Teaching Program
 * Elite Mobile Design - Centralized CSS for course lesson pages
 * Updated: January 2026
 *
 * Usage: Set CSS variables in page <head>, then link this file:
 *   <style>:root { --category-color: #7F9A83; --category-rgb: 127, 154, 131; }</style>
 *   <link rel="stylesheet" href="/css/mobile-lesson-v3.css">
 */

/* ===== CATEGORY COLOR (Set per page via inline <style>) ===== */
/* No defaults here - each page MUST define:
   :root { --category-color: #HEX; --category-rgb: R, G, B; }

   Category Colors:
   - Foundation: #1C1D37 / 28, 29, 55
   - Christian Life: #7F9A83 / 127, 154, 131
   - Prayer: #CBA378 / 203, 163, 120
   - History: #6B5344 / 107, 83, 68
   - Languages: #5B6B7C / 91, 107, 124
*/

/* ===== SMOOTH SCROLLING ===== */
html {
    scroll-behavior: smooth;
}

/* ===== MOBILE STYLES (max-width: 1023px) ===== */
@media (max-width: 1023px) {

    /* ===== MOBILE-ONLY ELEMENT VISIBILITY ===== */
    /* Bottom nav needs flex display */
    nav.mobile-lesson-bottom-nav {
        display: flex !important;
    }
    /* PDF sections hidden by default, only show when active */
    .mobile-pdf-section {
        display: none !important;
    }
    .mobile-pdf-section.active {
        display: flex !important;
    }
    /* Overlay hidden until active */
    .mobile-lesson-overlay {
        display: none !important;
    }
    .mobile-lesson-overlay.active {
        display: block !important;
    }

    /* ===== HIDE SITE NAVIGATION & FOOTER ===== */
    #nav-placeholder, #nav-placeholder *,
    #mobileFooterNav, #mobileBreadcrumbBar,
    #mobileNavBottomFill, .pull-handle-area,
    .mobile-nav-bar, .top-nav,
    #footer-placeholder, #footer-placeholder *,
    footer, .footer-content,
    .mobile-fab, .fab-button, [onclick*="toggleMobileNav"] {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* Hide desktop-only elements */
    .desktop-only, [class*="desktop-only"],
    #contentTab, #notesTab, #slidesTab, #downloadBtn,
    #notesSection, #slidesSection {
        display: none !important;
    }

    /* ===== LAYOUT ===== */
    body {
        padding-bottom: 80px !important;
        background: #F9F7F2 !important;
        min-height: 100vh;
    }
    /* Ensure last elements have margin before bottom nav */
    .content-area > *:last-child,
    article.content-area > *:last-child {
        margin-bottom: 3rem !important;
    }

    /* ===== LESSON BREADCRUMBS =====
       Base styles from brand.css, only overrides here */
    .mobile-breadcrumb-wrapper {
        padding: 0.875rem 1.25rem;
        background: #F9F7F2;
    }
    /* Lesson pages: Use category color for active/current */
    .mobile-breadcrumb-wrapper .mobile-breadcrumb-inner a:active {
        color: var(--category-color);
    }
    .mobile-breadcrumb-wrapper .mobile-breadcrumb-inner .current {
        color: var(--category-color);
        font-weight: 500;
    }

    /* ===== ELITE LESSON TITLE ===== */
    .mobile-lesson-title {
        display: flex;
        align-items: flex-start;
        gap: 0.875rem;
        padding: 0 1.25rem 1.25rem;
        background: #F9F7F2;
    }
    .mobile-lesson-title .lesson-badge {
        width: 1.75rem;
        height: 1.75rem;
        background: var(--category-color);
        color: white;
        border-radius: 0.375rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-family: 'Playfair Display', serif;
        font-size: 0.875rem;
        font-weight: 600;
        flex-shrink: 0;
        margin-top: 0.25rem;
    }
    .mobile-lesson-title .lesson-title-text {
        flex: 1;
        min-width: 0;
    }
    .mobile-lesson-title .lesson-label {
        font-size: 0.6875rem;
        font-weight: 600;
        color: var(--category-color);
        text-transform: uppercase;
        letter-spacing: 0.1em;
        margin-bottom: 0.25rem;
    }
    .mobile-lesson-title h1 {
        font-family: 'Playfair Display', serif;
        font-size: 1.125rem;
        font-weight: 600;
        color: #1C1D37;
        margin: 0;
        line-height: 1.3;
    }

    /* ===== ELITE TOGGLE BUTTONS ===== */
    .mobile-view-toggle {
        display: flex;
        background: white;
        border-bottom: 1px solid rgba(0,0,0,0.06);
        padding: 0 0.5rem;
    }
    .mobile-view-toggle .toggle-btn {
        flex: 1;
        padding: 0.875rem 0.5rem;
        font-family: 'Playfair Display', serif;
        font-size: 0.875rem;
        background: transparent;
        color: #9CA3AF;
        border: none;
        border-bottom: 2px solid transparent;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    .mobile-view-toggle .toggle-btn:active {
        background: rgba(var(--category-rgb), 0.05);
    }
    .mobile-view-toggle .toggle-btn.active {
        color: var(--category-color);
        border-bottom-color: var(--category-color);
        font-weight: 500;
    }

    /* ===== CONTENT AREA ===== */
    .shared-content {
        padding-top: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 4rem !important;
        background: #F9F7F2 !important;
    }
    .shared-content main,
    .shared-content .max-w-7xl {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    .shared-content .px-4, .shared-content .py-8 {
        padding: 0 !important;
    }
    .shared-content .grid {
        display: block !important;
    }
    .shared-content .lesson-sidebar { display: none !important; }
    .shared-content .lg\:col-span-3 { display: block !important; }
    .shared-content .lg\:col-span-1 { display: none !important; }

    /* Remove desktop card wrapper */
    .shared-content .bg-white.rounded-xl,
    .shared-content .bg-white.rounded-xl.shadow-sm {
        background: #F9F7F2 !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
    }
    .shared-content .p-8 {
        padding: 0 1.25rem 4rem 1.25rem !important;
    }

    /* ===== SCRIPTURE BOX - Integrated Style ===== */
    .shared-content .bg-parchment.rounded-xl,
    .shared-content .bg-parchment.rounded-lg,
    .shared-content div[class*="bg-parchment"][class*="rounded"] {
        padding: 1rem 1.25rem !important;
        margin: 0 0 1rem 0 !important;
        border-radius: 0.75rem !important;
        background: white !important;
        border: none !important;
        border-left: 3px solid var(--category-color) !important;
        box-shadow: 0 2px 8px -2px rgba(28, 29, 55, 0.06) !important;
    }
    .shared-content .flex.items-start.gap-4 {
        display: flex !important;
        gap: 0.875rem !important;
        align-items: flex-start !important;
    }
    /* Scripture icon - use category color */
    .shared-content .flex.items-start.gap-4 > .w-12,
    .shared-content .flex.items-start.gap-4 > div[class*="w-12"],
    .shared-content .flex.items-start.gap-4 > div.bg-ancient-ink {
        width: 2.25rem !important;
        height: 2.25rem !important;
        min-width: 2.25rem !important;
        font-size: 0.875rem !important;
        flex-shrink: 0 !important;
        border-radius: 0.5rem !important;
        background: var(--category-color) !important;
        color: white !important;
    }
    .shared-content .flex.items-start.gap-4 > .flex-1 {
        flex: 1 !important;
        min-width: 0;
    }
    .shared-content .flex.items-start.gap-4 .text-xs,
    .shared-content .text-xs.text-heritage-gold {
        font-size: 0.625rem !important;
        color: var(--category-color) !important;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        font-weight: 600;
        margin-bottom: 0.25rem !important;
    }
    .shared-content .flex.items-start.gap-4 .text-sm {
        font-size: 0.875rem !important;
        line-height: 1.6 !important;
        font-style: italic;
        color: #4B5563;
    }

    /* Theme box */
    .shared-content .bg-parchment.border.rounded-lg {
        background: rgba(var(--category-rgb), 0.06) !important;
        border: none !important;
        border-left: 3px solid var(--category-color) !important;
        border-radius: 0 !important;
        padding: 0.875rem 1.25rem !important;
        margin: 0 0 1.5rem 0 !important;
    }

    /* ===== LESSON CONTENT TYPOGRAPHY ===== */
    .content-area,
    article.content-area {
        font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
        font-size: 0.9375rem !important;
        line-height: 1.75 !important;
        color: #374151 !important;
        padding: 0 !important;
        background: transparent !important;
    }
    .content-area p {
        margin-bottom: 1rem !important;
    }
    .content-area h2 {
        font-family: 'Playfair Display', serif !important;
        font-size: 1.25rem !important;
        font-weight: 600 !important;
        color: #1C1D37 !important;
        margin: 1.5rem 0 0.75rem 0 !important;
    }
    .content-area h3 {
        font-family: 'Playfair Display', serif !important;
        font-size: 1.0625rem !important;
        font-weight: 600 !important;
        color: #1C1D37 !important;
        margin: 1.25rem 0 0.5rem 0 !important;
    }
    .content-area blockquote {
        border-left: 3px solid var(--category-color) !important;
        margin: 1rem 0 !important;
        padding: 0.875rem 1rem !important;
        background: white !important;
        font-style: italic !important;
        color: #4b5563 !important;
        border-radius: 0 !important;
    }
    .content-area ul, .content-area ol {
        margin: 0.75rem 0 1.25rem 1.25rem !important;
    }
    .content-area li {
        margin-bottom: 0.375rem !important;
    }
    .content-area strong {
        font-weight: 600;
        color: #1C1D37;
    }
    .content-area em {
        font-style: italic;
    }

    /* ===== ELITE PDF SECTION ===== */
    .mobile-pdf-section {
        display: none;
        background: #F9F7F2;
        min-height: calc(100vh - 200px);
        padding: 2rem 1.25rem;
        justify-content: center;
        align-items: center;
    }
    .mobile-pdf-section.active { display: flex; }
    .pdf-card {
        background: white;
        border-radius: 1rem;
        padding: 2rem 1.5rem;
        width: 100%;
        max-width: 280px;
        text-align: center;
        box-shadow: 0 4px 24px -8px rgba(28, 29, 55, 0.12);
    }

    /* ===== ELITE BOTTOM NAV ===== */
    .mobile-lesson-bottom-nav {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 56px !important;
        background: white !important;
        border-top: 1px solid rgba(0,0,0,0.06) !important;
        display: flex !important;
        z-index: 9999 !important;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.06) !important;
    }
    .mobile-lesson-bottom-nav a,
    .mobile-lesson-bottom-nav button {
        flex: 1 !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.375rem !important;
        font-family: 'Inter', system-ui, sans-serif !important;
        font-size: 0.75rem !important;
        font-weight: 500 !important;
        color: #6b7280 !important;
        background: transparent !important;
        border: none !important;
        text-decoration: none !important;
        cursor: pointer !important;
        transition: color 0.15s !important;
        padding: 0 !important;
        line-height: 1 !important;
    }
    .mobile-lesson-bottom-nav a:active,
    .mobile-lesson-bottom-nav button:active {
        color: #CBA378 !important;
        background: rgba(203, 163, 120, 0.08) !important;
    }
    .mobile-lesson-bottom-nav svg {
        width: 20px !important;
        height: 20px !important;
        stroke: currentColor !important;
        flex-shrink: 0 !important;
    }
    /* Add "Menu" label to menu button via CSS */
    .mobile-lesson-bottom-nav button::after {
        content: 'Menu' !important;
        display: block !important;
    }

    /* ===== ELITE OVERLAY ===== */
    .mobile-lesson-overlay {
        position: fixed;
        inset: 0;
        background: rgba(28, 29, 55, 0.5);
        z-index: 10000;
        display: none;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
    .mobile-lesson-overlay.active { display: block; }

    /* ===== ELITE DRAWER ===== */
    .mobile-lesson-drawer {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 85% !important;
        max-width: 320px !important;
        height: 100% !important;
        background: #F9F7F2 !important;
        z-index: 10001 !important;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        overflow-y: auto !important;
        box-shadow: -8px 0 32px rgba(28, 29, 55, 0.2) !important;
    }
    .mobile-lesson-drawer.active { right: 0 !important; }

    /* ===== DRAWER HEADER - Elegant Category Branded ===== */
    .mobile-lesson-drawer .drawer-header,
    .mobile-lesson-drawer > .drawer-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        background: var(--category-color) !important;
        background-image: linear-gradient(
            180deg,
            rgba(255,255,255,0.12) 0%,
            rgba(255,255,255,0) 40%,
            rgba(0,0,0,0.08) 100%
        ) !important;
        padding: 1.5rem 1.25rem !important;
        position: relative !important;
        border: none !important;
        margin: 0 !important;
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.15),
            0 2px 8px rgba(0,0,0,0.1) !important;
    }
    .mobile-lesson-drawer .drawer-header-content {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        gap: 1rem !important;
        overflow: hidden !important;
        border: none !important;
    }
    .mobile-lesson-drawer .drawer-header-content * {
        border-right: none !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }
    .mobile-lesson-drawer .drawer-header-content *::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
    .mobile-lesson-drawer .drawer-title-area {
        flex: 1 !important;
        min-width: 0 !important;
        overflow: hidden !important;
        border: none !important;
        border-right: none !important;
    }
    .mobile-lesson-drawer .drawer-label {
        display: block !important;
        font-family: 'Inter', system-ui, sans-serif !important;
        font-size: 0.5625rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.2em !important;
        color: rgba(255,255,255,0.75) !important;
        margin-bottom: 0.5rem !important;
        font-weight: 600 !important;
        background: transparent !important;
        text-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
    }
    .mobile-lesson-drawer .drawer-title {
        display: block !important;
        font-family: 'Playfair Display', Georgia, serif !important;
        font-weight: 600 !important;
        font-size: 1.5rem !important;
        color: #ffffff !important;
        line-height: 1.15 !important;
        background: transparent !important;
        margin: 0 !important;
        padding: 0 !important;
        text-shadow: 0 1px 3px rgba(0,0,0,0.15) !important;
        letter-spacing: -0.01em !important;
        border: none !important;
        border-right: none !important;
        outline: none !important;
    }
    .mobile-lesson-drawer .drawer-close {
        position: absolute !important;
        top: 1.25rem !important;
        right: 1.25rem !important;
        width: 2rem !important;
        height: 2rem !important;
        min-width: 2rem !important;
        background: rgba(255,255,255,0.15) !important;
        border: none !important;
        border-radius: 0.375rem !important;
        color: rgba(255,255,255,0.9) !important;
        font-size: 1rem !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.15s ease !important;
        flex-shrink: 0 !important;
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        outline: none !important;
        box-shadow: none !important;
        z-index: 10 !important;
    }
    .mobile-lesson-drawer .drawer-close:active {
        background: rgba(255,255,255,0.2) !important;
        transform: scale(0.92) !important;
    }

    /* ===== DRAWER NAV SECTION - Elegant Buttons ===== */
    .mobile-lesson-drawer .drawer-nav-section {
        display: block !important;
        padding: 1rem 1.25rem !important;
        background: #ffffff !important;
        border-bottom: 1px solid rgba(0,0,0,0.04) !important;
        margin: 0 !important;
    }
    .mobile-lesson-drawer .drawer-nav-links {
        display: flex !important;
        gap: 0.625rem !important;
    }
    .mobile-lesson-drawer .drawer-nav-links a {
        flex: 1 !important;
        display: block !important;
        padding: 0.6875rem 0.5rem !important;
        background: linear-gradient(180deg, #ffffff 0%, #F9F7F2 100%) !important;
        border: 1px solid rgba(0,0,0,0.08) !important;
        color: #374151 !important;
        text-align: center !important;
        border-radius: 0.5rem !important;
        font-family: 'Inter', system-ui, sans-serif !important;
        font-size: 0.625rem !important;
        font-weight: 600 !important;
        text-decoration: none !important;
        text-transform: uppercase !important;
        letter-spacing: 0.05em !important;
        transition: all 0.15s ease !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.8) !important;
        white-space: nowrap !important;
    }
    .mobile-lesson-drawer .drawer-nav-links a:active {
        transform: scale(0.97) !important;
        background: linear-gradient(180deg, #F9F7F2 0%, #f0ede6 100%) !important;
        box-shadow: inset 0 1px 2px rgba(0,0,0,0.06) !important;
    }

    /* ===== DRAWER CONTENT - Subtle Parchment ===== */
    .mobile-lesson-drawer .drawer-content {
        display: block !important;
        padding: 1.125rem 1.25rem 2rem !important;
        background: linear-gradient(180deg, #ffffff 0%, #F9F7F2 100%) !important;
        margin: 0 !important;
    }
    .mobile-lesson-drawer .drawer-section-label {
        display: block !important;
        font-family: 'Inter', system-ui, sans-serif !important;
        font-size: 0.5625rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.15em !important;
        color: #9CA3AF !important;
        margin-bottom: 0.875rem !important;
        font-weight: 600 !important;
        background: transparent !important;
        padding-left: 0.125rem !important;
    }

    /* ===== ELEGANT LESSON CARDS ===== */
    .mobile-lesson-drawer .lesson-link {
        display: flex !important;
        align-items: center !important;
        padding: 0.875rem 1rem !important;
        margin-bottom: 0.5rem !important;
        background: #ffffff !important;
        border-radius: 0.625rem !important;
        box-shadow:
            0 1px 3px rgba(28, 29, 55, 0.04),
            0 4px 12px -4px rgba(28, 29, 55, 0.08) !important;
        text-decoration: none !important;
        color: #1C1D37 !important;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
        border: 1px solid rgba(0,0,0,0.03) !important;
        border-left: 3px solid transparent !important;
    }
    .mobile-lesson-drawer .lesson-link:hover {
        border-left-color: rgba(var(--category-rgb), 0.3) !important;
    }
    .mobile-lesson-drawer .lesson-link:active {
        transform: scale(0.98) !important;
        box-shadow: 0 1px 2px rgba(28, 29, 55, 0.06) !important;
    }

    /* ===== CURRENT LESSON - Elegant Highlight ===== */
    .mobile-lesson-drawer .lesson-link.current {
        background: var(--category-color) !important;
        background-image: linear-gradient(
            180deg,
            rgba(255,255,255,0.1) 0%,
            rgba(0,0,0,0.05) 100%
        ) !important;
        box-shadow:
            0 4px 16px -4px rgba(var(--category-rgb), 0.5),
            inset 0 1px 0 rgba(255,255,255,0.15) !important;
        border: none !important;
        border-left: 3px solid rgba(255,255,255,0.3) !important;
    }
    .mobile-lesson-drawer .lesson-link.current .lesson-number {
        color: rgba(255,255,255,0.95) !important;
        text-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
    }
    .mobile-lesson-drawer .lesson-link.current span:not(.lesson-number) {
        color: #ffffff !important;
        text-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
    }

    /* ===== LESSON NUMBER - Refined ===== */
    .mobile-lesson-drawer .lesson-number {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-family: 'Playfair Display', Georgia, serif !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        color: var(--category-color) !important;
        width: 2rem !important;
        min-width: 2rem !important;
        flex-shrink: 0 !important;
        opacity: 0.85 !important;
    }

    /* ===== LESSON TITLE - Elegant Typography ===== */
    .mobile-lesson-drawer .lesson-link span:not(.lesson-number) {
        flex: 1 !important;
        min-width: 0 !important;
        font-family: 'Playfair Display', Georgia, serif !important;
        font-size: 0.875rem !important;
        color: #374151 !important;
        line-height: 1.35 !important;
        letter-spacing: -0.01em !important;
    }
    .mobile-lesson-drawer .lesson-link.current span:not(.lesson-number) {
        color: #ffffff !important;
    }

    /* ===== SUBTLE ARROW ===== */
    .mobile-lesson-drawer .lesson-link::after {
        content: '' !important;
        display: block !important;
        width: 16px !important;
        height: 16px !important;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23D1D5DB'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5l7 7-7 7'/%3E%3C/svg%3E") !important;
        background-size: contain !important;
        background-repeat: no-repeat !important;
        flex-shrink: 0 !important;
        margin-left: 0.75rem !important;
        opacity: 0.7 !important;
        transition: opacity 0.15s ease, transform 0.15s ease !important;
    }
    .mobile-lesson-drawer .lesson-link:active::after {
        transform: translateX(2px) !important;
    }
    .mobile-lesson-drawer .lesson-link.current::after {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.6)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5l7 7-7 7'/%3E%3C/svg%3E") !important;
        opacity: 1 !important;
    }
}

/* ===== DESKTOP - Hide Mobile Elements ===== */
@media (min-width: 1024px) {
    .mobile-only { display: none !important; }
    .mobile-breadcrumb-wrapper, .mobile-lesson-title, .mobile-view-toggle,
    .mobile-pdf-section, .mobile-lesson-bottom-nav,
    .mobile-lesson-drawer, .mobile-lesson-overlay { display: none !important; }

    /* Hide mobile elements with lg:hidden that have inline display styles */
    .lg\:hidden { display: none !important; }
    div.lg\:hidden[style*="display"] { display: none !important; }

    /* Hide mobile-content-full wrapper on desktop */
    .mobile-content-full.lg\:hidden { display: none !important; }
}
