/* Reset and Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* ============================================
       COLOR SYSTEM
       ============================================ */

    /* Base Colors */
    --primary-bg: #1a1a1a;
    --panel-bg: #ffffff;
    --text-primary: #333333;
    --text-light: #666666;
    --text-white: #ffffff;
    --accent: #4a90e2;
    --danger: #e74c3c;
    --success: #27ae60;
    --border: #e0e0e0;

    /* Gray Scale */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-150: #f0f0f0;
    --gray-200: #ececec;
    --gray-300: #e0e0e0;
    --gray-400: #d0d0d0;
    --gray-500: #999999;
    --gray-600: #888888;
    --gray-700: #6b7280;
    --gray-800: #4b5563;

    /* Semantic Colors */
    --warning: #fbbf24;
    --warning-alt: #ffaa00;
    --info: #3b82f6;
    --info-dark: #2563eb;
    --success-alt: #4caf50;
    --offline: #f39c12;
    --terminal-green: #00ff00;

    /* Hover States */
    --accent-hover: #3a7bc8;
    --danger-hover: #c44133;

    /* Background Variants */
    --surface-light: #f9f9f9;
    --surface-lighter: #f5f5f5;

    /* Backgrounds */
    --photo-slide-bg: #000000;
    --text-slide-bg: #2c3e50;

    /* Opacity States */
    --opacity-hover: 0.85;
    --opacity-disabled: 0.5;
    --opacity-inactive: 0.65;
    --opacity-muted: 0.9;
    --opacity-subtle: 0.7;

    /* ============================================
       TYPOGRAPHY
       ============================================ */

    --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;

    /* Font Size Scale (1.125 ratio) */
    --font-size-xs: 0.75rem;      /* 12px */
    --font-size-sm: 0.875rem;     /* 14px */
    --font-size-base: 1rem;       /* 16px */
    --font-size-md: 1.125rem;     /* 18px */
    --font-size-lg: 1.266rem;     /* 20px */
    --font-size-xl: 1.424rem;     /* 23px */
    --font-size-2xl: 1.602rem;    /* 26px */
    --font-size-3xl: 1.802rem;    /* 29px */

    /* Special Sizes (responsive) */
    --font-size-slideshow: clamp(1.5rem, 5vw, 4rem);
    --font-size-clock: clamp(4rem, 12vw, 10rem);
    --font-size-date: clamp(1.5rem, 4vw, 3rem);

    /* Line Height Scale */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;

    /* Font Weight Scale */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* ============================================
       SPACING SYSTEM
       ============================================ */

    --space-0: 0;
    --space-xs: 0.25rem;  /* 4px */
    --space-sm: 0.5rem;   /* 8px */
    --space-md: 0.75rem;  /* 12px */
    --space-lg: 1rem;     /* 16px */
    --space-xl: 1.5rem;   /* 24px */
    --space-2xl: 2rem;    /* 32px */
    --space-3xl: 3rem;    /* 48px */
    --space-4xl: 4rem;    /* 64px */
    --space-5xl: 6rem;    /* 96px */

    /* ============================================
       BORDER SYSTEM
       ============================================ */

    /* Border Radius Scale */
    --border-radius-sm: 0.25rem;  /* 4px */
    --border-radius: var(--border-radius, 0.375rem);    /* 6px */
    --border-radius-md: 0.5rem;   /* 8px */
    --border-radius-lg: 0.75rem;  /* 12px */
    --border-radius-full: 50%;

    /* Border Styles */
    --border-light: 1px solid rgba(255, 255, 255, 0.2);
    --border-lighter: 1px solid rgba(255, 255, 255, 0.1);
    --border-light-hover: 1px solid rgba(255, 255, 255, 0.4);
    --border-dark: 1px solid rgba(0, 0, 0, 0.2);
    --border-dark-lighter: 1px solid rgba(0, 0, 0, 0.1);

    /* Vintage Photo Border Radii */
    --photo-corner-radius: var(--border-radius-md);
    --photo-radius-none: 3px;
    --photo-radius-equal-border: 8px;
    --photo-radius-polaroid: 2px;

    /* ============================================
       SHADOWS
       ============================================ */

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.3);
    --shadow-panel: -5px 0 20px rgba(0, 0, 0, 0.2);

    /* ============================================
       TRANSITIONS
       ============================================ */

    --transition-fast: 0.2s ease;
    --transition: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-duration: 1s; /* For slide transitions */
    --fade-to-black-duration: 0.5s;
    --fade-in-duration: 1s;

    /* ============================================
       Z-INDEX SCALE
       ============================================ */

    --z-base: 1;
    --z-slide-active: 2;
    --z-overlay: 5;
    --z-nav: 10;
    --z-status-bar: 15;
    --z-status-bar-above: 16;
    --z-sticky: 50;
    --z-panel: 100;
    --z-fade-overlay: 200;
    --z-modal: 300;
    --z-toast: 1000;

    /* ============================================
       LAYOUT
       ============================================ */

    --text-slide-width: 85%;
    --panel-width: clamp(320px, 40vw, 600px);
    --panel-close-scale: 0.95;
    --caption-position: relative; /* relative or fixed */

    /* ============================================
       BUTTON SYSTEM
       ============================================ */

    --btn-border-radius: var(--border-radius-md);
    --btn-border-radius-sm: var(--border-radius-sm);
    --btn-padding-xs: 0;
    --btn-padding-sm: var(--space-xs) var(--space-sm);
    --btn-padding-md: var(--space-sm) var(--space-lg);
    --btn-padding-lg: var(--space-md) var(--space-xl);
    --btn-font-size-xs: var(--font-size-xs);
    --btn-font-size-sm: var(--font-size-sm);
    --btn-font-size-md: var(--font-size-base);
    --btn-font-size-lg: var(--font-size-lg);

    /* ============================================
       EMOJI ICONS
       ============================================ */

    --emoji-settings: "⚙";
    /* --emoji-photo: "📷 ";
    --emoji-text: "📝 ";
    --emoji-export: "📥 ";
    --emoji-import: "📤 ";
    --emoji-delete: "🗑️ ";
    --emoji-reset: "⚠️ ";
    --emoji-formatting: "✏️ ";
    --emoji-update: "🔄 "; */
}

html, body {
    height: 100vh;
    /* height: 100dvh; */ /* Use dynamic viewport height on supported browsers */
    overflow: hidden;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
}

body {
    background: var(--primary-bg);
    position: fixed;
    width: 100%;
    height: 100vh;
    overscroll-behavior: none;
}

.hidden {
	display: none ! important;
}

/* ============================================
   BUTTON SYSTEM
   ============================================ */

/* Base Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    border: none;
    cursor: pointer;
    font-family: var(--font-family);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    transition: opacity var(--transition), background var(--transition);
    white-space: nowrap;
}

/* Button Sizes */
.btn-xs {
    width: 22px;
    height: 22px;
    padding: var(--btn-padding-xs);
    font-size: var(--btn-font-size-xs);
    border-radius: var(--btn-border-radius-sm);
}

.btn-sm {
    padding: var(--btn-padding-sm);
    font-size: var(--btn-font-size-sm);
    border-radius: var(--btn-border-radius-sm);
}

.btn-md {
    padding: var(--btn-padding-md);
    font-size: var(--btn-font-size-md);
    border-radius: var(--btn-border-radius);
}

.btn-lg {
    padding: var(--btn-padding-lg);
    font-size: var(--btn-font-size-lg);
    border-radius: var(--btn-border-radius);
}

/* Button Variants */
.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    opacity: var(--opacity-hover, 0.85);
}

.btn-secondary {
    background: var(--gray-300, #e0e0e0);
    color: var(--text-primary);
}

.btn-secondary:hover {
    opacity: var(--opacity-hover, 0.85);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    opacity: var(--opacity-hover, 0.85);
}

.btn-ghost {
    background: var(--gray-150, #f0f0f0);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--gray-300, #e0e0e0);
}

.btn-ghost:active {
    background: var(--gray-400, #d0d0d0);
}

.btn-ghost.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Special Button States */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Label as Button */
label.btn {
    cursor: pointer;
}

label.btn input[type="file"] {
    display: none;
}

/* Full Width Option */
.btn-block {
    width: 100%;
    display: flex;
}


/* Welcome View */
.welcome-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--text-slide-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-base, 1);
}

.welcome-view.hidden {
    display: none;
}

/* Fade overlay for panel close animation */
.fade-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    opacity: 0;
    pointer-events: none;
    z-index: var(--z-fade-overlay, 200);
    transition: opacity var(--fade-to-black-duration) ease;
}

.fade-overlay.active {
    opacity: 1;
}

/* Import Modal - Full screen overlay */
.import-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: var(--z-modal, 300);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.import-modal-content {
    background: var(--panel-bg);
    border-radius: var(--border-radius);
    padding: var(--space-2xl);
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg, 0 10px 40px rgba(0, 0, 0, 0.2));
}

.import-modal h2 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
}

.import-modal-message {
    font-size: var(--font-size-md);
    color: var(--text-light);
    margin-bottom: var(--space-lg);
    min-height: 1.5em;
}

.import-modal-progress {
    font-size: var(--font-size-sm);
    color: var(--accent);
    margin-bottom: var(--space-lg);
    min-height: 1.2em;
}

.import-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: var(--border-radius-full, 50%);
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-xl);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.import-modal-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    margin-top: var(--space-xl);
}

.import-modal-actions button {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-base);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: var(--font-weight-medium);
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.import-modal-actions .btn-primary {
    background: var(--accent);
    color: white;
}

.import-modal-actions .btn-primary:hover {
    background: var(--accent-hover, #3a7bc8);
    transform: translateY(-1px);
}

.import-modal-actions .btn-secondary {
    background: var(--border);
    color: var(--text-primary);
}

.import-modal-actions .btn-secondary:hover {
    background: var(--gray-400, #d0d0d0);
}

.import-modal-actions .btn-danger {
    background: var(--danger);
    color: white;
}

.import-modal-actions .btn-danger:hover {
    background: var(--danger-hover, #c44133);
}

.import-modal.success .import-spinner {
    border-top-color: var(--success);
    animation: none;
}

.import-modal.success h2 {
    color: var(--success);
}

/* Sync Modal Styles */
.sync-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: var(--z-modal, 300);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: syncModalFadeIn 0.3s ease;
}

@keyframes syncModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sync-modal-content {
    background: var(--panel-bg);
    border-radius: var(--border-radius-lg, 16px);
    padding: var(--space-2xl) var(--space-3xl, 48px);
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: syncModalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes syncModalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.sync-modal-icon {
    margin-bottom: var(--space-xl);
}

.sync-icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover, #2980b9));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 8px 24px rgba(52, 152, 219, 0.3);
}

.sync-icon-svg,
.sync-icon-check {
    width: 40px;
    height: 40px;
    color: white;
}

.sync-icon-svg {
    animation: syncIconSpin 1.5s linear infinite;
}

@keyframes syncIconSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.sync-modal.complete .sync-icon-circle {
    background: linear-gradient(135deg, var(--success), #27ae60);
    box-shadow: 0 8px 24px rgba(46, 204, 113, 0.3);
    animation: syncComplete 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes syncComplete {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.sync-modal.complete .sync-icon-svg {
    display: none;
}

.sync-modal.complete .sync-icon-check {
    display: block;
    animation: checkDraw 0.4s ease-out forwards;
}

@keyframes checkDraw {
    from {
        stroke-dasharray: 30;
        stroke-dashoffset: 30;
    }
    to {
        stroke-dasharray: 30;
        stroke-dashoffset: 0;
    }
}

.sync-modal.error .sync-icon-circle {
    background: linear-gradient(135deg, var(--danger, #e74c3c), #c0392b);
    box-shadow: 0 8px 24px rgba(231, 76, 60, 0.3);
}

.sync-modal-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    transition: color 0.3s ease;
}

.sync-modal.complete .sync-modal-title {
    color: var(--success);
}

.sync-modal-stage {
    font-size: var(--font-size-md);
    color: var(--text-light);
    margin-bottom: var(--space-lg);
    min-height: 1.5em;
    transition: opacity 0.2s ease;
}

.sync-modal-progress-container {
    margin-bottom: var(--space-lg);
}

.sync-modal-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.sync-modal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover, #2980b9));
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.sync-modal.complete .sync-modal-progress-fill {
    background: linear-gradient(90deg, var(--success), #27ae60);
}

.sync-modal-progress-text {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.sync-modal-details {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    min-height: 1.2em;
    margin-bottom: var(--space-md);
}

.sync-modal-summary {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
    animation: summaryFadeIn 0.4s ease;
}

@keyframes summaryFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.sync-summary-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
}

.sync-summary-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-secondary, rgba(0,0,0,0.1));
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

.sync-summary-item .summary-icon {
    font-size: var(--font-size-base);
}

.sync-summary-item.added { color: var(--success); }
.sync-summary-item.updated { color: var(--accent); }
.sync-summary-item.deleted { color: var(--text-muted); }
.sync-summary-item.settings { color: var(--warning, #f39c12); }

.welcome-content {
    max-width: var(--text-slide-width);
    padding: var(--space-2xl);
    text-align: center;
    color: var(--text-white);
    margin-right: var(--panel-width);
}

.welcome-content h1 {
    font-size: clamp(2rem, 8vw, 5rem);
    font-weight: var(--font-weight-normal);
    margin-bottom: var(--space-lg);
}

.welcome-content p {
    font-size: clamp(1.2rem, 3vw, 2rem);
    opacity: var(--opacity-muted, 0.9);
}

.welcome-content p:empty {
    display: none;
}

.welcome-content .btn {
    margin-top: var(--space-xl);
}

/* Slideshow Styles */
.slideshow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--photo-slide-bg);
    display: none;
    transition: opacity 0.3s ease;
}

.slideshow.active {
    display: block;
}

.slideshow-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    transition: background var(--transition);
    pointer-events: none;
    z-index: var(--z-overlay, 5);
}

.slideshow.dimmed .slideshow-overlay {
    background: rgba(0, 0, 0, 0.7);
}

.slide-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-duration) ease-in-out;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
}

.slide.active {
    opacity: 1;
    z-index: var(--z-slide-active, 2);
}

.slide.transitioning {
    z-index: var(--z-base, 1);
    will-change: opacity;
}

.slide:not(.transitioning) {
    will-change: auto;
}

.slide img {
    max-width: 100%;
    max-height: 85%;
    object-fit: contain;
    border-radius: var(--photo-corner-radius);
}

/* Vintage Photo Styles - Random styling for photos */
/* These styles can be toggled on/off via the .vintage-photos class on the slide */

/* Base vintage photo wrapper - applies rotation and shadow */
.slide.vintage-photos img {
    /* Rotation and shadow will be set via inline styles for randomness */
    transition: transform 0.3s ease;
}

/* Style 1: No border (clean modern look) */
.slide.vintage-photos.photo-style-none img {
    border: none;
    background: none;
    padding: 0;
    border-radius: var(--photo-radius-none);
}

/* Style 2: Equal white border (same on all sides) */
.slide.vintage-photos.photo-style-equal-border img {
    border: 13px solid white;
    background: white;
    padding: 13px;
    box-sizing: content-box;
    border-radius: var(--photo-radius-equal-border);
    max-width: 70%;
    max-height: 70%;
}

/* Style 3: Square-crop Polaroid (portrait photos only) */
.slide.vintage-photos.photo-style-square-polaroid img {
    border: 6.5px solid white;
    background: white;
    padding: 4px;
    padding-bottom: 48px;
    box-sizing: content-box;
    border-radius: var(--photo-radius-polaroid);
    aspect-ratio: 1 / 1;
    object-fit: cover;
    max-width: 60%;
    max-height: 60%;
}

.slide .caption {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-white);
    padding: var(--space-lg) var(--space-2xl);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-xl, 1.424rem);
    text-align: center;
    max-width: 80%;
}

.slide .caption.caption-relative {
    bottom: var(--space-2xl, 2rem);
}

.slide .caption.caption-fixed {
    bottom: var(--space-4xl, 4rem);
    position: fixed;
}

.slide.text-slide {
    padding: var(--space-2xl);
    text-align: left;
    font-size: var(--font-size-slideshow);
    line-height: var(--line-height-normal);
    color: var(--text-white);
}

.slide.text-slide > * {
    margin: 0;
    padding: 0;
}

/* Text slide headings and first paragraph */
.slide.text-slide h1,
.slide.text-slide h2,
.slide.text-slide h3,
.slide.text-slide p:first-child {
    font-size: 5vw;
    line-height: 6vw;
    font-family: system-ui, sans-serif;
    font-weight: 300;
    margin-bottom: var(--space-3xl, 3rem);
}

/* Bold text */
.slide.text-slide strong,
.slide.text-slide b {
    font-weight: 700;
}

/* Other paragraph tags */
.slide.text-slide p {
    font-size: 2.3vw;
    line-height: 3vw;
}

/* Text slide lists */
.slide.text-slide ul,
.slide.text-slide ol {
    margin: 0;
    padding: 0;
    text-align: left;
    list-style-type: none;
}

.slide.text-slide li {
    margin-bottom: var(--space-md);
    font-size: 2.3vw;
    line-height: 3vw;
    padding-left: 1.5em;
    text-indent: -1.5em;
}

.slide.text-slide li:before {
    content: '→ ';
}

.slide.text-slide li:last-child {
    margin-bottom: 0;
}

/* Nested lists */
.slide.text-slide ul ul,
.slide.text-slide ol ol,
.slide.text-slide ul ol,
.slide.text-slide ol ul {
    margin-top: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.slide.clock-slide {
    background: var(--text-slide-bg);
    color: var(--text-white);
    text-align: center;
}

.clock-time {
    font-size: var(--font-size-clock);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.clock-date {
    font-size: var(--font-size-date);
    font-weight: var(--font-weight-normal);
    margin-top: -0.25em;
    opacity: var(--opacity-muted, 0.9);
}

.clock-messages {
    margin-top: var(--space-3xl, 3rem);
    display: flex;
    flex-direction: row;
    gap: var(--space-lg);
    justify-content: center;
    align-items: stretch;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.clock-message {
    flex: 1;
    border: 1px solid currentColor;
    border-radius: var(--border-radius-lg, 0.75rem);
    padding: var(--space-lg) var(--space-2xl) var(--space-lg) var(--space-xl);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.clock-message-date {
    font-size: 1rem;
    font-weight: var(--font-weight-normal);
    text-transform: uppercase;
}

.clock-message-text {
    font-size: 1.3rem;
    font-weight: var(--font-weight-normal);
    line-height: 1.5;
}

.clock-message-text strong,
.clock-message-text b {
    font-weight: 700;
}

.clock-message-text ul,
.clock-message-text ol {
    margin: 0;
    padding: 0;
    list-style-type: none;
}

.clock-message-text li {
    padding-left: 1.2em;
    text-indent: -1.2em;
}

.clock-message-text li::before {
    content: '→ ';
}

/* Scheduled slide indicator in list view */
.content-item.scheduled {
    position: relative;
}

.schedule-info {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-light);
    margin-top: var(--space-xs);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: var(--space-xs, 0.25rem);
}

.schedule-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--success-alt, #4caf50);
}

/* Navigation Buttons */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    width: 3rem;
    height: 5rem;
    font-size: var(--font-size-2xl);
    cursor: pointer;
    opacity: var(--opacity-inactive, 0.65);
    transition: opacity var(--transition), background var(--transition);
    z-index: var(--z-nav, 10);
}

@media (prefers-color-scheme: light) {
    .nav-btn {
        background: rgba(0, 0, 0, 0.1);
        border: 1px solid rgba(0, 0, 0, 0.2);
        color: #000000;
    }
    
    .nav-btn:hover,
    .nav-btn:focus {
        background: rgba(0, 0, 0, 0.2);
    }
    
    .settings-btn {
        color: #000000;
    }
}

@media (prefers-color-scheme: dark) {
    .nav-btn {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: #ffffff;
    }
    
    .nav-btn:hover,
    .nav-btn:focus {
        background: rgba(255, 255, 255, 0.2);
    }
    
    .settings-btn {
        color: #ffffff;
    }
}

.nav-btn:hover,
.nav-btn:focus-visible {
    opacity: var(--opacity-muted, 0.9);
}

.nav-btn:focus {
    outline: none;
}

.nav-btn:focus-visible {
    outline: 2px solid var(--accent, #4a90e2);
    outline-offset: 2px;
}

.nav-btn.prev {
    left: 0;
    border-radius: 0 var(--border-radius-md, 0.5rem) var(--border-radius-md, 0.5rem) 0;
    border-left: none;
}

.nav-btn.next {
    right: 0;
    border-radius: var(--border-radius-md, 0.5rem) 0 0 var(--border-radius-md, 0.5rem);
    border-right: none;
}

/* Control Buttons (used in editor status bar) */
.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--border-radius, 0.375rem);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.control-btn svg {
    width: 100%;
    height: 100%;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.pause-btn.paused .pause-icon {
    display: none;
}

.pause-btn.paused .play-icon {
    display: block !important;
}

.pause-btn.paused {
    background: rgba(255, 100, 100, 0.3);
    border-color: rgba(255, 100, 100, 0.5);
}

/* Editor Status Bar */
.editor-status-bar {
    position: fixed;
    top: calc(1rem + env(safe-area-inset-top));
    left: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--border-radius-md, 0.5rem);
    padding: 0.5rem 1rem;
    display: grid;
    grid-template-columns: auto 1fr auto 1fr auto;
    align-items: center;
    z-index: var(--z-status-bar, 15);
    font-size: var(--font-size-sm, 0.875rem);
    color: rgba(255, 255, 255, 0.9);
    gap: var(--space-lg, 1rem);
}

/* Progressive enhancement for backdrop-filter */
@supports (backdrop-filter: blur(10px)) {
    .editor-status-bar {
        backdrop-filter: blur(10px);
    }
}

@supports not (backdrop-filter: blur(10px)) {
    .editor-status-bar {
        background: rgba(0, 0, 0, 0.8);
    }
}

.status-bar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-start;
    grid-column: 1;
}

.status-bar-left-info {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    grid-column: 2;
}

.status-bar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: 3;
}

.status-bar-right-info {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    grid-column: 4;
}

.status-bar-right {
    display: flex;
    align-items: center;
    gap: var(--space-md, 0.75rem);
    justify-content: flex-end;
    grid-column: 5;
}

.status-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs, 0.25rem);
}

.push-btn {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm, 0.875rem);
    background: var(--info, #3b82f6);
    border: 1px solid var(--info-dark, #2563eb);
    color: white;
    border-radius: var(--border-radius, 0.375rem);
    cursor: pointer;
    font-weight: 500;
    transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.push-btn:hover {
    background: var(--info-dark, #2563eb);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.15));
}

.push-btn:active {
    transform: translateY(0);
}

.push-btn:disabled,
.check-updates-btn:disabled {
    cursor: not-allowed;
    background: var(--gray-700, #6b7280);
    border-color: var(--gray-800, #4b5563);
}

.push-btn:disabled:hover,
.check-updates-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Button internal structure */
.push-btn .btn-progress,
.check-updates-btn .btn-progress {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0;
    background: var(--info, #3b82f6);
    transition: width 0.15s ease-out;
    z-index: 0;
}

.push-btn .btn-content,
.check-updates-btn .btn-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.35em;
}

.push-btn .btn-spinner,
.check-updates-btn .btn-spinner {
    display: none;
}

/* Syncing state */
.push-btn.syncing,
.push-btn:disabled.syncing,
.check-updates-btn.syncing,
.check-updates-btn:disabled.syncing {
    cursor: wait;
    background: var(--gray-700, #6b7280) !important;
    color: white;
}

.push-btn.syncing .btn-spinner,
.check-updates-btn.syncing .btn-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

.check-updates-btn {
    position: relative;
    overflow: hidden;
}

.status-item.syncing {
    color: var(--info, #3b82f6);
    font-weight: 500;
}

@media (max-width: 768px) {
    .editor-status-bar {
        padding: 0.5rem;
        font-size: var(--font-size-xs, 0.75rem);
        gap: 0.5rem;
        bottom: 0.5rem;
        left: 0.5rem;
        right: 0.5rem;
        grid-template-columns: minmax(0, auto) auto minmax(0, 1fr);
    }

    .status-bar-left {
        gap: var(--space-xs, 0.25rem);
    }

    .status-bar-left .control-btn,
    .status-bar-center .control-btn {
        width: 2rem;
        height: 2rem;
        padding: var(--space-xs, 0.25rem);
    }

    .status-bar-right {
        gap: 0.5rem;
    }

    .push-btn {
        padding: var(--space-xs, 0.25rem) var(--space-md, 0.75rem);
        font-size: var(--font-size-xs, 0.75rem);
    }

    .status-separator {
        display: none;
    }
}

/* Settings Panel */
.settings-panel {
    position: absolute;
    top: 0;
    right: -100%;
    width: min(100%, var(--panel-width));
    height: 100%;
    background: var(--panel-bg);
    box-shadow: var(--shadow-panel, -5px 0 20px rgba(0, 0, 0, 0.2));
    transition: right var(--transition);
    z-index: var(--z-panel, 100);
    display: flex;
    flex-direction: column;
}

.settings-panel.open {
    right: 0;
}

.settings-panel.fading {
    transition: opacity var(--fade-to-black-duration) ease;
    opacity: 0;
}

.settings-header {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--panel-bg);
    z-index: var(--z-nav, 10);
}

.settings-header h1 {
    font-size: var(--font-size-xl);
    color: var(--text-primary);
}

.close-settings {
    /* Uses: btn btn-primary btn-md */
}

.settings-content {
    padding: var(--space-xl);
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.settings-content section {
    margin-bottom: var(--space-2xl);
}

.settings-content section:last-child {
    margin-bottom: 0;
}

/* Remove bottom margin from upload-section when text creator is visible */
.settings-content .upload-section:has(+ #text-creator:not(.hidden)),
.settings-content .upload-section:has(~ #text-creator:not(.hidden)) {
    margin-bottom: 0;
}

.settings-content h2 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
}

.settings-content h3 {
    font-size: var(--font-size-md);
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

/* Upload Section */
/* Drag and Drop Zone */
.upload-drop-zone {
    border: 3px dashed var(--border);
    border-radius: var(--border-radius-md, 0.5rem);
    padding: var(--space-xl);
    text-align: center;
    background: var(--gray-50, #fafafa);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-drop-zone:hover {
    border-color: var(--accent);
    background: var(--surface-light, #f9f9f9);
}

.upload-drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(79, 70, 229, 0.05);
    transform: scale(1.02);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-zone-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.6;
}

.drop-zone-text {
    font-size: var(--font-size-lg, 1.125rem);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.drop-zone-or {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-tertiary);
    margin: var(--space-lg) 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.upload-buttons {
    display: flex;
    gap: var(--space-lg);
    pointer-events: auto;
}

.upload-btn {
    flex: 1;
}

/* Text Slide Creator */
.text-creator {
    background: var(--gray-100, #f5f5f5);
    padding: var(--space-lg);
    border-radius: var(--border-radius-md, 0.5rem);
}

.text-creator.hidden {
    display: none;
}

/* Text Slide Preview Container - Hidden (using WYSIWYG textarea instead) */
.text-slide-preview-container {
    display: none !important;
}

.preview-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border);
    background: var(--gray-50, #fafafa);
}

@media (prefers-color-scheme: dark) {
    .preview-header {
        background: var(--gray-800, #2d2d2d);
    }
}

.preview-header h4 {
    margin: 0;
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.text-slide-preview-content {
    padding: var(--space-2xl, 3rem);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl, 1.5rem);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--surface, white);
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: center;
}

@media (prefers-color-scheme: dark) {
    .text-slide-preview-content {
        background: var(--surface, #1a1a1a);
    }
}

.text-slide-preview-content.has-content {
    text-align: left;
    align-items: flex-start;
}

.text-slide-preview-content * {
    max-width: 100%;
}

.text-slide-preview-content h1,
.text-slide-preview-content h2,
.text-slide-preview-content h3 {
    margin-top: 0;
    margin-bottom: var(--space-md);
}

.preview-placeholder {
    color: var(--text-tertiary);
    font-style: italic;
    margin: 0;
    text-align: center;
    font-size: var(--font-size-lg, 1.125rem);
}

/* Scheduling Section */
.scheduling-section {
    /*margin-top: var(--space-lg);*/
	margin-top: 0;
    padding: var(--space-md);
    background: white;
    border: 1px solid var(--border);
	border-top: 0;
    border-radius: 0 0  0.25rem 0.25rem;
}

.scheduling-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: var(--font-size-base);
}

.scheduling-checkbox input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.scheduling-options {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

.scheduling-options.hidden {
    display: none;
}

.scheduling-options .form-group {
    margin-bottom: var(--space-md);
}

.scheduling-options .form-group:last-child {
    margin-bottom: 0;
}

.scheduling-options label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-primary);
}

/* Disable label click when date picker is open to prevent accidental re-opening */
#date-picker-group:focus-within label {
    pointer-events: none;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}

.form-control {
    width: 100%;
    padding: var(--space-sm);
    font-size: var(--font-size-base);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-sm, 0.25rem);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

.form-control:focus-visible {
    outline: none;
    border-color: var(--accent);
}

.schedule-status {
    margin-top: var(--space-md);
    padding: var(--space-sm);
    background: rgba(39, 174, 96, 0.15);
    border: 1px solid rgba(39, 174, 96, 0.3);
    border-radius: var(--border-radius-sm, 0.25rem);
    font-size: var(--font-size-sm);
    color: #4ade80;
    text-align: center;
}

.schedule-status:empty {
    display: none;
}

/* Main Text Editor Textarea */
.text-editor-textarea {
    display: block;
    width: 100%;
    height: 112px;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-md, 0.5rem);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-size: var(--font-size-md, 1.125rem);
    line-height: 1.5;
    font-family: system-ui, -apple-system, sans-serif;
    color: white;
    resize: vertical;
    overflow-y: auto;
}

.text-editor-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.text-editor-textarea:focus {
    outline: none;
    border-color: var(--accent, #4a90e2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.markdown-help {
    margin: var(--space-sm) 0 0 0;
	padding: var(--space-md);
    background: transparent;
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm, 0.25rem);
}

.markdown-help a {
    color: var(--accent, #4a90e2);
    text-decoration: none;
}

.markdown-help a:hover {
    text-decoration: underline;
}

.markdown-help a:visited {
    color: var(--accent, #4a90e2);
}

@media (prefers-color-scheme: dark) {
    .markdown-help a,
    .markdown-help a:visited {
        color: var(--accent-light, #60a5fa);
    }
}

.markdown-help code {
    background: var(--gray-100, #f0f0f0);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.9em;
}

@media (prefers-color-scheme: dark) {
    .markdown-help code {
        background: var(--gray-800, #2a2a2a);
    }
}

/* Photo Caption Dialog - removed, replaced with inline editing */

.text-options {
    display: flex;
    gap: var(--space-lg);
    margin: var(--space-lg) var(--space-0);
}

.text-options label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-primary);
}

.text-options input[type="color"] {
    width: 3rem;
    height: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm, 0.25rem);
    cursor: pointer;
}

.text-actions {
    display: flex;
    gap: var(--space-lg);
}

.text-actions button {
	margin-top: var(--space-lg);
    flex: 1;
    /* Primary/Secondary variants applied via classes */
}

#save-text-slide {
    /* Uses: btn btn-primary btn-md btn-block */
}

#cancel-text-slide {
    /* Uses: btn btn-secondary btn-md btn-block */
}

/* Slideshow Settings */
.slideshow-settings label {
    display: block;
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
}

.slideshow-settings input[type="number"] {
    width: 100%;
    padding: var(--space-sm);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-sm, 0.25rem);
    margin-top: 0.25rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.slideshow-settings input[type="checkbox"] {
    margin-right: var(--space-sm);
}

/* Content Management */
#content-management-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    min-height: 0;
}

/* Performance optimization for scrolling */
@supports (content-visibility: auto) {
    .content-item {
        content-visibility: auto;
        contain-intrinsic-size: auto 100px;
    }
}

/* Content sections (Photos and Messages) */
.content-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-md, 0.5rem);
    overflow: hidden;
}

.content-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-200, #ececec);
    border-bottom: 1px solid var(--border);
}

@media (prefers-color-scheme: dark) {
    .content-section-header {
        background: var(--gray-300, #4a4a4a);
    }
}

.content-section-title {
    font-weight: var(--font-weight-semibold, 600);
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.content-section-count {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-light);
    background: var(--panel-bg, white);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--border-radius-sm, 0.25rem);
    min-width: 1.5rem;
    text-align: center;
}

.content-section-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
    min-height: 60px;
}

.content-section-list:empty::after {
    content: attr(data-empty-message);
    display: block;
    text-align: center;
    color: var(--text-light);
    padding: var(--space-lg);
    font-style: italic;
    font-size: var(--font-size-sm, 0.875rem);
}


.content-list-empty {
    display: block;
    text-align: center;
    color: var(--text-light);
    padding: var(--space-2xl);
    font-style: italic;
}

.content-list-empty a {
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
}

/* Processing overlay */
.processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.processing-content {
    text-align: center;
}

.processing-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent);
    border-radius: var(--border-radius-full, 50%);
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.processing-text {
    margin-top: var(--space-lg);
    color: white;
    font-size: var(--font-size-lg);
    white-space: pre-line;
    text-align: center;
}

/* ============================================
   Editor Modal - Full Screen Layout
   ============================================ */

.editor-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-panel, 100);
    display: none;
    /* Match status bar: 1rem from edges */
    padding: 1rem;
}

.editor-modal.open {
    display: block;
}

.editor-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.editor-container {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* No max-width - match status bar width */
    padding: var(--space-lg);
    background: #1a1a1a;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Editor Header */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.editor-header h1 {
    font-size: var(--font-size-xl);
    color: white;
    margin: 0;
}

.editor-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.editor-status {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-sm);
}

.editor-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
}

/* Ghost button style */
.btn-ghost {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Editor Body - Two Column Layout */
.editor-body {
    flex: 1;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-xl);
    min-height: 0;
    padding: var(--space-lg) 0;
}

/* Section Headers */
.editor-section-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.editor-section-header h2 {
    font-size: var(--font-size-lg);
    color: white;
    margin: 0;
}

.count-badge {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-sm);
    min-width: 1.5rem;
    text-align: center;
}

.editor-section-header .btn {
    margin-left: auto;
}

/* Photos Section */
.editor-photos {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.photo-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    grid-auto-rows: max-content;
    gap: var(--space-md);
    overflow-y: auto;
    padding: var(--space-xs);
    align-content: start;
}

.photo-grid-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    cursor: pointer;
    background: var(--gray-800, #2a2a2a);
}

.photo-grid-item .photo-item-inner {
    position: absolute;
    inset: 0;
}

.photo-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.photo-grid-item:hover img {
    transform: scale(1.05);
}

.photo-grid-item .photo-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

/* Show delete button on hover for devices that support hover */
@media (hover: hover) {
    .photo-grid-item:hover .photo-delete-btn {
        opacity: 1;
    }
}

/* Always show delete button on touch devices */
@media (hover: none) {
    .photo-grid-item .photo-delete-btn {
        opacity: 0.7;
    }
}

.photo-grid-item .photo-delete-btn:hover {
    opacity: 1;
    background: var(--danger, #e74c3c);
}

/* Sortable states for drag-and-drop */
.photo-grid-item.sortable-ghost {
    opacity: 1 !important;
    background: rgba(74, 144, 226, 0.15) !important;
    border: 2px dashed rgba(74, 144, 226, 0.6) !important;
}

.photo-grid-item.sortable-ghost img {
    visibility: hidden;
}

.photo-grid-item.sortable-ghost .photo-delete-btn {
    display: none;
}

.photo-grid-item.sortable-chosen {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    transform: scale(1.05);
    z-index: 10;
}

.message-item.sortable-ghost {
    opacity: 1 !important;
    background: rgba(74, 144, 226, 0.15) !important;
    border: 2px dashed rgba(74, 144, 226, 0.6) !important;
}

.message-item.sortable-ghost * {
    visibility: hidden;
}

.message-item.sortable-chosen {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

/* Photo Dropzone */
/* Photo Ghost Placeholder */
.photo-ghost {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
}

.photo-ghost .photo-item-inner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ghost-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: ghost-spin 0.8s linear infinite;
}

@keyframes ghost-spin {
    to { transform: rotate(360deg); }
}

/* Photo Dropzone */
.photo-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.photo-dropzone:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
}

.photo-dropzone.drag-over {
    border-color: var(--accent);
    background: rgba(74, 144, 226, 0.2);
}

.dropzone-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.dropzone-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: var(--space-xs);
}

.dropzone-text {
    font-size: var(--font-size-sm);
}

/* Messages Section */
.editor-messages {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.messages-list-container {
    flex: 1;
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.messages-list:empty::after {
    content: "No messages yet";
    display: block;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    padding: var(--space-xl);
    font-style: italic;
}

/* Message Item */
.message-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
    padding: var(--space-md);
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.message-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.message-item-content {
    color: rgba(255, 255, 255, 0.9);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    margin-bottom: var(--space-xs);
    padding-left: var(--space-lg);
    padding-right: var(--space-md);
}

.message-item-content strong,
.message-item-content b {
    font-weight: 700;
}

.message-item-content ul,
.message-item-content ol {
    margin: 0;
    padding: 0;
    list-style-type: none;
}

.message-item-content li {
    padding-left: 1.2em;
    text-indent: -1.2em;
}

.message-item-content li::before {
    content: '→ ';
}

.message-item-meta {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.5);
    padding-left: var(--space-lg);
}

.message-item .message-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

/* Show delete button on hover for devices that support hover */
@media (hover: hover) {
    .message-item:hover .message-delete-btn {
        opacity: 1;
    }
}

/* Always show delete button on touch devices */
@media (hover: none) {
    .message-item .message-delete-btn {
        opacity: 0.7;
    }
}

.message-item .message-delete-btn:hover {
    opacity: 1;
    background: var(--danger, #e74c3c);
}

.message-item .drag-handle {
    position: absolute;
    left: 4px;
    top: 4px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    cursor: grab;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

/* Show drag handle on hover for devices that support hover */
@media (hover: hover) {
    .message-item:hover .drag-handle {
        opacity: 1;
    }
}

/* Always show drag handle on touch devices */
@media (hover: none) {
    .message-item .drag-handle {
        opacity: 0.5;
    }
}

.message-item .drag-handle:active {
    cursor: grabbing;
}

/* Message Form Overlay */
.message-form-overlay {
    position: absolute;
    inset: 0;
    background: rgba(30, 30, 30, 0.98);
    border-radius: var(--border-radius-md);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.message-form-overlay.hidden {
    display: none;
}

.message-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
    gap: var(--space-md);
    overflow-y: auto;
}

.message-textarea {
    flex: 0 0 auto;
    height: 180px;
    padding: var(--space-md);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: var(--font-size-lg);
    font-family: inherit;
    resize: none;
}

.message-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.message-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.message-form .scheduling-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-md);
    padding: var(--space-md);
}

.message-form .scheduling-checkbox {
    color: rgba(255, 255, 255, 0.8);
}

.message-form .scheduling-options {
    margin-top: var(--space-md);
}

.message-form .scheduling-options label {
    color: rgba(255, 255, 255, 0.7);
}

.message-form .form-group {
    margin-bottom: var(--space-md);
}

.message-form .radio-group label {
    color: rgba(255, 255, 255, 0.8);
}

.message-form-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

/* Editor Footer */
.editor-footer {
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-footer-left {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.editor-footer .version-info {
    color: rgba(255, 255, 255, 0.4);
    font-size: var(--font-size-sm);
}

.editor-footer .editor-status {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--font-size-sm);
}

/* ============================================
   Photo Detail Modal
   ============================================ */

.photo-detail-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal, 200);
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-detail-modal.hidden {
    display: none;
}

.photo-detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
}

.photo-detail-content {
    position: relative;
    background: var(--gray-900, #1a1a1a);
    border-radius: var(--border-radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.photo-detail-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.photo-detail-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

#photo-detail-img {
    width: 100%;
    max-height: 50vh;
    object-fit: contain;
    background: black;
}

.photo-detail-form {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.photo-detail-caption-input {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: var(--font-size-base);
}

.photo-detail-caption-input:focus {
    outline: none;
    border-color: var(--accent);
}

.photo-detail-caption-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.photo-detail-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: space-between;
}

/* ============================================
   Settings Modal
   ============================================ */

.settings-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal, 200);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-modal.hidden {
    display: none;
}

.settings-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
}

.settings-modal-content {
    position: relative;
    background: var(--panel-bg, white);
    border-radius: var(--border-radius-lg);
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.settings-modal-header h2 {
    margin: 0;
    font-size: var(--font-size-lg);
    color: var(--text-primary);
}

.settings-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

.settings-modal-body .settings-group {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--border);
}

.settings-modal-body .settings-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.settings-modal-body .settings-group h3 {
    font-size: var(--font-size-md);
    color: var(--text-primary);
    margin: 0 0 var(--space-md) 0;
}

.settings-modal-body .settings-group label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.settings-modal-body .settings-group select,
.settings-modal-body .settings-group input[type="number"] {
    margin-left: auto;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.settings-modal-body .settings-group select option {
    background: #2a2a2a;
    color: white;
}

.settings-button-row {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-sm);
}

.settings-button-row:last-child {
    margin-bottom: 0;
}

/* Light-themed buttons in settings modal */
.settings-modal .btn-ghost {
    background: var(--gray-150, #f0f0f0);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.settings-modal .btn-ghost:hover {
    background: var(--gray-300, #e0e0e0);
}

/* Responsive: Stack on narrow screens */
@media (max-width: 768px) {
    .editor-body {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .editor-header h1 {
        font-size: var(--font-size-lg);
    }

    .editor-status {
        display: none;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: var(--space-xl, 2rem);
    right: var(--space-xl, 2rem);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm, 0.5rem);
    max-width: 400px;
}

.toast {
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(8px);
    border-radius: var(--border-radius-md, 0.5rem);
    padding: var(--space-md, 1rem);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md, 1rem);
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid var(--accent);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.success {
    border-left-color: #22c55e;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast.info {
    border-left-color: var(--accent);
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    line-height: 1;
}

.toast.success .toast-icon {
    color: #22c55e;
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.warning .toast-icon {
    color: #f59e0b;
}

.toast.info .toast-icon {
    color: var(--accent);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    color: white;
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: var(--font-size-sm, 0.875rem);
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity var(--transition);
}

.toast-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.hiding {
    animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Upload Preview Modal */
.upload-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: var(--space-xl);
}

.upload-preview-content {
    background: rgba(30, 30, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg, 0.75rem);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.upload-preview-header {
    padding: var(--space-xl);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.upload-preview-header h3 {
    margin: 0 0 var(--space-sm) 0;
    font-size: var(--font-size-xl, 1.25rem);
    color: white;
}

.upload-preview-subtitle {
    margin: 0;
    font-size: var(--font-size-sm, 0.875rem);
    color: rgba(255, 255, 255, 0.6);
}

.upload-preview-grid {
    padding: var(--space-xl);
    overflow-y: auto;
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-lg);
}

.preview-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.preview-thumbnail {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: var(--border-radius-md, 0.5rem);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.preview-caption-input {
    width: 100%;
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-sm, 0.25rem);
    font-size: var(--font-size-sm, 0.875rem);
    font-family: inherit;
    color: white;
}

.preview-caption-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.preview-caption-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.preview-remove-btn {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: var(--border-radius-sm, 0.25rem);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-sm, 0.875rem);
    cursor: pointer;
    transition: all var(--transition);
}

.preview-remove-btn:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.upload-preview-actions {
    padding: var(--space-xl);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
}

.upload-preview-actions .btn {
    min-width: 120px;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-preview-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.upload-preview-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.upload-preview-actions .btn-primary {
    background: var(--accent);
    border: none;
    color: white;
}

.upload-preview-actions .btn-primary:hover {
    background: var(--accent-hover);
}

/* Custom Confirmation Modal */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    animation: fadeIn 0.2s ease-out;
}

.confirm-modal-content {
    background: rgba(30, 30, 30, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg, 0.75rem);
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.confirm-modal-header {
    padding: var(--space-xl);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.confirm-modal-header h3 {
    margin: 0;
    font-size: var(--font-size-lg, 1.125rem);
    color: white;
}

.confirm-modal-body {
    padding: var(--space-xl);
}

.confirm-modal-body p {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
}

.confirm-modal-actions {
    padding: var(--space-xl);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
}

.confirm-modal-actions .btn {
    min-width: 100px;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-modal-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.confirm-modal-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.confirm-modal-actions .btn-danger {
    background: var(--danger);
    border: none;
    color: white;
}

.confirm-modal-actions .btn-danger:hover {
    background: var(--danger-hover);
}

.confirm-modal-actions .btn-primary {
    background: var(--accent);
    border: none;
    color: white;
}

.confirm-modal-actions .btn-primary:hover {
    background: var(--accent-hover);
}

.content-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--surface-light, #f9f9f9);
    border-radius: var(--border-radius-sm, 0.25rem);
    margin-bottom: var(--space-sm);
    position: relative;
    transition: background var(--transition);
}

.content-item:hover,
.content-item:focus-within {
    background: var(--gray-200, #ececec);
}

.content-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    background: var(--gray-300, #e0e0e0);
}

/* Drag insertion indicator */
.drop-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    pointer-events: none;
    z-index: var(--z-nav, 10);
}

.drop-indicator::before,
.drop-indicator::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: var(--border-radius-full, 50%);
    top: -2.5px;
}

.drop-indicator::before {
    left: -4px;
}

.drop-indicator::after {
    right: -4px;
}

.drag-handle {
    color: var(--gray-500, #999999);
    font-size: var(--font-size-lg);
    cursor: grab;
    padding-top: 0.25rem;
    user-select: none;
    -webkit-user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.content-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius-sm, 0.25rem);
}

.content-item .content-info {
    flex: 1;
    min-width: 0;
}

.content-item .content-type {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-light);
    margin-bottom: var(--space-xs);
}

.content-item .caption-input {
    width: 100%;
    padding: var(--space-sm) 0.75rem;
    height: 2.5rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm, 0.25rem);
    font-size: var(--font-size-sm, 0.875rem);
    font-family: var(--font-family);
}

/* Inline text editor (textarea) */
.text-editor-inline {
    width: 100%;
    min-height: 80px;
    max-height: 200px;
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm, 0.25rem);
    background: white;
    font-size: var(--font-size-md);
    line-height: 1.5;
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    resize: vertical;
    overflow-y: auto;
}

.text-editor-inline:focus {
    outline: 2px solid var(--accent, #4a90e2);
    outline-offset: -1px;
}

.content-item button {
    height: 2rem;
    min-width: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: var(--border-radius-sm, 0.25rem);
    cursor: pointer;
    font-size: var(--font-size-xl);
    font-weight: bold;
}

.content-item .text-preview {
    padding: var(--space-sm);
    background: var(--primary-bg);
    color: white;
    border-radius: var(--border-radius-sm, 0.25rem);
    font-size: var(--font-size-sm, 0.875rem);
    max-height: 60px;
    overflow: hidden;
}

.content-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.content-actions button {
    padding: var(--space-sm) var(--space-sm);
    border: none;
    border-radius: var(--border-radius-sm, 0.25rem);
    cursor: pointer;
    font-size: var(--font-size-sm, 0.875rem);
    white-space: nowrap;
}

.content-item button {
    padding: var(--space-sm);
    border: none;
    border-radius: var(--border-radius-sm, 0.25rem);
    cursor: pointer;
    font-size: var(--font-size-sm);
	background-color: transparent;
    transition: background var(--transition);
}

.content-item button:hover {
	background-color: rgba(0,0,0,.1);
}

/* Advanced Settings */
.advanced-toggle {
    background: none;
    border: none;
    padding: 0;
    font-size: var(--font-size-base);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-lg) var(--space-0) var(--space-lg);
    color: var(--accent);
    text-decoration: none;
    transition: text-decoration 0.2s ease;
}

.advanced-toggle:hover {
    text-decoration: underline;
}

.advanced-toggle .chevron {
    transition: transform var(--transition);
}

.advanced-toggle.expanded .chevron {
    transform: rotate(90deg);
}

.advanced-settings {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.advanced-settings:not(.hidden) {
    max-height: none;
    overflow: visible;
}

/* Buttons in advanced settings styled as links */
.advanced-settings .btn {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: text-decoration 0.2s ease;
}

.advanced-settings .btn-primary,
.advanced-settings label.btn-primary {
    color: var(--accent);
}

.advanced-settings .btn-primary:hover,
.advanced-settings label.btn-primary:hover {
    text-decoration: underline;
    opacity: 1;
}

.advanced-settings .btn-danger {
    color: var(--danger);
}

.advanced-settings .btn-danger:hover {
    text-decoration: underline;
    opacity: 1;
}

.advanced-settings .btn-secondary {
    color: var(--text-primary);
}

.advanced-settings .btn-secondary:hover {
    text-decoration: underline;
    opacity: 1;
}

/* Links in advanced settings */
.advanced-settings a {
    text-decoration: underline;
}

.settings-group {
    background: var(--surface-light, #f9f9f9);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-md, 0.5rem);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.settings-group h3 {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-sm);
}

/* Collapsible section headers */
.settings-group h3.section-toggle {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    user-select: none;
}

.settings-group h3.section-toggle:hover {
    color: var(--accent);
}

.section-chevron {
    font-size: var(--font-size-xs, 0.75rem);
    transition: transform var(--transition);
}

.section-toggle.expanded .section-chevron {
    transform: rotate(90deg);
}

/* Collapsible section content */
.section-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    margin-top: var(--space-lg);
}

.section-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.settings-group label {
    display: block;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.settings-group input[type="checkbox"] {
    margin-right: var(--space-sm);
}

.settings-group input[type="color"] {
    width: 3rem;
    height: 2rem;
    margin-left: var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm, 0.25rem);
    cursor: pointer;
}

/* Range Sliders */
.range-label {
    display: block;
    margin-bottom: var(--space-lg);
}

.range-label span {
    font-weight: var(--font-weight-medium);
    color: var(--accent);
}

.range-label input[type="range"] {
    width: 100%;
    margin-top: var(--space-sm);
}

/* Action Buttons */
.button-group {
    margin-bottom: var(--space-lg);
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.action-btn {
    /* Uses: btn btn-primary btn-md */
}

.danger-btn {
    /* Uses: btn btn-danger btn-md */
}

label.action-btn {
    /* Handled by label.btn base class */
}

.btn-import {
    margin-bottom: 0;
}

.cancel-btn {
    /* Uses: btn btn-secondary btn-md */
    margin-right: var(--space-sm);
}

.button-description {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-light);
    margin: var(--space-xs) var(--space-0) var(--space-md);
    font-style: italic;
}

/* Reset Confirmation */
#reset-app-container {
    margin-top: var(--space-lg);
}

.reset-confirm {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--border-radius-sm, 0.25rem);
    padding: var(--space-lg);
    margin-top: var(--space-sm);
}

.reset-confirm.hidden {
    display: none;
}

.warning-text {
    color: var(--danger);
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--space-lg);
}

/* Content Actions Toolbar - removed since delete all moved to advanced */

/* Dev Mode Version Indicator */
.dev-version {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    font-size: var(--font-size-xs, 0.75rem);
    color: rgba(255, 255, 255, 0.5);
    z-index: var(--z-fade-overlay, 200);
    cursor: pointer;
    transition: color var(--transition);
    display: none;
}

.dev-version.active {
    display: block;
}

.dev-version:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Panel Status Bar (simplified) */
.panel-status-bar {
    padding: var(--space-sm) var(--space-lg);
    background: var(--gray-100, #f5f5f5);
    border-radius: var(--border-radius-md, 0.5rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    flex-shrink: 0;
}

.offline-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--border-radius-full, 50%);
    background: var(--success);
}

.offline .status-dot,
.status-dot.offline {
    background: var(--offline, #f39c12);
}

.version-info {
    color: var(--text-light);
    font-size: var(--font-size-sm, 0.875rem);
}

/* Save & Preview Button States */
.close-settings .btn-text,
.close-settings .btn-saving,
.close-settings .btn-saved {
    transition: opacity 0.15s ease;
}

.close-settings .btn-saving,
.close-settings .btn-saved {
    display: none;
}

.close-settings.saving .btn-text {
    display: none;
}

.close-settings.saving .btn-saving {
    display: inline;
}

.close-settings.saved .btn-text {
    display: none;
}

.close-settings.saved .btn-saving {
    display: none;
}

.close-settings.saved .btn-saved {
    display: inline;
}

.close-settings.saved {
    background: var(--success);
    border-color: var(--success);
}

/* Responsive Design */
@media (max-width: 768px) {
    .settings-panel {
        width: 100%;
    }
    
    .upload-buttons {
        flex-direction: column;
    }
}

/* Loading State */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: var(--font-size-xl);
    z-index: var(--z-toast, 1000);
}

/* Animations */
@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* System Theme Support for Text Slides */
@media (prefers-color-scheme: light) {
    .text-slide:not(.custom-colors), 
    .clock-slide:not(.custom-colors) {
        background: white !important;
        color: black !important;
    }
}

@media (prefers-color-scheme: dark) {
    .text-slide:not(.custom-colors),
    .clock-slide:not(.custom-colors) {
        background: black;
        color: white;
    }

    /* Dark mode for UI panels */
    :root {
        --panel-bg: #1e1e1e;
        --text-primary: #e0e0e0;
        --text-light: #a0a0a0;
        --border: #3a3a3a;
        --gray-50: #2a2a2a;
        --gray-100: #2f2f2f;
        --gray-150: #353535;
        --gray-200: #3a3a3a;
        --gray-300: #4a4a4a;
        --gray-400: #5a5a5a;
        --surface-light: #2a2a2a;
        --surface-lighter: #2f2f2f;
    }

    .settings-panel,
    .import-modal-content,
    .text-creator,
    .scheduling-section,
    .form-control {
        background: var(--panel-bg);
        color: var(--text-primary);
    }

    .text-editor-textarea,
    .text-editor-inline {
        background: var(--panel-bg);
        color: var(--text-primary);
    }

    .content-item {
        background: var(--gray-100);
    }

    .content-item:hover,
    .content-item:focus-within {
        background: var(--gray-200);
    }

    .btn-ghost {
        background: var(--gray-200);
    }

    .btn-secondary {
        background: var(--gray-400);
        color: var(--text-primary);
    }

    .welcome-view {
        color: var(--text-primary);
    }
}

/* ============================================
   ACCESSIBILITY: REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .slide {
        transition: none;
    }
}

/* Help text styling */
.help-text {
    font-size: var(--font-size-sm);
    color: var(--text-light);
    margin: var(--space-xs) var(--space-0) var(--space-md) var(--space-xl);
    font-style: italic;
}

/* Advanced Settings Container */
#advanced-settings section {
    border: 1px solid var(--border);
    border-radius: var(--border-radius-md, 0.5rem);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    background: var(--gray-50, #fafafa);
}

#advanced-settings h3 {
    margin-top: 0;
}

/* Welcome message in panel */
.panel-welcome {
    background: #f0f8ff;
    padding: var(--space-lg);
    border-radius: var(--border-radius-md, 0.5rem);
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
    display: none;
}

.panel-welcome.show {
    display: block;
}

.panel-welcome h3 {
    margin: var(--space-0) var(--space-0) var(--space-sm) var(--space-0);
    color: var(--accent);
}

.panel-welcome p {
    margin: 0;
    color: var(--text-light);
}
/* API Log Panel */
.api-log-panel {
    position: fixed;
    top: 5rem;
    left: 1rem;
    max-width: 600px;
    max-height: 400px;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid var(--terminal-green, #00ff00);
    border-radius: 8px;
    box-shadow: var(--shadow-lg, 0 10px 40px rgba(0, 0, 0, 0.2));
    font-family: "Courier New", monospace;
    font-size: 12px;
    z-index: var(--z-status-bar-above, 16);
    display: flex;
    flex-direction: column;
    transition: max-height var(--transition);
}

.api-log-panel.minimized {
    max-height: 40px;
}

.api-log-header {
    background: #1a1a1a;
    padding: 8px 12px;
    border-bottom: 1px solid #00ff00;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    user-select: none;
}

.api-log-title {
    color: var(--terminal-green, #00ff00);
    font-weight: bold;
    font-size: 13px;
}

.api-log-toggle,
.api-log-clear {
    background: transparent;
    border: 1px solid var(--terminal-green, #00ff00);
    color: var(--terminal-green, #00ff00);
    padding: 2px 8px;
    margin-left: 8px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
    transition: all 0.2s;
}

.api-log-toggle:hover,
.api-log-clear:hover {
    background: #00ff00;
    color: #000;
}

.api-log-content {
    padding: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    color: #fff;
    line-height: 1.4;
}

.api-log-panel.minimized .api-log-content {
    display: none;
}

.api-log-entry {
    margin: 4px 0;
    padding: 4px 8px;
    border-radius: 3px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.api-log-entry.info {
    color: var(--terminal-green, #00ff00);
}

.api-log-entry.success {
    color: var(--terminal-green, #00ff00);
    background: rgba(0, 255, 0, 0.1);
}

.api-log-entry.error {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

.api-log-entry.warning {
    color: #ffaa00;
    background: rgba(255, 170, 0, 0.1);
}

.api-log-entry.viewer {
    border-left: 3px solid #00aaff;
}

.api-log-entry.editor {
    border-left: 3px solid #ff00ff;
}

.api-log-timestamp {
    color: #888;
    font-size: 10px;
    margin-right: 8px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .api-log-panel {
        max-height: 250px;
        bottom: 4rem;
        left: 0.5rem;
        right: 0.5rem;
        font-size: 10px;
    }

    .api-log-title {
        font-size: 11px;
    }
}

/* ============================================
   SLIDE PROGRESS INDICATOR
   ============================================ */

.slide-progress {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    width: 24px;
    height: 24px;
    z-index: var(--z-nav, 10);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.slide-progress.active {
    opacity: 1;
}

.progress-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* Conic gradient creates pie-chart fill effect */
    /* --progress is set by JS (0 to 1) */
    /* Transparent "eats away" at the visible circle as progress advances */
    --progress-angle: calc(var(--progress, 0) * 360deg);
    --circle-color: rgba(255, 255, 255, 0.5);
    background: conic-gradient(
        transparent var(--progress-angle),
        var(--circle-color) var(--progress-angle)
    );
    transition: --progress 0.1s linear;
}

/* Resetting animation - faster transition for the "completion" sweep */
.slide-progress.resetting .progress-circle {
    transition: --progress 0.4s ease-out;
}

/* Override for text/clock slides on light backgrounds */
.slide-progress.on-light-bg .progress-circle {
    --circle-color: rgba(0, 0, 0, 0.35);
}

/* Register --progress as an animatable property for smooth transitions */
@property --progress {
    syntax: "<number>";
    inherits: false;
    initial-value: 0;
}

/* Slide Counter (bottom-right) */
.slide-counter {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: var(--z-nav, 10);
    pointer-events: auto;
    cursor: pointer;
    background: transparent;
    color: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-family: ui-monospace, "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.2s ease;
}

.slide-counter.active {
    opacity: 1;
}

.slide-counter:hover {
    background: rgba(255, 255, 255, 0.1);
}

.slide-counter #slide-current,
.slide-counter #slide-total {
    display: inline-block;
    min-width: 2ch;
    text-align: center;
}

/* ============================================
   HIDDEN UPDATE PANEL (Viewer Mode)
   ============================================ */

.update-panel-toggle {
    position: fixed;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    z-index: var(--z-nav, 10);
    cursor: pointer;
    /* Invisible tap zone */
}

.update-panel {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-md, 0.5rem);
    padding: var(--space-md, 0.75rem);
    z-index: var(--z-nav, 10);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.update-panel.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.update-panel.hidden {
    display: block; /* Override .hidden utility class */
    opacity: 0;
    pointer-events: none;
}

@supports (backdrop-filter: blur(10px)) {
    .update-panel {
        backdrop-filter: blur(10px);
        background: rgba(0, 0, 0, 0.7);
    }
}

.update-panel-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md, 0.75rem);
}

.update-countdown {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs, 0.25rem);
}

.countdown-label {
    font-size: var(--font-size-xs, 0.75rem);
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.countdown-time {
    font-size: var(--font-size-lg, 1.25rem);
    font-weight: var(--font-weight-semibold, 600);
    color: white;
    font-variant-numeric: tabular-nums;
}

.update-panel .btn {
    width: 100%;
}

/* Light mode for update panel */
@media (prefers-color-scheme: light) {
    .update-panel {
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }

    @supports (backdrop-filter: blur(10px)) {
        .update-panel {
            background: rgba(255, 255, 255, 0.8);
        }
    }

    .countdown-label {
        color: rgba(0, 0, 0, 0.6);
    }

    .countdown-time {
        color: var(--text-primary, #333);
    }
}

/* ============================================
   SLIDES GRID MODAL (Hidden Feature)
   ============================================ */

.slides-grid-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal, 200);
    display: flex;
    align-items: center;
    justify-content: center;
}

.slides-grid-modal.hidden {
    display: none;
}

.slides-grid-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
}

.slides-grid-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s ease;
}

.slides-grid-close:hover {
    color: white;
}

.slides-grid-content {
    position: relative;
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
}

.slides-grid-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-lg, 1.5rem);
    padding: var(--space-xl, 2rem);
    align-content: start;
}

.slides-grid-item {
    aspect-ratio: 16 / 9;
    border-radius: var(--border-radius-md, 0.5rem);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: var(--gray-800, #2a2a2a);
    border: 1px solid;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.slides-grid-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.slides-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Text slide thumbnail */
.slides-grid-item.text-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md, 0.75rem);
}

.slides-grid-item.text-thumbnail .thumbnail-text {
    font-size: 0.55rem;
    line-height: 1.4;
    text-align: center;
    overflow: hidden;
    max-height: 100%;
    word-break: break-word;
}

/* Slide number badge */
.slides-grid-item .slide-number {
    position: absolute;
    bottom: 0.25rem;
    right: 0.25rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.65rem;
    padding: 0.15rem 0.35rem;
    border-radius: 0.25rem;
    font-weight: 600;
}

/* Light/dark mode border */
@media (prefers-color-scheme: light) {
    .slides-grid-item {
        border-color: rgba(0, 0, 0, 0.15);
    }
}

@media (prefers-color-scheme: dark) {
    .slides-grid-item {
        border-color: rgba(255, 255, 255, 0.15);
    }
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .slides-grid-body {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: var(--space-md, 1rem);
        padding: var(--space-lg, 1.5rem);
    }
}

/* ============================================
   MANUAL THEME OVERRIDE
   These rules allow users to manually select
   light/dark mode instead of using system preference
   ============================================ */

/* Light theme overrides */
[data-theme="light"] .nav-btn {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .nav-btn:hover {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .nav-btn:active {
    background: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .preview-header {
    background: var(--gray-50, #fafafa);
}

[data-theme="light"] .text-slide-preview-content {
    background: white;
}

[data-theme="light"] .markdown-help a,
[data-theme="light"] .markdown-help a:visited {
    color: var(--accent, #4a90e2);
}

[data-theme="light"] .markdown-help code {
    background: var(--gray-100, #f5f5f5);
}

[data-theme="light"] .content-section-header {
    background: var(--gray-100, #f0f0f0);
}

[data-theme="light"] .text-slide:not(.custom-colors),
[data-theme="light"] .clock-slide:not(.custom-colors) {
    background: white !important;
    color: black !important;
}

[data-theme="light"] .update-panel {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .update-panel .countdown-label,
[data-theme="light"] .update-panel .countdown-time {
    color: var(--gray-700, #333);
}

[data-theme="light"] .slides-grid-item {
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .slide-progress,
[data-theme="light"] .slide-counter {
    color: rgba(0, 0, 0, 0.7);
}

[data-theme="light"] .slide-progress .progress-circle {
    border-color: rgba(0, 0, 0, 0.2);
}

/* Dark theme overrides */
[data-theme="dark"] .nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .nav-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .preview-header {
    background: var(--gray-800, #2d2d2d);
}

[data-theme="dark"] .text-slide-preview-content {
    background: var(--surface, #1a1a1a);
}

[data-theme="dark"] .markdown-help a,
[data-theme="dark"] .markdown-help a:visited {
    color: var(--accent-light, #60a5fa);
}

[data-theme="dark"] .markdown-help code {
    background: var(--gray-800, #2a2a2a);
}

[data-theme="dark"] .content-section-header {
    background: var(--gray-300, #4a4a4a);
}

[data-theme="dark"] .text-slide:not(.custom-colors),
[data-theme="dark"] .clock-slide:not(.custom-colors) {
    background: black;
    color: white;
}

[data-theme="dark"] .update-panel {
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .update-panel .countdown-label,
[data-theme="dark"] .update-panel .countdown-time {
    color: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .slides-grid-item {
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .slide-progress,
[data-theme="dark"] .slide-counter {
    color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .slide-progress .progress-circle {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Editor status bar theme overrides */
@media (prefers-color-scheme: light) {
    .editor-status-bar {
        background: rgba(255, 255, 255, 0.85);
        color: rgba(0, 0, 0, 0.9);
    }
}

[data-theme="light"] .editor-status-bar {
    background: rgba(255, 255, 255, 0.85);
    color: rgba(0, 0, 0, 0.9);
}

[data-theme="dark"] .editor-status-bar {
    background: rgba(0, 0, 0, 0.5);
    color: rgba(255, 255, 255, 0.9);
}

/* Editor modal theme overrides */
@media (prefers-color-scheme: light) {
    .editor-container {
        background: #ffffff;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    }

    .editor-header {
        border-bottom-color: rgba(0, 0, 0, 0.1);
    }

    .editor-header h1 {
        color: var(--text-primary, #1a1a1a);
    }
}

[data-theme="light"] .editor-container {
    background: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .editor-header {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .editor-header h1 {
    color: var(--text-primary, #1a1a1a);
}

[data-theme="dark"] .editor-container {
    background: #1a1a1a;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .editor-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .editor-header h1 {
    color: white;
}

/* Settings modal theme overrides */
@media (prefers-color-scheme: light) {
    .settings-modal-body .settings-group select,
    .settings-modal-body .settings-group input[type="number"] {
        border-color: rgba(0, 0, 0, 0.2);
        background: rgba(0, 0, 0, 0.05);
        color: var(--text-primary, #1a1a1a);
    }

    .settings-modal-body .settings-group select option {
        background: white;
        color: var(--text-primary, #1a1a1a);
    }
}

[data-theme="light"] .settings-modal-body .settings-group select,
[data-theme="light"] .settings-modal-body .settings-group input[type="number"] {
    border-color: rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary, #1a1a1a);
}

[data-theme="light"] .settings-modal-body .settings-group select option {
    background: white;
    color: var(--text-primary, #1a1a1a);
}

[data-theme="dark"] .settings-modal-body .settings-group select,
[data-theme="dark"] .settings-modal-body .settings-group input[type="number"] {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

[data-theme="dark"] .settings-modal-body .settings-group select option {
    background: #2a2a2a;
    color: white;
}
