/* Demo Viewer Styles */

/* Body - Full viewport, no scrollbars */
.demo-viewer-body {
    background: #E5E5E5;
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

:root {
    --cta-slide-gradient: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    --cta-slide-title-color: #1f2937;
    --cta-slide-subtitle-color: #6b7280;
}

.hidden {
    display: none !important;
}

/* Demo Viewer Container - Full screen */
.demo-viewer-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Demo Viewing Area - Top-aligned layout, fills iframe height */
.demo-viewing-area {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #E5E5E5;
    overflow: hidden;
    padding: 0;
}

/* Demo Screenshot Container */
.demo-screenshot-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 1190px;
    width: 100%;
    max-height: 100%;
    align-items: flex-start;
}

/* Step Number Display - Hidden for clean iframe embedding */
.demo-step-number-display {
    display: none;
}

/* MacOS Toolbar - Reuse shared component styles */
.demo-macos-toolbar {
    background: #F5F5F5;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    width: 100%;
    box-sizing: border-box;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.demo-macos-dots {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
}

.demo-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.demo-dot.demo-red { background: #FF5F57; }
.demo-dot.demo-yellow { background: #FFBD2E; }
.demo-dot.demo-green { background: #28C840; }

.demo-macos-title {
    font-size: 13px;
    font-weight: 500;
    color: #6F7285;
    text-align: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

/* Screenshot Wrapper - Relative positioning for hotspot and tooltip */
.demo-screenshot-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Screenshot Image - Responsive with constraints, fills iframe */
/* IMPORTANT: Fills entire iframe height accounting for MacOS toolbar */
.demo-screenshot-image {
    width: auto;
    max-width: 100%;
    max-height: calc(100vh - 40px); /* Full height minus MacOS toolbar (40px) */
    height: auto;
    display: block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    object-fit: contain;
    flex-shrink: 1;
}

/* Chapter slide styles moved to /src/css/components/chapter-cta.css (shared with edit mode) */

/* CTA Slide Layout - Match screenshot sizing in view mode */
.demo-screenshot-wrapper .cta-slide-layout {
    width: 1190px;
    max-width: 100vw;
    max-height: calc(100vh - 40px); /* Full height minus MacOS toolbar (40px) */
    aspect-ratio: 16 / 9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    flex-shrink: 1;
    padding: 48px 32px; /* Restore padding for proper text spacing */
}

/* Instruction Box (Tooltip) - Positioned via JavaScript */
.demo-instruction-box {
    position: absolute;
    background: var(--color-primary, #6C63FF);
    color: var(--color-white, #FFFFFF);
    padding: 20px 24px;
    border-radius: var(--radius-lg, 8px);
    font-size: var(--font-size-heading, 16px);
    line-height: 1.5;
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.25);
    z-index: 20;
    min-width: 280px;
    max-width: 400px;
    word-wrap: break-word;
}

.demo-instruction-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.demo-instruction-text {
    margin: 0;
    font-weight: var(--font-weight-medium, 500);
}

/* Navigation Controls - Inside tooltip (same as editor) */
.demo-navigation-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md, 12px);
    margin-top: var(--spacing-sm, 8px);
}

/* Step Counter (replaces Edit link in editor) */
.demo-step-counter {
    color: var(--color-white, #FFFFFF);
    font-size: var(--font-size-body, 14px);
    font-weight: var(--font-weight-medium, 500);
    white-space: nowrap;
}

/* Navigation Arrows Container */
.demo-nav-arrows {
    display: flex;
    gap: var(--spacing-sm, 8px);
    align-items: center;
}

/* Navigation Buttons (circular like editor) */
.demo-nav-button {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-navigation, 0.25s);
    flex-shrink: 0;
    color: var(--color-white, #FFFFFF);
    font-size: 16px;
    font-weight: bold;
}

.demo-nav-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.demo-nav-button:active:not(:disabled) {
    transform: scale(0.95);
}

.demo-nav-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.demo-nav-button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Responsive Design */

/* Tablet (768-1024px) */
@media (max-width: 1024px) {
    .demo-viewing-area {
        padding: 0;
    }

    .demo-screenshot-image {
        max-width: 100vw;
        max-height: calc(100vh - 36px); /* Full height minus toolbar */
    }

    .demo-screenshot-wrapper .cta-slide-layout {
        max-height: calc(100vh - 36px); /* Match screenshot height */
    }

    .demo-macos-toolbar {
        height: 36px;
        min-height: 36px;
        max-height: 36px;
    }
}

/* Mobile (<768px) */
@media (max-width: 768px) {
    .demo-viewing-area {
        padding: 0;
    }

    .demo-screenshot-image {
        max-width: 100vw;
        max-height: calc(100vh - 32px); /* Full height minus toolbar */
    }

    .demo-screenshot-wrapper .cta-slide-layout {
        max-height: calc(100vh - 32px); /* Match screenshot height */
    }

    .demo-macos-toolbar {
        height: 32px;
        min-height: 32px;
        max-height: 32px;
        padding: 0 12px;
    }

    .demo-macos-title {
        font-size: 12px;
    }

    .demo-step-number-display {
        font-size: 13px;
    }

    .demo-instruction-box {
        min-width: 240px;
        max-width: 320px;
        padding: 16px 20px;
        font-size: 14px;
    }

    .demo-nav-button {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .demo-step-counter {
        font-size: 13px;
    }
}

@media (max-width: 600px) {
    .demo-instruction-box {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        max-width: none;
        min-width: 0;
        border-radius: 0;
        padding: 8px 16px;
        box-sizing: border-box;
        display: grid !important;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 12px;
    }

    .demo-instruction-content {
        display: contents !important;
    }

    .demo-navigation-controls {
        display: contents !important;
    }

    .demo-instruction-text {
        text-align: center;
        font-size: 14px;
        line-height: 1.2;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
        grid-column: 2;
        grid-row: 1;
    }

    .demo-step-counter {
        justify-self: start;
        font-size: 12px;
        white-space: nowrap;
        grid-column: 1;
        grid-row: 1;
    }

    .demo-nav-arrows {
        justify-self: end;
        gap: 6px;
        grid-column: 3;
        grid-row: 1;
    }

    .demo-nav-button {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* Minimum Size Constraints */
.demo-screenshot-image {
    min-width: 200px;
    min-height: 200px;
}
