/* Shared Design System Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* Reset & Base */
body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 
   STRICT TYPOGRAPHY SYSTEM 
   User Requirement: Absolute consistency in font, style, spacing, and colors.
   Using Greyness and Weight for hierarchy.
*/

/* 1. Main Section/Slide Titles */
/* Darkest, Boldest, Largest */
.type-title {
    font-size: 1.875rem;
    /* text-3xl */
    line-height: 2.25rem;
    font-weight: 700;
    /* font-bold */
    color: #0f172a;
    /* text-slate-900 */
    margin-bottom: 0.5rem;
    /* Consistent spacing to subheading */
}

/* 2. Subheadings (Context/Subtitle) */
/* Color accent (Sky), lighter weight than title */
.type-subheading {
    font-size: 0.875rem;
    /* text-sm */
    line-height: 1.5rem;
    font-weight: 400;
    /* font-normal (thin/regular per user request) */
    color: #0284c7;
    /* text-sky-600 */
    margin-bottom: 1.25rem;
    /* Reduced from 1.5rem for tighter fit */
    text-transform: uppercase;
    /* User requested Capitalization (interpreted as Uppercase for premium look) */
    letter-spacing: 0.05em;
}

/* 3. Section/Card Headings (H3) */
/* Slightly lighter grey than Title, smaller, but still bold */
.type-heading {
    font-size: 1.125rem;
    /* Slightly reduced from 1.25rem to ensure vertical fit */
    line-height: 1.5rem;
    font-weight: 700;
    /* font-bold */
    color: #1e293b;
    /* text-slate-800 */
    margin-bottom: 0.5rem;
}

/* 4. Body Content */
/* Lighter grey, regular weight, readable size */
.type-body {
    font-size: 0.875rem;
    /* text-sm */
    line-height: 1.4rem;
    /* Slightly tighter leading for slides */
    font-weight: 400;
    color: #334155;
    /* text-slate-700 */
}

/* 5. Small Labels (Eyebrow text) */
.type-label {
    font-size: 0.75rem;
    /* text-xs */
    text-transform: uppercase;
    letter-spacing: 0.2em;
    /* tracking-widest */
    font-weight: 600;
    /* font-semibold */
    /* Color removed to allow Tailwind overrides. Default to Slate-500 in HTML keys. */
    margin-bottom: 0.5rem;
    display: block;
}

/* Utility: Premium Card */
.premium-card {
    background: white;
    border: 1px solid #e2e8f0;
    /* slate-200 */
    border-radius: 1rem;
    /* 16px */
    padding: 1.5rem;
    /* 24px */
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    /* shadow-sm */
    transition: all 0.3s ease;
}

.premium-card:hover {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    /* shadow-md */
    border-color: #cbd5e1;
    /* slate-300 */
}

/* Base Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Index specific */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.diagram-node {
    transition: transform 0.2s, box-shadow 0.2s;
}

.diagram-node:active {
    transform: scale(0.98);
}

.module-tab {
    cursor: pointer;
}

.active-module-tab {
    background-color: #e0f2fe;
    /* sky-100 */
    color: #0369a1;
    /* sky-700 */
    border-left-color: #0284c7;
    /* sky-600 */
}

/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chat-button {
    width: 60px;
    height: 60px;
    background: #0284c7;
    /* sky-600 */
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    font-size: 24px;
}

.chat-button:hover {
    transform: scale(1.05);
}

.chat-window {
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
    overflow: hidden;
    display: none;
    /* Initially hidden */
    border: 1px solid #e2e8f0;
}

.chat-header {
    background: #f8fafc;
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
}

.chat-input-area {
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    background: white;
}

.message {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.875rem;
    margin-bottom: 10px;
    max-width: 85%;
    line-height: 1.4;
}

.message.user {
    background: #0284c7;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

.message.ai {
    background: white;
    border: 1px solid #e2e8f0;
    color: #334155;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* Typing Indicator Animation */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px !important;
    min-width: 60px;
}

.typing-indicator span {
    display: block;
    width: 6px;
    height: 6px;
    background: #94a3b8;
    /* slate-400 */
    border-radius: 50%;
    animation: blink 1.4s infinite both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes blink {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Slides specific */
/* Slides specific */
.aspect-video {
    aspect-ratio: 16 / 9;
}

#app-container {
    display: flex;
    flex-direction: column;
}

/* Mobile Responsive Override */
@media (max-width: 768px) {

    /* Only the main app container/slides need to fill screen on mobile */
    #app-container.aspect-video {
        aspect-ratio: auto !important;
        min-height: 100dvh;
        height: auto !important;
    }

    /* Restore normal aspect ratio for other elements like video wrappers */
    .aspect-video:not(#app-container) {
        aspect-ratio: 16 / 9 !important;
        min-height: auto !important;
        height: auto !important;
    }

    #app-container {
        border-radius: 0;
        max-width: 100%;
    }

    .slide-content {
        padding: 2rem 1.5rem !important;
        /* Increased padding on mobile for breathing room */
    }
}

#slides-wrapper {
    flex: 1;
    overflow-y: auto;
    /* Allow internal scrolling if content overflows */
    position: relative;
    padding-bottom: 0;
    /* Remove padding that might push footer */
}

@media (max-width: 768px) {
    #slides-wrapper {
        display: flex !important;
        flex-direction: column !important;
    }

    .slide.active {
        flex-grow: 1 !important;
        display: flex !important;
        flex-direction: column !important;
    }
}

.slide {
    display: none;
    height: 100%;
    width: 100%;
}

.slide.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

.slide-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 2rem 3rem;
    /* Reduced vertical padding */
    gap: 1.25rem;
    /* Reduced gap from 2rem to 1.25rem (tight fit) */
}

/* Tighten typography specifically inside slides to ensure fit */
.slide-content .type-title {
    margin-bottom: 0.25rem;
}

.slide-content .type-subheading {
    margin-bottom: 1rem;
}

/* Ensure footer stays pinned and clean */
.slide-footer {
    margin-top: auto;
    /* Pushes footer to bottom if using flex column in parent */
    border-top: 1px solid #f1f5f9;
    padding: 0.75rem 1.5rem;
    height: 3.5rem;
    flex-shrink: 0;
    z-index: 50;
    position: relative;
    background-color: white;
    /* Ensure solid background, no bleed */
}

/* Print Mode overrides */
@media print {
    @page {
        size: landscape;
        margin: 0;
    }

    body {
        background: white;
        color: black;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    #deck-utility,
    .no-print {
        display: none !important;
    }

    #app-container {
        box-shadow: none;
        max-width: 100%;
        width: 100%;
        aspect-ratio: auto;
        height: auto;
        background: white !important;
    }

    .slide {
        display: block !important;
        /* Show all slides */
        page-break-after: always;
        height: 100vh;
        border-bottom: none;
        background-color: #f8fafc !important;
        /* Force slate-50 background */
    }
}

.print-mode-container {
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: auto !important;
    overflow: visible !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* Hide navigation chrome in print view mode */
.print-mode-container .no-print,
.print-mode-container .slide-footer {
    display: none !important;
}

.print-mode-slide {
    display: block !important;
    position: relative !important;
    margin-bottom: 40px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    overflow: hidden;
    height: auto;
    /* Allow auto height */
    aspect-ratio: 16 / 9;
    /* Maintain ratio cleanly */
    background-color: #f8fafc;
    /* Restore slate-50 background */
}

@media (max-width: 768px) {

    /* Ensure Slide 0 background fills container in all mobile modes */
    /* Ensure Slide 0 background fills container in all mobile modes */
    #slide-0.active {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
    }

    #slide-0.active>div {
        flex: 1 !important;
        width: 100%;
    }


    .print-mode-slide {
        aspect-ratio: auto !important;
        height: auto !important;
        min-height: auto;
    }
}
