/**
 * ZMDM Self-Running Demo Styles
 * Cinematic presentation overlay for automated product demos
 */

/* ============================================
   BASE OVERLAY
   ============================================ */

.demo-runner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100000;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.demo-runner-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   BACKDROP WITH GRADIENT
   ============================================ */

.demo-runner-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ============================================
   INTRO SCREEN
   ============================================ */

.demo-runner-intro {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    z-index: 10;
}

.demo-runner-intro.active {
    opacity: 1;
    visibility: visible;
}

.demo-intro-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 30px;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.4); }
    50% { box-shadow: 0 0 40px rgba(102, 126, 234, 0.7); }
}

.demo-intro-badge i {
    font-size: 18px;
}

.demo-intro-title {
    font-size: 56px;
    font-weight: 300;
    margin: 0 0 16px 0;
    letter-spacing: -1px;
    animation: slide-up 0.8s ease-out;
}

.demo-intro-title span {
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.demo-intro-subtitle {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 50px 0;
    max-width: 600px;
    line-height: 1.6;
    animation: slide-up 0.8s ease-out 0.2s both;
}

.demo-intro-meta {
    display: flex;
    gap: 40px;
    margin-bottom: 50px;
    animation: slide-up 0.8s ease-out 0.4s both;
}

.demo-meta-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.demo-meta-item i {
    font-size: 28px;
    color: #667eea;
}

.demo-meta-value {
    font-size: 24px;
    font-weight: 600;
}

.demo-meta-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.demo-start-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: slide-up 0.8s ease-out 0.6s both;
}

.demo-start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.5);
}

.demo-start-btn i {
    font-size: 24px;
}

.demo-skip-intro {
    position: absolute;
    bottom: 40px;
    right: 40px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.6);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.demo-skip-intro:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

/* ============================================
   MAIN PLAYER
   ============================================ */

.demo-runner-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.demo-runner-player.active {
    opacity: 1;
    visibility: visible;
}

/* Scene Indicator (Top) */
.demo-scene-indicator {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.8);
    padding: 12px 24px;
    border-radius: 30px;
    color: white;
    font-size: 14px;
    z-index: 20;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.demo-scene-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.demo-scene-title {
    font-weight: 500;
}

/* Exit Button */
.demo-exit-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 20;
}

.demo-exit-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
}

.demo-exit-btn i {
    font-size: 22px;
}

/* ============================================
   SPOTLIGHT
   ============================================ */

.demo-runner-spotlight {
    position: fixed;
    pointer-events: none;
    z-index: 99999;
    border-radius: 8px;
    box-shadow:
        0 0 0 4px rgba(102, 126, 234, 0.8),
        0 0 0 9999px rgba(0, 0, 0, 0.75);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.demo-runner-spotlight.active {
    opacity: 1;
}

.demo-runner-spotlight::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 12px;
    border: 2px solid rgba(102, 126, 234, 0.5);
    animation: spotlight-pulse 2s infinite;
}

@keyframes spotlight-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.02);
    }
}

/* ============================================
   NARRATION PANEL
   ============================================ */

.demo-narration-panel {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 700px;
    background: rgba(15, 15, 20, 0.95);
    border-radius: 16px;
    padding: 24px 30px;
    color: white;
    z-index: 20;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    transition: all 0.4s ease;
}

.demo-narration-panel.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.demo-narration-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.demo-narrator-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.demo-narrator-avatar i {
    font-size: 24px;
    color: white;
}

.demo-narrator-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.demo-narrator-info {
    flex: 1;
}

.demo-narrator-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

.demo-narrator-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.demo-narration-text {
    font-size: 17px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
}

.demo-narration-text .highlight {
    color: #667eea;
    font-weight: 600;
}

/* Step indicator dots in narration */
.demo-step-dots {
    display: flex;
    gap: 6px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.demo-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.demo-step-dot.active {
    background: #667eea;
    width: 24px;
    border-radius: 4px;
}

.demo-step-dot.completed {
    background: rgba(102, 126, 234, 0.5);
}

/* ============================================
   CONTROL BAR (Bottom)
   ============================================ */

.demo-control-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.8) 70%, transparent 100%);
    padding: 30px 40px 30px;
    z-index: 20;
}

/* Timeline */
.demo-timeline {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.demo-time-current,
.demo-time-total {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'SF Mono', 'Monaco', monospace;
    min-width: 45px;
}

.demo-time-total {
    text-align: right;
}

.demo-progress-container {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.demo-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

.demo-progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.demo-progress-container:hover .demo-progress-bar::after {
    opacity: 1;
}

/* Scene markers on timeline */
.demo-scene-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
}

.demo-scene-marker {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 10px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 1px;
}

/* Controls Row */
.demo-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.demo-controls-left,
.demo-controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.demo-controls-center {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Control Buttons */
.demo-ctrl-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.demo-ctrl-btn i {
    font-size: 24px;
}

.demo-ctrl-btn.small i {
    font-size: 20px;
}

/* Play/Pause Button (larger) */
.demo-play-pause-btn {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.demo-play-pause-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.demo-play-pause-btn i {
    font-size: 28px;
}

/* Scene Dots Navigation */
.demo-scene-dots {
    display: flex;
    align-items: center;
    gap: 8px;
}

.demo-scene-dot-btn {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.demo-scene-dot-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.2);
}

.demo-scene-dot-btn.active {
    background: #667eea;
    width: 24px;
    border-radius: 5px;
}

.demo-scene-dot-btn.completed {
    background: rgba(102, 126, 234, 0.6);
}

/* Speed Control */
.demo-speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
}

.demo-speed-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.demo-speed-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

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

.demo-speed-btn.active {
    color: white;
    background: #667eea;
}

/* ============================================
   END SCREEN
   ============================================ */

.demo-runner-end {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    z-index: 10;
}

.demo-runner-end.active {
    opacity: 1;
    visibility: visible;
}

.demo-end-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    animation: success-pop 0.6s ease;
}

@keyframes success-pop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.demo-end-icon i {
    font-size: 50px;
    color: white;
}

.demo-end-title {
    font-size: 42px;
    font-weight: 300;
    margin: 0 0 12px 0;
}

.demo-end-subtitle {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 40px 0;
}

.demo-end-actions {
    display: flex;
    gap: 16px;
}

.demo-end-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.demo-end-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.demo-end-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.demo-end-btn.secondary {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.demo-end-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.demo-end-btn i {
    font-size: 20px;
}

/* ============================================
   ACTION INDICATORS
   ============================================ */

.demo-action-indicator {
    position: fixed;
    pointer-events: none;
    z-index: 100001;
}

/* Click animation */
.demo-click-indicator {
    width: 40px;
    height: 40px;
    border: 3px solid #667eea;
    border-radius: 50%;
    animation: click-ripple 0.6s ease-out forwards;
}

@keyframes click-ripple {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Cursor animation */
.demo-cursor {
    position: fixed;
    width: 24px;
    height: 24px;
    pointer-events: none;
    z-index: 100002;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.demo-cursor svg {
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .demo-intro-title {
        font-size: 36px;
    }

    .demo-intro-subtitle {
        font-size: 16px;
        padding: 0 20px;
    }

    .demo-intro-meta {
        gap: 24px;
    }

    .demo-meta-value {
        font-size: 20px;
    }

    .demo-start-btn {
        padding: 14px 30px;
        font-size: 16px;
    }

    .demo-narration-panel {
        width: 95%;
        padding: 20px;
        bottom: 100px;
    }

    .demo-narration-text {
        font-size: 15px;
    }

    .demo-control-bar {
        padding: 20px 20px 25px;
    }

    .demo-play-pause-btn {
        width: 48px;
        height: 48px;
    }

    .demo-play-pause-btn i {
        font-size: 24px;
    }

    .demo-speed-control {
        display: none;
    }

    .demo-end-title {
        font-size: 32px;
    }

    .demo-end-actions {
        flex-direction: column;
    }
}

/* ============================================
   KEYBOARD HINTS
   ============================================ */

.demo-keyboard-hints {
    position: absolute;
    bottom: 100px;
    left: 40px;
    display: flex;
    gap: 16px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.demo-control-bar:hover .demo-keyboard-hints {
    opacity: 0.8;
}

.demo-key-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.demo-key {
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', monospace;
    font-size: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ============================================
   LOADING STATE
   ============================================ */

.demo-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    color: white;
}

.demo-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.demo-loading-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

/* ============================================
   TRANSITIONS FOR PAGE NAVIGATION
   ============================================ */

.demo-page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 100003;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.demo-page-transition.active {
    opacity: 1;
    visibility: visible;
}

.demo-page-transition-content {
    text-align: center;
    color: white;
}

.demo-page-transition-text {
    font-size: 18px;
    font-weight: 500;
    animation: fade-pulse 1s infinite;
}

@keyframes fade-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
