/* ═══════════════════════════════════════════════════════════════════
   CONCEPT VISUALIZER - CSS
   Fogsight-style cinematic animations for concept learning
   ═══════════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────────────
   1. TOGGLE SWITCH (Visualizer Mode Activation)
   ─────────────────────────────────────────────────────────────────── */

.visualizer-toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.visualizer-toggle-container:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 30px;
    margin: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 30px;
    opacity: 0.3;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    opacity: 1;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.toggle-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    user-select: none;
}

.visualizer-toggle-container:has(input:checked) .toggle-label {
    color: #fff;
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.toggle-label i {
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.visualizer-toggle-container:has(input:checked) .toggle-label i {
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.2); filter: brightness(1.5); }
}

/* ───────────────────────────────────────────────────────────────────
   2. LOADING OVERLAY (Cinematic Director)
   ─────────────────────────────────────────────────────────────────── */

.visualizer-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 20, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.visualizer-loading:not(.hidden) {
    opacity: 1;
}

.visualizer-loading.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    max-width: 500px;
    padding: 40px;
    animation: fadeInUp 0.6s ease-out;
}

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

/* Clapperboard Animation */
.clapperboard-animation {
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
    position: relative;
}

.clapperboard-animation::before {
    content: "🎬";
    font-size: 120px;
    display: block;
    animation: clap 2s ease-in-out infinite;
    filter: drop-shadow(0 10px 30px rgba(102, 126, 234, 0.5));
}

@keyframes clap {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(-15deg); }
    20% { transform: rotate(0deg); }
    30% { transform: rotate(-15deg); }
    40%, 100% { transform: rotate(0deg); }
}

#loading-message {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 30px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s ease-in-out infinite;
}

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

/* Loading Bar */
.loading-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.loading-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    animation: loadingSlide 1.5s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.8);
}

@keyframes loadingSlide {
    0% { left: -40%; }
    100% { left: 100%; }
}

/* ───────────────────────────────────────────────────────────────────
   3. VIEWER MODAL (Full-Screen Animation Display)
   ─────────────────────────────────────────────────────────────────── */

.visualizer-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    background: #000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.visualizer-viewer:not(.hidden) {
    opacity: 1;
}

.visualizer-viewer.hidden {
    display: none;
}

.viewer-header {
    background: rgba(0, 0, 0, 0.9);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.viewer-title {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.viewer-title i {
    color: #667eea;
}

.viewer-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.control-btn.muted i {
    color: #ff5252;
}

.close-viewer-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.close-viewer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.viewer-iframe-container {
    flex: 1;
    position: relative;
    background: #000;
}

#visualizer-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ───────────────────────────────────────────────────────────────────
   YOUTUBE-STYLE VIDEO CONTROLS
   ─────────────────────────────────────────────────────────────────── */

.video-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ctrl-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.ctrl-btn:hover {
    background: rgba(88, 196, 221, 0.3);
    transform: scale(1.05);
}

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

.ctrl-btn.playing i {
    color: #58C4DD;
}

.timeline-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
}

.timeline-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    outline: none;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #58C4DD;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(88, 196, 221, 0.5);
    transition: transform 0.2s ease;
}

.timeline-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.timeline-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #58C4DD;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.time-display {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    font-family: monospace;
    text-align: center;
}

.speed-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}

.speed-select:hover {
    background: rgba(255, 255, 255, 0.15);
}

.speed-select option {
    background: #1e1e1e;
    color: #fff;
}

/* Mobile responsive controls */
@media (max-width: 768px) {
    .video-controls {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 15px;
    }
    
    .ctrl-btn {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
    
    .timeline-wrapper {
        order: 10;
        width: 100%;
        min-width: unset;
    }
    
    .speed-select {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
}

/* ───────────────────────────────────────────────────────────────────
   4. RESPONSIVE DESIGN (Mobile Optimization)
   ─────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .visualizer-toggle-container {
        padding: 10px 15px;
        margin-bottom: 10px;
    }

    .toggle-label {
        font-size: 0.85rem;
    }

    .toggle-switch {
        width: 48px;
        height: 26px;
    }

    .toggle-slider:before {
        height: 18px;
        width: 18px;
    }

    .toggle-switch input:checked + .toggle-slider:before {
        transform: translateX(22px);
    }

    .loading-content {
        padding: 20px;
    }

    .clapperboard-animation {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
    }

    .clapperboard-animation::before {
        font-size: 80px;
    }

    #loading-message {
        font-size: 1.2rem;
        min-height: 50px;
    }

    .viewer-header {
        padding: 12px 15px;
    }

    .viewer-title {
        font-size: 0.95rem;
    }

    .close-viewer-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* ───────────────────────────────────────────────────────────────────
   5. ADDITIONAL UTILITIES
   ─────────────────────────────────────────────────────────────────── */

.visualizer-hint {
    display: none;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.2);
    border-left: 3px solid #667eea;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    animation: slideDown 0.3s ease-out;
}

.visualizer-hint.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 100px;
        padding-top: 8px;
        padding-bottom: 8px;
    }
}

.visualizer-hint i {
    margin-right: 6px;
    color: #667eea;
}

/* ───────────────────────────────────────────────────────────────────
   6. ANIMATION CARD (Chat History Display)
   ─────────────────────────────────────────────────────────────────── */

.animation-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.animation-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.animation-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.animation-card:hover::before {
    left: 100%;
}

.animation-card .icon {
    font-size: 3rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 50%;
    flex-shrink: 0;
}

.animation-card .info {
    flex: 1;
}

.animation-card .info h3 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.animation-card .info p {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.animation-card button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.animation-card button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

@media (max-width: 768px) {
    .animation-card {
        flex-direction: column;
        text-align: center;
    }
    
    .animation-card button {
        width: 100%;
        justify-content: center;
    }
}

/* ───────────────────────────────────────────────────────────────────
   7. ANIMATION REOPEN CARD (Persistence)
   ─────────────────────────────────────────────────────────────────── */

.animation-reopen-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(88, 196, 221, 0.15) 0%, rgba(88, 196, 221, 0.05) 100%);
    border: 2px solid rgba(88, 196, 221, 0.4);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.animation-reopen-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(88, 196, 221, 0.2), transparent);
    transition: left 0.6s ease;
}

.animation-reopen-card:hover {
    border-color: #58C4DD;
    background: linear-gradient(135deg, rgba(88, 196, 221, 0.25) 0%, rgba(88, 196, 221, 0.1) 100%);
    box-shadow: 0 8px 24px rgba(88, 196, 221, 0.3);
    transform: translateY(-2px);
}

.animation-reopen-card:hover::before {
    left: 100%;
}

.reopen-icon {
    font-size: 2.5rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(88, 196, 221, 0.2);
    border-radius: 50%;
    flex-shrink: 0;
}

.reopen-content {
    flex: 1;
}

.reopen-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.reopen-meta {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.reopen-action {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #58C4DD;
    border-radius: 50%;
    color: #000;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.animation-reopen-card:hover .reopen-action {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(88, 196, 221, 0.5);
}

@media (max-width: 768px) {
    .animation-reopen-card {
        flex-wrap: wrap;
    }
    
    .reopen-content {
        flex: 1 1 60%;
    }
}
