/**
 * Slides System Base CSS
 * Styles de base pour le système de présentation
 */

/* Import de Montserrat */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800&display=swap');

/* ========================================
   RESET ET BASE
   ======================================== */

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

html, body {
    height: 100%;
    overflow: hidden;
    /* Base font size dynamically scaled to viewport - optimized for 1366x768 */
    /* At 1366px width: 16px, at 1920px: ~22.5px, scales proportionally */
    font-size: clamp(12px, 1.17vw, 24px);
}

body {
    font-family: 'Montserrat', 'Arial', sans-serif;
    line-height: 1.6;
}

/* ========================================
   CONTENEUR PRINCIPAL
   ======================================== */

.presentation-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* ========================================
   SLIDES
   ======================================== */

.slide {
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Dynamic padding: 80px @ 1366x768 = ~10.4vh, ~5.85vw */
    /* Using viewport units for consistent spacing across resolutions */
    padding: clamp(40px, 10.4vh, 120px) clamp(40px, 5.85vw, 150px);
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.slide.active {
    display: flex;
    opacity: 1;
    z-index: 1;
}

/* Enable opacity transitions only after JS is ready */
.transitions-enabled .slide {
    transition: opacity 0.5s ease-in-out;
}

/* ========================================
   HORIZONTAL SCROLL MODE (Desktop only)
   ======================================== */

/* Track container that holds all slides side by side */
.slides-track {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    height: 100%;
    transition: transform 0.8s ease-in-out;
    will-change: transform;
}

/* When horizontal mode is enabled - override default slide styles */
/* Width is set via JavaScript to match container width exactly (avoids scrollbar issues with vw) */
.presentation-container.horizontal-mode .slides-track .slide {
    position: relative !important;
    flex: 0 0 auto !important;  /* Let JS set the width */
    display: flex !important;
    opacity: 1 !important;
    left: auto !important;
    top: auto !important;
    height: 100% !important;
}

/* Remove the active class behavior in horizontal mode - all slides are visible */
.presentation-container.horizontal-mode .slides-track .slide.active {
    z-index: auto;
}

/* Custom elegant scrollbar for slides */
.slide::-webkit-scrollbar {
    width: 8px;
}

.slide::-webkit-scrollbar-track {
    background: rgba(91, 44, 111, 0.05);
    border-radius: 10px;
}

.slide::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #5b2c6f, #8e44ad);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.slide::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #6d126e, #9b59b6);
}

/* Firefox elegant scrollbar */
.slide {
    scrollbar-width: thin;
    scrollbar-color: #5b2c6f rgba(91, 44, 111, 0.05);
}

/* ========================================
   NAVIGATION
   ======================================== */

.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    /* Width/height: 50px @ 16px base = 3.125em */
    width: 3.125em;
    height: 3.125em;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.25em;
    cursor: pointer;
    z-index: 1000;
    /* Show with opacity transition for edge hover effect */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s, background-color 0.3s, transform 0.2s;
    pointer-events: none;
}

.nav-arrow.visible {
    opacity: 1;
    pointer-events: auto;
}

.nav-arrow:hover {
    background-color: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%) scale(1.1);
}

#prev {
    left: 1.25em;
}

#next {
    right: 1.25em;
}

/* ========================================
   COMPTEUR DE SLIDES
   ======================================== */

.slide-counter {
    position: fixed;
    bottom: 1.25em;
    right: 1.25em;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5em 1em;
    border-radius: 1.25em;
    font-size: 0.875em;
    z-index: 1000;
}

/* ========================================
   BOUTON MODE TRIEUSE
   ======================================== */

.sorter-toggle {
    position: fixed;
    bottom: 1.25em;
    left: 1.25em;
    background-color: #333;
    color: white;
    border: none;
    padding: 0.75em;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.875em;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    transition: background-color 0.3s;
    width: 2.75em;
    height: 2.75em;
}

.sorter-toggle:hover {
    background-color: #555;
}

/* Hide text, show only icon */
.sorter-toggle span {
    display: none;
}

.sorter-toggle svg {
    width: 1.25em;
    height: 1.25em;
}

/* ========================================
   MODE TRIEUSE
   ======================================== */

.slide-sorter-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: none;
    flex-direction: column;
}

.slide-sorter-mode.active {
    display: flex;
}

.slide-sorter-header {
    padding: 1.25em 2.5em;
    background: #2c3e50;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slide-sorter-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close-sorter {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.625em 1.25em;
    border-radius: 0.3125em;
    cursor: pointer;
    font-size: 0.875em;
}

.close-sorter:hover {
    background: #c0392b;
}

.slide-sorter-grid {
    flex: 1;
    padding: 2.5em;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, 768px);
    gap: 1.875em;
    align-content: start;
    justify-content: center;
}

/* ========================================
   MINIATURES DE SLIDES - SCALED THUMBNAILS
   ======================================== */

.slide-thumbnail {
    background: white;
    border-radius: 0.75em;
    overflow: visible;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 0.375em 1.25em rgba(0,0,0,0.15);
    position: relative;
    width: 768px;
}

.slide-thumbnail:hover {
    transform: translateY(-0.5em);
    box-shadow: 0 0.75em 1.875em rgba(0,0,0,0.25);
}

.slide-thumbnail.current {
    box-shadow: 0 0 0 0.3125em #3498db;
}

.slide-thumbnail-content {
    position: relative;
    background: white;
    width: 768px;
    height: 432px;
    overflow: hidden;
    border-radius: 0.5em;
}

/* Iframe pour le rendu exact des miniatures */
.slide-thumbnail-iframe {
    position: absolute;
    top: 0;
    left: 0;
    border: none;
    width: 1920px;
    height: 1080px;
    transform: scale(0.4);
    transform-origin: top left;
    pointer-events: none;
    background: white;
}

.slide-thumbnail-number {
    position: absolute;
    top: 0.75em;
    left: 0.75em;
    background: #3498db;
    color: white;
    width: 2.25em;
    height: 2.25em;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1em;
    z-index: 10;
    box-shadow: 0 0.125em 0.5em rgba(0,0,0,0.2);
}

.slide-thumbnail-title {
    padding: 0.75em 1.25em;
    background: linear-gradient(135deg, #5b2c6f, #8e44ad);
    text-align: center;
    font-weight: 600;
    color: white;
    font-size: 0.875em;
}

/* Custom scrollbar for thumbnail content */
.slide-thumbnail-content::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.slide-thumbnail-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.slide-thumbnail-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

.slide-thumbnail-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================
   RESPONSIVE - MODE MOBILE
   ======================================== */

@media screen and (max-width: 768px) {
    html {
        /* Enable smooth scrolling for mobile */
        scroll-behavior: smooth;
    }

    body {
        overflow-y: auto;
        overflow-x: hidden;
        /* iOS momentum scrolling */
        -webkit-overflow-scrolling: touch;
        /* Hide scrollbars in mobile */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    body::-webkit-scrollbar {
        display: none;
    }

    .presentation-container {
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
        /* Enable snap scrolling for fluid presentation feel */
        scroll-snap-type: y mandatory;
        -webkit-overflow-scrolling: touch;
        /* Hide scrollbars in mobile */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .presentation-container::-webkit-scrollbar {
        display: none;
    }

    .slide {
        position: relative;
        display: flex;
        opacity: 1;
        padding: 70px 25px 50px 25px;
        min-height: 100vh;
        /* Snap each slide to viewport */
        scroll-snap-align: start;
        scroll-snap-stop: always;
        /* Add subtle separator between slides with centered icon */
        border-bottom: 2px solid rgba(91, 44, 111, 0.1);
        /* Better touch scrolling */
        -webkit-overflow-scrolling: touch;
        background-color: #ffffff;
        /* Contain paint to prevent visual bleeding between slides */
        contain: paint;
    }

    /* Chameleon icon separator on mobile - overridden in HTML inline styles */

    /* Last slide doesn't need border or icon */
    .slide:last-child {
        border-bottom: none;
    }

    /* Progress indicator bar */
    .mobile-progress-bar {
        position: fixed;
        top: 0;
        left: 0;
        height: 4px;
        background: linear-gradient(90deg, #5b2c6f, #d35400, #8e44ad);
        z-index: 3000;
        transition: width 0.3s ease-out;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        width: 0;
    }

    /* Show and reposition navigation buttons for mobile */
    .nav-arrow {
        display: flex;
        width: 45px;
        height: 45px;
        font-size: 18px;
        background-color: rgba(91, 44, 111, 0.85);
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 2px solid rgba(255, 255, 255, 0.15);
        /* Reset the transform and show always on mobile */
        transform: none;
        opacity: 1;
        pointer-events: auto;
    }

    .nav-arrow:active {
        transform: scale(0.9);
        background-color: rgba(91, 44, 111, 1);
    }

    .nav-arrow:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        pointer-events: none;
    }

    /* Position buttons at the bottom for mobile */
    #prev {
        left: 10px;
        right: auto;
        bottom: 80px;
        top: auto;
        transform: none;
    }

    #next {
        right: 10px;
        left: auto;
        bottom: 80px;
        top: auto;
        transform: none;
    }

    #prev:active:not(:disabled) {
        transform: scale(0.9);
    }

    #next:active:not(:disabled) {
        transform: scale(0.9);
    }

    /* Enhanced slide counter with better visibility */
    .slide-counter {
        bottom: 12px;
        right: 12px;
        font-size: 12px;
        padding: 6px 12px;
        background-color: rgba(91, 44, 111, 0.9);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
        border: 1.5px solid rgba(255, 255, 255, 0.15);
        font-weight: 600;
    }

    /* Overview button repositioned to bottom left - icon only */
    .sorter-toggle {
        bottom: 12px;
        left: 12px;
        padding: 10px;
        width: 42px;
        height: 42px;
        background-color: rgba(91, 44, 111, 0.9);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
        border: 1.5px solid rgba(255, 255, 255, 0.15);
        border-radius: 50%;
    }

    .sorter-toggle svg {
        width: 18px;
        height: 18px;
    }

    .sorter-toggle:active {
        transform: scale(0.9);
        background-color: rgba(91, 44, 111, 1);
    }

    .slide-sorter-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 15px;
    }

    /* Adjust thumbnail size on mobile - full width responsive */
    .slide-thumbnail {
        width: 100% !important;
        max-width: 100%;
    }

    .slide-thumbnail-content {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9;
        max-width: 100%;
    }

    .slide-thumbnail-iframe {
        width: 1920px;
        height: 1080px;
        /* Calcul dynamique du scale basé sur la largeur disponible */
        transform: scale(calc((100vw - 30px) / 1920));
        transform-origin: top left;
    }

    /* Ensure buttons stay visible and are touch-friendly */
    .nav-arrow,
    .slide-counter,
    .sorter-toggle {
        z-index: 2500;
        position: fixed;
        /* Prevent text selection on touch */
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
        /* Prevent buttons from interfering with scrolling */
        pointer-events: auto;
    }

    /* Better spacing for mobile content */
    .slide h1 {
        margin-top: 0;
        font-size: 2em;
    }

    .slide h2 {
        font-size: 1.6em;
    }

    .slide h3 {
        font-size: 1.3em;
    }

    .slide p,
    .slide li {
        font-size: 1em;
        line-height: 1.7;
    }

    .slide code {
        font-size: 0.9em;
    }

    /* Improve table responsiveness on mobile */
    .slide table {
        font-size: 0.85em;
        overflow-x: auto;
        display: block;
    }

    /* Better iframe handling on mobile */
    .slide iframe {
        max-width: 100%;
        height: auto;
        min-height: 300px;
    }
}

/* ========================================
   TITLE SLIDE STYLES
   ======================================== */

.title-slide {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Padding: 60px vertical, 80px horizontal @ 1366x768 */
    padding: clamp(40px, 7.8vh, 100px) clamp(40px, 5.85vw, 150px) !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.title-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.title-slide .main-title {
    font-size: 4em;
    font-weight: 700;
    margin: 0;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.title-slide .subtitle {
    font-size: 1.8em;
    font-weight: 300;
    margin: 1.25em 0 0 0;
    color: rgba(255,255,255,0.95);
}

.title-slide .lecture-number {
    font-size: 1.4em;
    font-weight: 500;
    margin: 2.5em 0 0.625em 0;
    color: rgba(255,255,255,0.9);
}

.title-slide .lecture-description {
    font-size: 1.2em;
    font-weight: 300;
    margin: 0;
    color: rgba(255,255,255,0.85);
}

.title-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 3.75em;
    padding-top: 1.875em;
    border-top: 1px solid rgba(255,255,255,0.3);
}

.logos {
    display: flex;
    align-items: center;
}

.way-up-logo {
    /* Height: 60px @ 16px base = 3.75em, scales with font-size */
    height: 3.75em;
    filter: brightness(0) invert(1);
}

.attribution {
    text-align: right;
}

.cc-info {
    display: flex;
    align-items: center;
    gap: 0.9375em;
}

.cc-logo {
    /* Height: 31px @ 16px base = 1.9375em */
    height: 1.9375em;
}

.cc-text {
    text-align: left;
}

.cc-text p {
    margin: 0;
    font-size: 0.75em;
    line-height: 1.4;
    color: rgba(255,255,255,0.9);
}

.cc-text a {
    color: white;
    text-decoration: underline;
}

.cc-text .copyright {
    margin-top: 0.3125em;
    font-size: 0.85em;
}

/* ========================================
   PRINT DIALOG
   ======================================== */

.print-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
}

.print-dialog.active {
    display: flex;
}

.print-dialog-content {
    background: white;
    border-radius: 0.75em;
    padding: 1.875em;
    max-width: 31.25em;
    width: 90%;
    max-height: 90vh;
    box-shadow: 0 1.25em 3.75em rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.print-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25em;
    padding-bottom: 0.9375em;
    border-bottom: 2px solid #eee;
    flex-shrink: 0;
}

.print-dialog-header h2 {
    margin: 0;
    font-size: 1.8em;
    color: #333;
}

.print-dialog-close {
    background: none;
    border: none;
    font-size: 2em;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 2.5em;
    height: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.print-dialog-close:hover {
    background: #f0f0f0;
    color: #333;
}

.print-options {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1.25em;
    padding-right: 0.3125em;
}

.print-option {
    margin-bottom: 0.75em;
    padding: 0.9375em;
    border: 2px solid #eee;
    border-radius: 0.5em;
    cursor: pointer;
    transition: all 0.3s;
}

.print-option:hover {
    border-color: #5b2c6f;
    background: #f9f9f9;
}

.print-option.selected {
    border-color: #5b2c6f;
    background: #f0e6f6;
}

.print-option input[type="radio"] {
    margin-right: 0.9375em;
}

.print-option label {
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.3125em;
}

.print-option-description {
    margin-left: 1.9375em;
    color: #666;
    font-size: 0.85em;
    line-height: 1.4;
}

.print-dialog-actions {
    display: flex;
    gap: 0.75em;
    justify-content: flex-end;
    flex-shrink: 0;
    padding-top: 0.9375em;
    border-top: 1px solid #eee;
}

.print-dialog-button {
    padding: 0.75em 1.875em;
    border: none;
    border-radius: 0.375em;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.print-dialog-button-primary {
    background: linear-gradient(135deg, #5b2c6f, #8e44ad);
    color: white;
}

.print-dialog-button-primary:hover {
    transform: translateY(-0.125em);
    box-shadow: 0 0.3125em 0.9375em rgba(91, 44, 111, 0.4);
}

.print-dialog-button-secondary {
    background: #eee;
    color: #333;
}

.print-dialog-button-secondary:hover {
    background: #ddd;
}

/* Print button in UI */
.print-toggle {
    position: fixed;
    bottom: 5em;
    left: 1.25em;
    background-color: #333;
    color: white;
    border: none;
    padding: 0.75em;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.875em;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75em;
    height: 2.75em;
    transition: background-color 0.3s;
}

.print-toggle:hover {
    background-color: #555;
}

.print-toggle svg {
    width: 1.25em;
    height: 1.25em;
}

@media screen and (max-width: 768px) {
    .print-toggle {
        display: none;
    }

    .print-dialog-content {
        padding: 20px;
        max-width: 95%;
        max-height: 85vh;
    }

    .print-dialog-header {
        margin-bottom: 15px;
        padding-bottom: 12px;
    }

    .print-dialog-header h2 {
        font-size: 1.3em;
    }

    .print-option {
        padding: 12px;
        margin-bottom: 10px;
    }

    .print-option label {
        font-size: 0.95em;
    }

    .print-option-description {
        font-size: 0.8em;
        margin-left: 28px;
    }

    .print-dialog-actions {
        padding-top: 12px;
    }

    .print-dialog-button {
        padding: 10px 20px;
        font-size: 0.95em;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

/* Page settings for print - defined outside @media print for broader support */
@page {
    margin: 0;
    size: auto;
}

@media print {
    /* Hide navigation and UI elements */
    .nav-arrow,
    .slide-counter,
    .sorter-toggle,
    .print-toggle,
    .print-dialog,
    .slide-sorter-mode,
    .mobile-progress-bar {
        display: none !important;
    }

    /* Reset body and container for printing - use fixed font size */
    html, body {
        width: 100%;
        height: auto;
        margin: 0;
        padding: 0;
        overflow: visible !important;
        /* Override responsive font-size for consistent print output */
        font-size: 12pt !important;
    }

    .presentation-container {
        width: 100%;
        height: auto;
        overflow: visible !important;
        counter-reset: slide-number;
        position: relative;
    }

    /* Base reset for ALL slides in print mode - override inline styles */
    .slide {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        overflow: visible !important;
    }

    /* Hide both decorations in print mode - they use position:fixed which breaks print */
    .slide::before,
    .slide::after {
        display: none !important;
        content: none !important;
        background-image: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    /* Default: Full Page Slides (one slide per page) */
    body:not(.print-handout-2):not(.print-handout-4):not(.print-handout-6):not(.print-outline) .slide {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        display: flex !important;
        opacity: 1 !important;
        page-break-after: always;
        page-break-inside: avoid;
        width: 100%;
        height: 100vh;
        min-height: 100vh;
        max-height: 100vh;
        margin: 0;
        padding: 40px 60px 60px 60px;
        box-sizing: border-box;
        overflow: hidden;
    }

    body:not(.print-handout-2):not(.print-handout-4):not(.print-handout-6):not(.print-outline) .slide:last-child {
        page-break-after: auto;
    }

    /* Scale down content in full page mode if needed */
    body:not(.print-handout-2):not(.print-handout-4):not(.print-handout-6):not(.print-outline) .slide > * {
        max-width: 100%;
    }

    body:not(.print-handout-2):not(.print-handout-4):not(.print-handout-6):not(.print-outline) .slide h1 {
        font-size: 2em;
        margin-bottom: 0.5em;
    }

    body:not(.print-handout-2):not(.print-handout-4):not(.print-handout-6):not(.print-outline) .slide h2 {
        font-size: 1.6em;
        margin-bottom: 0.4em;
    }

    body:not(.print-handout-2):not(.print-handout-4):not(.print-handout-6):not(.print-outline) .slide p,
    body:not(.print-handout-2):not(.print-handout-4):not(.print-handout-6):not(.print-outline) .slide li {
        font-size: 1em;
        line-height: 1.4;
    }

    /* Handout Mode: 2 slides per page */
    body.print-handout-2 .presentation-container {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 15px;
    }

    body.print-handout-2 .slide {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        display: flex !important;
        opacity: 1 !important;
        width: 100%;
        height: calc(50vh - 35px);
        min-height: 0;
        max-height: calc(50vh - 35px);
        padding: 25px;
        border: 2px solid #5b2c6f;
        border-radius: 8px;
        page-break-inside: avoid;
        box-sizing: border-box;
        margin-bottom: 10px;
        overflow: hidden;
    }

    body.print-handout-2 .slide:nth-of-type(2n) {
        page-break-after: always;
    }

    body.print-handout-2 .slide h1 {
        font-size: 1.4em;
        margin-bottom: 0.3em;
    }

    body.print-handout-2 .slide h2 {
        font-size: 1.2em;
        margin-bottom: 0.3em;
    }

    body.print-handout-2 .slide p,
    body.print-handout-2 .slide li {
        font-size: 0.85em;
        line-height: 1.3;
    }

    /* Smaller page numbers in handout-2 mode */
    body.print-handout-2 .slide::after {
        font-size: 10pt;
        padding: 4px 8px;
        bottom: 8px;
        right: 10px;
    }

    /* Handout Mode: 4 slides per page */
    body.print-handout-4 .presentation-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        padding: 15px;
    }

    body.print-handout-4 .slide {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        display: flex !important;
        opacity: 1 !important;
        width: 100%;
        height: calc(50vh - 30px);
        min-height: 0;
        max-height: calc(50vh - 30px);
        padding: 20px;
        border: 2px solid #5b2c6f;
        border-radius: 6px;
        page-break-inside: avoid;
        box-sizing: border-box;
        overflow: hidden;
    }

    body.print-handout-4 .slide:nth-of-type(4n) {
        page-break-after: always;
    }

    body.print-handout-4 .slide h1 {
        font-size: 1.2em;
        margin-bottom: 0.2em;
    }

    body.print-handout-4 .slide h2 {
        font-size: 1em;
        margin-bottom: 0.2em;
    }

    body.print-handout-4 .slide p,
    body.print-handout-4 .slide li {
        font-size: 0.75em;
        line-height: 1.2;
    }

    /* Smaller page numbers in handout-4 mode */
    body.print-handout-4 .slide::after {
        font-size: 8pt;
        padding: 3px 6px;
        bottom: 6px;
        right: 8px;
    }

    /* Handout Mode: 6 slides per page */
    body.print-handout-6 .presentation-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 12px;
    }

    body.print-handout-6 .slide {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        display: flex !important;
        opacity: 1 !important;
        width: 100%;
        height: calc(33.33vh - 20px);
        min-height: 0;
        max-height: calc(33.33vh - 20px);
        padding: 15px;
        border: 2px solid #5b2c6f;
        border-radius: 4px;
        page-break-inside: avoid;
        box-sizing: border-box;
        overflow: hidden;
    }

    body.print-handout-6 .slide:nth-of-type(6n) {
        page-break-after: always;
    }

    body.print-handout-6 .slide h1 {
        font-size: 1em;
        margin-bottom: 0.2em;
    }

    body.print-handout-6 .slide h2 {
        font-size: 0.9em;
        margin-bottom: 0.2em;
    }

    body.print-handout-6 .slide p,
    body.print-handout-6 .slide li {
        font-size: 0.65em;
        line-height: 1.2;
    }

    /* Smaller page numbers in handout-6 mode */
    body.print-handout-6 .slide::after {
        font-size: 7pt;
        padding: 2px 5px;
        bottom: 5px;
        right: 6px;
    }

    /* Outline Mode: Text only */
    body.print-outline .slide {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        display: block !important;
        opacity: 1 !important;
        width: 100%;
        height: auto;
        min-height: 0;
        padding: 20px 40px;
        page-break-inside: avoid;
        page-break-after: auto;
        border-bottom: 2px solid #ddd;
    }

    body.print-outline .slide:last-child {
        border-bottom: none;
    }

    body.print-outline .slide h1,
    body.print-outline .slide h2 {
        font-size: 1.3em;
        margin-bottom: 10px;
    }

    body.print-outline .slide p,
    body.print-outline .slide li {
        font-size: 0.9em;
        line-height: 1.5;
    }

    /* Slide number embedded in print - higher specificity to override hide rules */
    body .presentation-container .slide::after {
        counter-increment: slide-number;
        display: block !important;
        content: counter(slide-number) !important;
        position: absolute !important;
        bottom: 25px !important;
        right: 30px !important;
        font-size: 12pt !important;
        font-weight: 700 !important;
        color: #5b2c6f !important;
        background: rgba(255, 255, 255, 0.95) !important;
        background-image: none !important;
        padding: 6px 12px !important;
        border-radius: 6px !important;
        border: 2px solid #5b2c6f !important;
        z-index: 1000 !important;
        /* Reset decoration properties */
        width: auto !important;
        height: auto !important;
        transform: none !important;
        opacity: 1 !important;
        pointer-events: none !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Title slides have different number styling */
    body .presentation-container .title-slide::after {
        color: white !important;
        background: rgba(91, 44, 111, 0.9) !important;
        border-color: white !important;
    }

    /* Print decorations - ::before is hidden (see above), ::after used for slide numbers */

    /* Ensure title slides print with background */
    .title-slide {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Ensure all content is visible */
    .slide > * {
        position: relative;
        z-index: 1;
    }

    /* Handle long content */
    .slide pre,
    .slide code,
    .slide table {
        page-break-inside: avoid;
        font-size: 0.85em;
    }

    /* Mermaid diagrams */
    .mermaid svg {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Adjust images for all print modes */
    .slide img {
        max-width: 100%;
        height: auto;
        page-break-inside: avoid;
    }

    /* Scale cards and grids for print */
    .card-grid {
        column-count: 2;
        column-gap: 10pt;
        margin-top: 10pt;
    }

    .modules-grid-slide {
        gap: 10pt;
        margin-top: 10pt;
    }

    .card,
    .module-card-slide {
        padding: 10pt;
        margin-bottom: 8pt;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .card {
        display: inline-block;
        width: 100%;
    }

    .card h3,
    .card h4,
    .module-card-slide h4 {
        font-size: 11pt;
        margin-bottom: 6pt;
    }

    .card p,
    .module-card-slide p {
        font-size: 9pt;
        line-height: 1.3;
    }

    .card li,
    .module-card-slide li {
        font-size: 8.5pt;
        line-height: 1.2;
        margin-bottom: 3pt;
    }

    /* Two column layouts */
    .two-column-layout {
        gap: 15pt;
        margin-top: 10pt;
    }

    /* Image placeholders */
    .image-placeholder {
        min-height: 150pt;
        font-size: 24pt;
    }

    /* Adjust lists */
    .slide ul,
    .slide ol {
        margin: 8pt 0;
        padding-left: 20pt;
    }

    .slide li {
        margin-bottom: 4pt;
    }
}

