/* Composants d'interface (terminal, moniteur, etc.) */

/* ========== COMPOSANTS D'INTERFACE ========== */

/* --- CRT Overlay --- */
.crt-overlay {
    position: fixed;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/scanlines.webp');
    opacity: 0.08;
    background-repeat: repeat;
    z-index: 2500;
    pointer-events: none;
}

/* --- Boot Sequence --- */
.boot-sequence {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-terminal);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
}

.boot-content {
    text-align: center;
    width: 90%;
    max-width: min(50rem, 90vw);
    padding: 0 var(--space-md);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.boot-logo {
    max-width: min(17.5rem, 80vw);
    margin-bottom: var(--space-xl);
    filter: drop-shadow(0 0 0.625rem var(--text-primary));
}

.boot-progress {
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-bottom: 3.75rem;
}

.boot-text-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.progress-bar {
    width: 100%;
    max-width: min(25rem, 90vw);
    height: 1.25rem;
    border: var(--border-regular) solid var(--text-primary);
    margin: 0 auto 1rem auto;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--text-primary);
    animation: progress 3s forwards;
}

/* --- Redirect Overlay --- */
.redirect-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-modal);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    animation: fadeIn var(--transition-fast) forwards;
}

.redirect-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.redirect-text {
    color: var(--theme-primary);
    
    text-shadow: var(--glow-primary);
}

.redirect-spinner {
    width: clamp(2rem, 4vw, 3rem);
    height: clamp(2rem, 4vw, 3rem);
    border: var(--border-regular) solid var(--window-border);
    border-top: var(--border-regular) solid var(--theme-primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin-top: var(--space-xs);
}

/* --- Signal Monitor --- */
.player-container {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    /* Removed overflow: auto to allow natural height */
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-color) var(--bg-terminal);
}

/* Add overflow only for desktop */
@media (min-width: 768px) {
    .player-container {
        overflow: auto;
    }
}

.player-container>iframe {
    width: 100%;
    height: 20vh;
    min-height: 230px;
}

/* --- Custom Audio Player --- */
.custom-audio-player {
    width: 100%;
    border-radius: var(--border-radius);
    padding: var(--space-xs);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Player main section with artwork and info */
.player-main {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.player-artwork {
    width: clamp(3.5rem, 10vw, 5rem);
    height: clamp(3.5rem, 10vw, 5rem);
    flex-shrink: 0;
    border: var(--border-thin) solid var(--theme-secondary);
    border-radius: 5px;
    overflow: hidden;
    background: var(--bg-primary);
    position: relative;
}

.player-artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.player-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.track-title {
    font-size: var(--font-size-xsm);
    font-weight: bold;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.artist-name {
    font-size: var(--font-size-sm);
    color: var(--theme-primary);
    text-shadow: var(--glow-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-name {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Progress bar */
.player-progress {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.time-elapsed,
.time-total {
    font-size: var(--font-size-xxs);
    color: var(--text-muted);
    min-width: 2.5rem;
    text-align: center;
}

.player-progress-bar {
    flex: 1;
    height: clamp(0.25rem, 0.5vh, 0.375rem);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.player-progress-fill {
    height: 100%;
    background: var(--theme-tertiary);
    box-shadow: var(--glow-secondary);
    width: 0%;
    /* Smooth linear transition for progress bar updates */
    transition: width 1s linear;
    /* Ensure smooth rendering on all browsers */
    -webkit-transition: width 1s linear;
    -moz-transition: width 1s linear;
    -o-transition: width 1s linear;
    /* Enable hardware acceleration for smoother animation */
    will-change: width;
    transform: translateZ(0);
}

/* Controls */
.player-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: nowrap;
    padding: var(--space-xs) var(--space-xs) var(--space-xl);
    /* Ensure controls take full width */
    width: 100%;
    /* Position relative for absolute positioning of quality selector on mobile */
    position: relative;
}

.play-pause-btn {
    /* Increased size while keeping responsive logic */
    width: clamp(2.5rem, 5vw, 3.2rem);
    height: clamp(2.5rem, 5vw, 3.2rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs);
    min-width: 8%;
    color: var(--theme-secondary);
    /* Prevent text from showing during icon load */
    font-size: 0;
    overflow: hidden;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    /* Allow volume control to grow and push quality selector to the right */
    flex: 1;
    /* Prevent overflow */
    min-width: 0;
}

.mute-btn {
    padding: var(--space-sm);
    font-size: 0;
    overflow: hidden;
}

.mute-btn.muted .volume-icon {
    opacity: 0.5;
}

.volume-slider {
    width: clamp(8rem, 18vw, 6.25rem);
    height: clamp(0.3rem, 0.4vh, 0.3rem);
    background: var(--theme-tertiary);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: clamp(0.75rem, 1.5vw, 1rem);
    height: clamp(0.75rem, 1.5vw, 1rem);
    background: var(--theme-secondary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--glow-secondary);
}

.volume-slider::-moz-range-thumb {
    width: clamp(0.75rem, 1.5vw, 1rem);
    height: clamp(0.75rem, 1.5vw, 1rem);
    background: var(--theme-secondary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--glow-secondary);
    border: none;
}

/* Quality selector - Enhanced version */
/* Quality selector positioned at the right edge */
.quality-selector {
    display: flex;
    gap: 6px;
    align-items: center;
    /* No wrap to keep buttons in line */
    flex-wrap: nowrap;
    /* Prevent shrinking */
    flex-shrink: 0;
    /* Push to the right edge */
    margin-left: auto;
}

.quality-btn {
    padding: 6px 12px;
    font-size: var(--font-size-quality-btn);
    color: var(--theme-secondary);
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid rgba(222, 226, 230, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    letter-spacing: 0.6px;
    font-family: var(--font-mono);
    font-weight: 500;
    user-select: none;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* Subtle gradient overlay on hover */
.quality-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    /* Gradient sweep effect */
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 215, 0, 0.1), 
        transparent
    );
    transition: left 0.5s ease;
}

/* Quality button hover effects only on desktop with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .quality-btn:hover::before {
        left: 100%;
    }

    .quality-btn:hover:not(.active) {
        background: rgba(255, 215, 0, 0.08);
        border-color: var(--theme-primary);
        color: var(--theme-primary);
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.3),
                    inset 0 0 10px rgba(255, 215, 0, 0.05);
        transform: translateY(-1px);
    }
}

.quality-btn.active {
    /* Subtle green border for active state */
    background: transparent;
    color: var(--theme-primary);
    /* Keep same border width as default to prevent size change */
    border: 1.5px solid rgba(116, 255, 149, 0.8);
    /* Subtle green glow effect */
    box-shadow: 0 0 8px rgba(116, 255, 149, 0.3),
                inset 0 0 6px rgba(116, 255, 149, 0.1);
    /* Keep same font-weight to prevent text size change */
    font-weight: 500;
    /* Keep button interactive */
    pointer-events: auto;
    /* Slight animation for the border */
    position: relative;
    overflow: hidden;
    /* Add a very subtle background to make it stand out more */
    background: rgba(116, 255, 149, 0.05);
    /* Slightly brighter text color */
    text-shadow: 0 0 8px rgba(116, 255, 149, 0.6);
}

/* Optional: Add a subtle pulsing effect to the active border */
.quality-btn.active::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    /* Animated border gradient */
    background: linear-gradient(45deg, 
        transparent, 
        rgba(116, 255, 149, 0.4), 
        transparent
    );
    border-radius: 4px;
    opacity: 0;
    animation: active-pulse 2s ease-in-out infinite;
    z-index: -1;
}

/* Pressed state animation */
.quality-btn:active:not(.active) {
    transform: scale(0.98);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Loading state for quality switching */
.quality-btn.switching {
    color: transparent;
    pointer-events: none;
}

.quality-btn.switching::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border: 2px solid var(--theme-secondary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin-centered 0.8s linear infinite; /* Changé de spin à spin-centered */
}

/* Responsive adjustments for quality buttons */
@media (max-width: 768px) {
    .quality-btn {
        padding: 6px 12px;
        letter-spacing: 0.6px;
    }
}

@media (max-width: 480px) {
    .quality-btn {
        padding: 5px 10px;
        letter-spacing: 0.5px;
        border-width: 1px;
    }
    
    .quality-btn.active {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.4),
                    inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
}

/* SSE connection indicator */
.connection-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs);
    font-size: var(--font-size-xxs);
    color: var(--theme-secondary);
}

.connection-indicator.connected {
    color: var(--theme-primary);
}

.connection-indicator.connected::before {
    content: '●';
    color: var(--theme-primary);
    animation: pulse 2s infinite;
}

.connection-indicator.disconnected::before {
    content: '○';
    color: var(--theme-tertiary);
}

/* Media Session integration visual feedback */
.player-container.media-session-active {
    border-color: var(--theme-primary);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

/* Smooth transitions for track changes */
.player-artwork img,
.track-title,
.artist-name,
.album-name {
    transition: opacity 0.3s ease;
}

/* Live DJ stream state */
@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.is-live .player-progress-fill {
    width: 100% !important;
    animation: live-pulse 2s ease-in-out infinite;
}

.is-live .time-elapsed {
    color: var(--theme-primary);
    text-shadow: var(--glow-primary);
    animation: live-pulse 2s ease-in-out infinite;
    min-width: auto;
    margin-right: var(--space-sm);
}

.player-artwork.loading img {
    opacity: 0.5;
}

/* Responsive adjustments for quality selector */
@media (max-width: 768px) {
    .quality-selector {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: var(--space-sm);
    }
    
    .quality-btn {
        flex: 1;
        min-width: 60px;
        max-width: 100px;
    }
}

@media (max-width: 480px) {
    .quality-selector {
        gap: 2px;
    }
    
    .quality-btn {
        padding: 4px 6px;
    }
}

/* Loading state for quality switch */
.quality-btn.loading {
    position: relative;
    color: transparent;
}

 
/* MP3 Quality Dropdown Styles */
.quality-dropdown-container {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}
 
.mp3-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: fit-content;
}
 
.dropdown-arrow {
    font-size: 8px;
    transition: transform 0.3s ease;
    display: inline-block;
    line-height: 1;
}
 
.quality-dropdown-menu.open + .mp3-dropdown-btn .dropdown-arrow,
.mp3-dropdown-btn .dropdown-arrow {
    transform: rotate(0deg);
}
 
.quality-dropdown-container:has(.quality-dropdown-menu.open) .dropdown-arrow {
    transform: rotate(180deg);
}
 
.quality-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    background: rgba(0, 0, 0, 0.95);
    border: 1.5px solid rgba(222, 226, 230, 0.3);
    border-radius: 4px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
 
.quality-dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
 
.quality-dropdown-option {
    padding: 8px 12px;
    color: var(--theme-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: var(--font-size-quality-btn);
    font-family: var(--font-mono);
    letter-spacing: 0.6px;
    white-space: nowrap;
    border-bottom: 1px solid rgba(222, 226, 230, 0.1);
}
 
.quality-dropdown-option:last-child {
    border-bottom: none;
}
 
.quality-dropdown-option:hover {
    background: rgba(255, 215, 0, 0.1);
    color: var(--theme-primary);
}
 
.quality-dropdown-option.active {
    background: rgba(116, 255, 149, 0.1);
    color: var(--theme-primary);
    border-left: 2px solid var(--theme-primary);
}
 
.quality-dropdown-option.active::before {
    content: '● ';
    color: var(--theme-primary);
    margin-right: 4px;
}

.quality-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border: 2px solid var(--theme-secondary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin-centered 0.8s linear infinite; /* Changé de spin à spin-centered */
}

/* Player icon styles */
.player-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Apply theme secondary color #DEE2E6 to play/pause icons */
    filter: invert(93%) sepia(3%) saturate(24%) hue-rotate(196deg) brightness(95%) contrast(94%);
    transition: filter 0.2s ease;
}

.volume-icon {
    display: inline-flex;
    width: clamp(1.2rem, 2vw, 1.5rem);
    height: clamp(1.2rem, 2vw, 1.5rem);
    align-items: center;
    justify-content: center;
}

.volume-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Apply theme tertiary color #6C757D to volume icons */
    filter: invert(48%) sepia(8%) saturate(355%) hue-rotate(174deg) brightness(92%) contrast(86%);
    transition: filter 0.2s ease, opacity 0.2s ease;
}

/* Hover effects with glow matching theme colors (desktop only with precise pointer) */
@media (hover: hover) and (pointer: fine) {
    .play-pause-btn:hover .player-icon {
        filter: invert(93%) sepia(3%) saturate(24%) hue-rotate(196deg) brightness(95%) contrast(94%) drop-shadow(0 0 5px var(--theme-secondary));
    }

    .mute-btn:hover .volume-icon-img {
        filter: invert(48%) sepia(8%) saturate(355%) hue-rotate(174deg) brightness(92%) contrast(86%) drop-shadow(0 0 5px var(--theme-tertiary));
    }
}

/* Muted state styling */
.mute-btn.muted .volume-icon-img {
    opacity: 0.4;
}

/* Active/pressed state */
.play-pause-btn:active .player-icon,
.mute-btn:active .volume-icon-img {
    transform: scale(0.95);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .player-main {
        gap: var(--space-sm);
    }
    
    .player-artwork {
        width: 60px;
        height: 60px;
    }
    
    .track-title {
        font-size: 1rem;
    }
    
    /* Adjust controls layout for tablets */
    .player-controls {
        gap: var(--space-xs);
        padding: var(--space-xs) var(--space-xs) var(--space-lg);
    }
    
    /* Volume control adjustments */
    .volume-control {
        /* Don't take all space on tablets */
        flex: 0 1 auto;
    }
    
    .volume-slider {
        /* Fixed width on tablets */
        width: 100px;
    }
    
    /* Quality selector stays on the right */
    .quality-selector {
        gap: 4px;
    }
    
    .quality-btn {
        padding: 5px 10px;
        letter-spacing: 0.5px;
    }
}

/* Animation for reconnecting */
@keyframes pulse-border {
    0%, 100% {
        border-color: var(--theme-primary);
    }
    50% {
        border-color: var(--alert-color);
    }
}

.custom-audio-player.reconnecting {
    animation: pulse-border 1s infinite;
}

/* Player artwork clickable */
.player-artwork {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Player artwork hover only on desktop with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .player-artwork:hover {
        transform: scale(1.05);
        box-shadow: 0 0 10px rgba(39, 245, 223, 0.5);
    }
}
 
/* Touch feedback for mobile */
.player-artwork:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Artwork modal - enhanced version with proper centering and fullscreen support */
.artwork-modal {
    /* Modal inherits all styles from .visual-modal */
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important; /* Center the modal perfectly */
    width: 80vw !important; /* Take 80% of viewport width */
    height: 80vh !important; /* Take 80% of viewport height */
    max-width: 1200px; /* Maximum width for large screens */
    max-height: 900px; /* Maximum height for large screens */
    background: rgba(0, 13, 26, 0.98);
    z-index: 2000;
    display: none;
    box-shadow: 0 0 40px rgba(39, 245, 223, 0.3), /* Enhanced glow effect */
                0 0 80px rgba(39, 245, 223, 0.1);
    pointer-events: none;
}

.artwork-modal.active {
    display: block;
}

/* Analysis window takes full height */
.artwork-modal .analysis-window {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-terminal);
    border: var(--border-thin) solid var(--window-border);
    pointer-events: all;
    position: relative;
}

/* Image container fills the available space */
.artwork-modal .modal-image-container {
    flex: 1; /* Take remaining space after header */
    height: auto; /* Let flexbox handle height */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0; /* Remove padding for full window coverage */
    background: var(--bg-terminal);
    overflow: hidden;
    position: relative;
}

/* Modal image fills the container while maintaining aspect ratio */
.artwork-modal .modal-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain; /* Maintain aspect ratio */
    opacity: 1;
    transform-origin: center center;
    will-change: transform, filter;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000;
    -webkit-perspective: 1000;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Artwork modal utilise exactement le même bouton fullscreen que les archives */
.artwork-modal .fullscreen-button {
    /* Hérite tous les styles du .fullscreen-button existant */
    /* Pas besoin de redéfinir, le bouton utilisera automatiquement les styles déjà définis */
}

/* Si vous voulez vous assurer que l'icône s'affiche bien */
.artwork-modal .fullscreen-icon {
    width: 1.5rem;
    height: 1.5rem;
    background-image: url('../assets/images/icons/fullscreen.png'); /* Utilise la même image */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Station Title */
.station-title {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    margin-bottom: 0;
    border-bottom: var(--border-thin) solid var(--text-muted);
    width: 100%;
    min-height: var(--header-height);
    position: relative;
}

.station-title-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    max-width: 100%;
}

.station-id {
    color: var(--theme-primary);
    letter-spacing: clamp(0.0625rem, 0.1vw, 0.1875rem);
    text-shadow: var(--glow-primary);
    font-weight: bold;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    text-align: center;
}

.station-marker {
    color: var(--text-primary);
    opacity: 0.8;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

/* --- Station Controls --- */
.station-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md) 0;
}

/* --- Status Indicators --- */
.status-indicators {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    width: 100%;
}

.signal-indicator,
.listeners-indicator {
    display: flex;
    align-items: center;
    padding: var(--space-xs);
    justify-content: center;
}

.signal-indicator {
    gap: var(--space-sm);
}

.listeners-indicator {
    gap: var(--space-sm);
    color: var(--theme-primary);
    text-shadow: var(--glow-primary);
}

.signal-text,
.listener-label {
    white-space: nowrap;
}

.listener-icon {
    color: var(--theme-primary);
    animation: pulse 2s infinite;
}

/* --- Signal strength indicator --- */
.signal-strength {
    display: flex;
    gap: 0.1875rem;
    height: 1.25rem;
    align-items: flex-end;
    opacity: 0.8;
    transition: opacity var(--transition-normal);
}

.bar {
    width: 0.25rem;
    height: 0.3125rem;
    background: var(--text-primary);
    transform-origin: bottom;
    animation: signalPulse 1.5s infinite alternate;
}

.bar:nth-child(2) {
    animation-delay: 0.2s;
}

.bar:nth-child(3) {
    animation-delay: 0.4s;
}

.bar:nth-child(4) {
    animation-delay: 0.6s;
}

.signal-status.adjusting .signal-strength .bar {
    animation: signalAdjust 0.5s ease-in-out infinite !important;
}

/* --- Frequency Control --- */
.frequency-control {
    display: flex;
    justify-content: center;
    width: 100%;
    position: relative;
}

.frequency-button {
    background: var(--button-bg);
    border: var(--border-thin) solid var(--button-border);
    color: var(--text-primary);
    padding: var(--space-xmd) var(--space-lg);
    cursor: pointer;
    
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: all var(--transition-normal);
    width: 100%;
    justify-content: center;
    position: relative;
    z-index: 101; /* Ensure button stays above menu */
}

/* Frequency button hover only on desktop with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .frequency-button:hover {
        background: var(--button-hover-bg);
        border-color: var(--theme-primary);
        color: var(--theme-primary);
    }
}
 
/* Touch feedback for mobile */
.frequency-button:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

.frequency-button.active {
    background: var(--button-hover-bg);
    border-color: var(--theme-primary);
    color: var(--theme-primary);
}

.chevron-icon {
    color: var(--theme-primary);
    margin-left: var(--space-sm);
    transition: transform var(--transition-normal), color var(--transition-normal);
}

.frequency-button.active .chevron-icon {
    transform: rotate(180deg);
}

.frequency-icon {
    color: var(--theme-primary);
    animation: pulse 2s infinite;
}

.frequency-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-blur);
    backdrop-filter: blur(var(--glass-blur));
    border: var(--border-thin) solid var(--window-border);
    display: block;
    z-index: 100;
    width: fit-content;
    max-height: 70vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity var(--transition-normal), 
                visibility var(--transition-normal), 
                transform var(--transition-normal);
}

.frequency-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.freq-option {
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    border-bottom: var(--border-thin) solid rgba(222, 226, 230, 0.1);
}

.freq-option:last-child {
    border-bottom: none;
}

/* Frequency option hover only on desktop with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .freq-option:hover {
        background: var(--button-hover-bg);
        color: var(--theme-primary);
    }
}
 
/* Touch feedback for mobile */
.freq-option:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

.freq-option.active {
    background: var(--button-hover-bg);
    color: var(--theme-primary);
}

.freq-option.active::before {
    content: '▶';
    margin-right: var(--space-xs);
    animation: pulse 2s infinite;
}

.freq-details {
    display: block;
    color: var(--text-muted);
    margin-top: var(--space-xs);
    padding-left: var(--space-md);
}

/* --- History content --- */
.history-content {
    padding: var(--space-md);
    height: auto;
    display: flex;
    flex-direction: column;
}

.history-frame {
    width: 100%;
    min-height: 21vh;
    height: auto;
    display: flex;
    border: 0;
    overflow: hidden;
}

.history-status {
    color: var(--theme-error);
}

/* --- Playlist content --- */
.playlist-content {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.current-playlist,
.next-playlist {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.playlist-label {
    opacity: 0.8;
}

.playlist-name {
    color: var(--text-primary);
    text-shadow: var(--glow-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.next-playlist {
    margin-top: var(--space-sm);
    padding-top: var(--space-lg);
    border-top: var(--border-thin) solid var(--text-muted);
}

.next-playlist .playlist-info {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
}

.playlist-time {
    color: var(--theme-warning);
    opacity: 0.8;
}

.time-arrow {
    margin-right: var(--space-xs);
    opacity: 0.6;
  }

/* --- Schedule Button --- */
.schedule-button {
    background: var(--button-bg);
    border: var(--border-thin) solid var(--button-border);
    color: var(--text-primary);
    padding: var(--space-xmd) var(--space-lg);
    cursor: pointer;
    
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    gap: var(--space-sm);
    transition: all var(--transition-normal);
    text-shadow: var(--glow-primary);
    box-shadow: var(--glow-secondary);
}

/* Schedule button hover only on desktop with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .schedule-button:hover {
        background: var(--button-hover-bg);
        border-color: var(--theme-primary);
        color: var(--theme-primary);
        box-shadow: var(--glow-primary);
    }
}
 
/* Touch feedback for mobile */
.schedule-button:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

.schedule-button .icon {
    display: flex;
    align-items: center;
    animation: pulse 2s infinite;
}

/* --- Terminal --- */
.terminal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.terminal-output {
    flex: 1;
    padding: var(--space-md);
    padding-right: 1.4375rem; /* Pour la scrollbar */
    overflow-y: auto;
    font-family: 'VT323', monospace;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-color) var(--bg-terminal);
    margin-bottom: var(--border-thin);
}

.terminal-input {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-terminal);
    border-top: var(--border-thin) solid var(--window-border);
    margin-top: auto;
    flex-shrink: 0;
}

.terminal-input .prompt {
    color: var(--theme-primary);
    font-weight: bold;
    animation: pulse 2s infinite;
}

.terminal-input input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'VT323', monospace;
    width: 100%;
    outline: none;
    padding: var(--space-xs) 0;
}

/* UNIX classes for terminal */
.terminal-line .user-text {
    color: var(--terminal-user);
}

.terminal-line .path-text {
    color: var(--terminal-path);
}

.terminal-line .directory-text {
    color: var(--terminal-directory);
}

/* --- Chat Content --- */
/* Height and overflow now handled by css/chat.css */

.refresh-chat {
    background: none;
    border: none;
    color: var(--window-header-text);
    cursor: pointer;
    padding: 0 var(--space-sm);
    transition: color var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    
}

/* Refresh chat hover only on desktop with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .refresh-chat:hover {
        color: var(--theme-warning);
    }
}
 
/* Touch feedback for mobile */
.refresh-chat:active {
    opacity: 0.7;
    transition: opacity 0.1s ease;
}

/* --- Archives components --- */
.archives-content {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
}

.archives-content.initialized {
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.archive-counter {
    color: var(--theme-warning);
    animation: blink 1.5s infinite;
}

.archives-item {
    position: relative;
    border: var(--border-thin) solid var(--window-border);
    background: var(--bg-main);
    cursor: pointer;
    overflow: hidden;
    opacity: 0;
    transform: translateY(1.25rem);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

/* Archives item hover only on desktop with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .archives-item:hover {
        border-color: var(--theme-primary);
        transform: translateY(-0.3125rem);
        box-shadow: var(--glow-primary);
    }
}
 
/* Touch feedback for mobile */
.archives-item:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

.archives-item img {
    width: 100%;
    height: clamp(11rem, 30vw, 15rem); /* au lieu de 180px fixe */
    object-fit: cover;
    transition: all var(--transition-normal);
    display: block;
}

.archives-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom,
            transparent 0%,
            var(--bg-terminal) 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

/* Archives item hover pseudo-element only on desktop */
@media (hover: hover) and (pointer: fine) {
    .archives-item:hover::before {
        opacity: 0.6;
    }
}

.archives-item::after {
    content: '▲ ' attr(data-planet-name) ' ▲';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-sm);
    background: var(--bg-modal);
    color: var(--theme-primary);
    text-align: center;
    transform: translateY(100%);
    transition: transform var(--transition-normal);
    text-shadow: var(--glow-primary);
    text-transform: uppercase;
}

/* Archives item hover after pseudo-element only on desktop */
@media (hover: hover) and (pointer: fine) {
    .archives-item:hover::after {
        transform: translateY(0);
    }
}

/* --- Visual Analysis Content --- */
.modal-image-container {
    position: relative;
    flex: 1;
    padding: clamp(0.5rem, 2vw, 2rem);
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-terminal);
    overflow: hidden;
    border-bottom: var(--border-thin) solid var(--window-border);
    touch-action: pan-y pinch-zoom;
    -webkit-overflow-scrolling: touch;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 1;
    transform-origin: center center;
    will-change: transform, filter;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000;
    -webkit-perspective: 1000;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Fix for image office_2.png */
.modal-image[src*="office_2.png"] {
    max-width: 768px;
    max-height: 512px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.modal-image.loading {
    position: relative;
}

.modal-image.loading::after {
    content: "LOADING SCAN DATA...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--theme-primary);
    
    text-shadow: var(--glow-primary);
    animation: blink 1s infinite;
}

.modal-image-container.transitioning::after {
    content: "PROCESSING SCAN DATA...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--theme-primary);
    
    text-shadow: var(--glow-primary);
    animation: blink 1s infinite;
    z-index: 2;
}

.modal-image-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0;
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: 2;
}

.modal-image-container.transitioning::after {
    animation: signalNoise 1.5s ease-in-out forwards;
}

.modal-image.transitioning {
    animation: signalDistortion 1.5s ease-in-out forwards;
}

/* ===== PROCESSING SIGNATURE ===== */
.processing-signature {
    position: relative;
    flex-shrink: 0;
    width: 100%;
    padding: 6px var(--space-sm);
    border-top: 1px solid var(--window-border);
    background: var(--bg-terminal);
    z-index: 10;
}

.signature-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    font-size: var(--font-size-xxs);
    color: var(--text-secondary);
    opacity: 0.8;
}

.signature-icon {
    color: var(--theme-primary);
    animation: pulse 2s infinite;
    flex-shrink: 0;
    font-size: var(--font-size-sm);
}

.signature-text {
    flex: 1;
    text-align: center;
    
    letter-spacing: 0.3px;
    font-size: var(--font-size-xxs); 
}

.signature-text .highlight {
    color: var(--theme-secondary);
    font-weight: 500;
    text-shadow: 0 0 5px rgba(39, 245, 223, 0.5);
}

.signature-status {
    padding: 1px 6px;
    border: 1px solid var(--window-border);
    border-radius: 2px;
    font-size: calc(var(--font-size-xxs) * 0.9); 
    
    flex-shrink: 0;
    transition: all var(--transition-normal);
}

/* État "checking" - seule la couleur change */
.signature-status[data-status="checking"] {
    color: var(--theme-warning);
    border-color: var(--theme-warning);
    opacity: 0.7;
    animation: checkingPulse 1s infinite;
}

/* État "verified" - seule la couleur change */
.signature-status[data-status="verified"] {
    color: var(--theme-success);
    border-color: var(--theme-success);
    opacity: 0.9;
    animation: none;
    text-shadow: 0 0 3px rgba(122, 255, 206, 0.4);
}



/* ===== VISUAL ANALYSIS ZOOM ENHANCEMENT ===== */

/* Zoom indicator for both modal and fullscreen */
.zoom-indicator {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    background: rgba(0, 13, 26, 0.9);
    border: var(--border-thin) solid var(--button-border);
    padding: var(--space-sm) var(--space-md);
    
    font-size: 0.75rem;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    pointer-events: none;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Fullscreen-specific zoom indicator */
.fullscreen-zoom-indicator {
    z-index: 3002; /* Above fullscreen content */
}

.zoom-indicator.active {
    opacity: 1;
    transform: translateY(0);
}

.zoom-level {
    color: var(--theme-primary);
    text-shadow: var(--glow-primary);
    font-weight: 600;
}

.zoom-value {
    color: var(--theme-warning);
}

.zoom-hint {
    font-size: 0.65rem;
    opacity: 0.7;
    color: var(--text-secondary);
}

/* Enhanced modal image container for zoom */
.modal-image-container,
.fullscreen-content {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Smooth zoom transitions */
.modal-image,
.fullscreen-image {
    transition: transform 0.2s ease-out;
    cursor: inherit;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* Cursor states */
.modal-image-container[data-zoom="active"],
.fullscreen-content[data-zoom="active"] {
    cursor: grab;
}

.modal-image-container[data-zoom="panning"],
.fullscreen-content[data-zoom="panning"] {
    cursor: grabbing;
}

/* Visual feedback when max zoom reached */
@keyframes zoomPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(39, 245, 223, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(39, 245, 223, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(39, 245, 223, 0);
    }
}

.modal-image-container.max-zoom-reached,
.fullscreen-content.max-zoom-reached {
    animation: zoomPulse 0.5s ease-out;
}

/* Adjust fullscreen button opacity when zoomed */
.modal-image-container[data-zoom-level="zoomed"] .fullscreen-button {
    opacity: 0.3;
}

/* Fullscreen button hover when zoomed only on desktop */
@media (hover: hover) and (pointer: fine) {
    .modal-image-container[data-zoom-level="zoomed"] .fullscreen-button:hover {
        opacity: 1;
    }
}

/* Ensure fullscreen content allows overflow for panning */
.fullscreen-content {
    overflow: hidden;
    position: relative;
}

/* Mobile adjustments */
@media (max-width: 767px) {
    .zoom-indicator {
        font-size: 0.65rem;
        padding: 0.375rem 0.5rem;
    }
    
    .zoom-hint {
        display: none;
    }
    
    .modal-image-container,
    .fullscreen-content {
        touch-action: none;
    }
}

/* High DPI display optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .modal-image,
    .fullscreen-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* --- Contacts components --- */
.contact-content {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    opacity: 0;
    visibility: hidden;
}

.contact-content.initialized {
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.relay-status {
    color: var(--theme-warning);
    opacity: 0;
    transform: translateY(1.25rem);
}

.relay-status.active {
    opacity: 1;
    transform: translateY(0);
    animation: statusBlink 1.5s infinite;
}

.social-card {
    background: transparent;
    border: var(--border-thin) solid var(--window-border);
    display: flex;
    flex-direction: column;
    min-height: 11.25rem;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    opacity: 0;
    transform: translateY(1.25rem);
}

/* Social card hover only on desktop with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .social-card:hover {
        border-color: var(--theme-primary);
        transform: translateY(-0.3125rem);
        box-shadow: var(--glow-primary);
    }
}
 
/* Touch feedback for mobile */
.social-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

.card-header {
    background: rgba(0, 13, 26, 0.8);
    display: flex;
    align-items: center;
    padding: var(--space-md);
    border-bottom: var(--border-thin) solid var(--window-border);
    min-height: 4rem;
    flex-wrap: nowrap;
}

.social-icon {
    width: var(--icon-size-lg);
    height: var(--icon-size-lg);
    object-fit: contain;
    flex-shrink: 0;
}

.platform-name {
    color: var(--theme-primary);
    text-shadow: var(--glow-primary);
    margin: 0 var(--space-md);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
}

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    background: var(--theme-primary);
    border-radius: 50%;
    box-shadow: 0 0 0.625rem var(--theme-primary);
}

.card-content {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    flex: 1;
}

.content-wrapper {
    flex: 1;
}

.content-title {
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.platform-desc {
    color: var(--text-muted);
    line-height: var(--line-height-normal);
    margin-bottom: var(--space-md);
    font-family: 'Share Tech Mono', monospace;
}

.action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: rgba(116, 255, 149, 0.1);
    border: var(--border-thin) solid var(--window-border);
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-normal);
    min-height: 2.75rem; /* Pour accessibilité tactile */
}

/* Action button hover only on desktop with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .action-button:hover {
        background: rgba(116, 255, 149, 0.2);
        border-color: var(--theme-primary);
        color: var(--theme-primary);
        transform: translateY(-0.125rem);
    }
}
 
/* Touch feedback for mobile */
.action-button:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

.button-icon {
    color: var(--theme-primary);
    animation: pulse 2s infinite;
}

/* --- About components --- */
.about-content {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    opacity: 0;
    animation: fadeIn var(--transition-normal) ease forwards;
}

.about-content.initialized {
    opacity: 1;
    visibility: visible;
}

.section-logo {
    display: block;
    float: right;
    width: 13vw;
    height: auto;
    margin: -0.625rem 0 var(--space-md) var(--space-md);
    filter: drop-shadow(0 0 0.625rem var(--text-primary));
    transition: all var(--transition-normal);
}

.section-title {
    color: var(--theme-primary);
    margin-bottom: var(--space-md);
    text-shadow: var(--glow-primary);
}

.section-content {
    color: var(--text-primary);
    line-height: var(--line-height-normal);
}

.section-content h3 {
    color: var(--message-info);
    margin: var(--space-md) 0 var(--space-sm);
    text-shadow: 0 0 0.3125rem var(--message-info);
}

.section-content p {
    margin-bottom: var(--space-md);
}

.section-content ul {
    list-style-type: none;
    padding-left: var(--space-md);
    margin-bottom: var(--space-md);
}

.section-content li {
    margin-bottom: var(--space-sm);
    position: relative;
}

.section-content li::before {
    content: "◈";
    color: var(--theme-primary);
    position: absolute;
    left: -1.25rem;
    opacity: 0.8;
}

/* --- Links in About section --- */
.section-content a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px dotted rgba(91, 192, 117, 0.4); /* Soulignement discret en pointillés verts */
    transition: all var(--transition-normal);
    padding-bottom: 1px; /* Petit espace pour éviter que le texte touche la bordure */
    font-family: 'Share Tech Mono', monospace;
}

b,
strong {
  font-family: 'Share Tech Mono', monospace;
}

/* Section content link hover only on desktop with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .section-content a:hover {
        color: var(--theme-primary);
        border-bottom-color: var(--theme-primary);
        border-bottom-style: solid;
        text-shadow: var(--glow-primary);
    }
}
 
/* Touch feedback for mobile */
.section-content a:active {
    opacity: 0.8;
    transition: opacity 0.1s ease;
}

/* --- Modal Styles (Schedule, Request) --- */
.schedule-modal,
.request-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-modal);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    display: flex;
    justify-content: center;
    align-items: center;
}

.schedule-modal.active,
.request-modal.active {
    opacity: 1;
    pointer-events: all;
}

.schedule-content,
.request-content {
    background: var(--bg-terminal);
    border: var(--border-thin) solid var(--window-border);
    height: 95vh;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    transform: translateY(1.25rem);
    transition: transform var(--transition-normal);
    box-shadow: var(--glow-secondary);
}

.schedule-content {
    width: 95vw;
}

.request-content {
    width: 50vw;
}

.schedule-modal.active .schedule-content,
.request-modal.active .request-content {
    transform: translateY(0);
}

.schedule-header,
.request-header {
    background: var(--window-header-bg);
    color: var(--window-header-text);
    padding: var(--space-xs) var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: var(--border-thin) solid var(--window-border);
    min-height: 1.9375rem;
}

.schedule-frame,
.request-frame {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: none;
    background: var(--bg-terminal);
}

.request-frame {
    padding: var(--space-xs);
}

/* --- Loading Screen --- */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-modal);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2400;
    
    color: var(--theme-primary);
}

.loading-screen.active {
    display: flex;
    animation: fadeIn var(--transition-normal) ease forwards;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.loading-text {
    color: var(--theme-primary);
    text-shadow: var(--glow-primary);
    margin-bottom: var(--space-xs);
}

.loading-spinner {
    width: clamp(2rem, 4vw, 3rem);
    height: clamp(2rem, 4vw, 3rem);
    border: var(--border-regular) solid var(--window-border);
    border-top: var(--border-regular) solid var(--theme-primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin-top: var(--space-xs);
}

/* --- Modal Scroll Prevention --- */
/* Prevent background scroll when any modal is active */
body.modal-open,
body.menu-open,
body.chat-open,
body:has(.visual-modal.active),
body:has(.data-modal.active),
body:has(.schedule-modal.active),
body:has(.request-modal.active),
body:has(.mobile-nav.active) {
    /* Lock the body scroll */
    overflow: hidden;
}

/* Overlay for visual and data modals */
body:has(.visual-modal.active)::before,
body:has(.data-modal.active)::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-modal);
    z-index: 1500;
    opacity: 1;
    pointer-events: all;
}

/* --- Archives Modals --- */
.visual-modal,
.data-modal {
    position: fixed;
    top: 2%;
    left: 2%;
    background: rgba(0, 13, 26, 0.98);
    z-index: 2000;
    display: none;
    width: 96%;
    box-shadow: var(--glow-secondary);
    height: 48%;
    pointer-events: none;
}

.visual-modal.active,
.data-modal.active {
    display: block;
}

.data-modal {
    top: 52%;
    /* Position below visual modal with a gap */
}

.analysis-window {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-terminal);
    border: var(--border-thin) solid var(--window-border);
    pointer-events: all;
    position: relative;
    /* Allow scroll in modal content */
    overflow: hidden;
}

/* Enable scroll for modal content areas */
.modal-image-container,
.terminal-style-content {
    /* Allow vertical scroll in content */
    overflow-y: auto;
    overflow-x: hidden;
    /* Smooth scrolling */
    -webkit-overflow-scrolling: touch;
}

/* Schedule and Request modals content scroll */
.schedule-frame,
.request-frame {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: none;
    background: var(--bg-terminal);
    /* Allow scroll in iframe content */
    overflow: auto;
}

/* --- Navigation Buttons --- */
.modal-navigation {
    padding: var(--space-xmd);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-xs);
    background: var(--bg-terminal);
}

.nav-button {
    background: var(--button-bg);
    border: var(--border-thin) solid var(--button-border);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    gap: var(--space-sm);
    transition: all var(--transition-normal);
    text-shadow: var(--glow-primary);
    box-shadow: var(--glow-secondary);
    min-width: 2.75rem; /* accessibilité tactile */
    min-height: 2.75rem; /* accessibilité tactile */
}

/* Navigation button hover only on desktop with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .nav-button:hover {
        background: var(--button-hover-bg);
        border-color: var(--theme-primary);
        color: var(--theme-primary);
        box-shadow: var(--glow-primary);
    }
}
 
/* Touch feedback for mobile */
.nav-button:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

.nav-counter {
    color: var(--theme-primary);
    text-shadow: var(--glow-primary);
    
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
  }

.nav-counter::before,
.nav-counter::after {
    content: '◈';
    color: var(--text-primary);
    opacity: 0.8;
    animation: pulse 2s infinite;
}

/* Style for active navigation links */
.nav-link.active {
    color: var(--theme-primary);
    text-shadow: var(--glow-primary);
}

/* --- Fullscreen button --- */
.fullscreen-button {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: var(--button-bg);
    border: var(--border-thin) solid var(--button-border);
    width: 2.5rem;
    height: 2.5rem;
    padding: var(--space-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all var(--transition-normal);
}

/* Fullscreen button hover only on desktop with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .fullscreen-button:hover {
        background: var(--button-hover-bg);
        border-color: var(--theme-primary);
        box-shadow: var(--glow-primary);
    }
}
 
/* Touch feedback for mobile */
.fullscreen-button:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.fullscreen-icon {
    width: 1.5rem;
    height: 1.5rem;
    background-image: url('../assets/images/icons/fullscreen.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* --- Fullscreen modal --- */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 13, 26, 0.98);
    z-index: 3000;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.fullscreen-modal.active {
    display: flex;
    opacity: 1;
    pointer-events: all;
}

.fullscreen-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.fullscreen-image {
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0;
    padding: 0;
    display: block;
    user-select: none;
    -webkit-user-select: none;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.close-fullscreen {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    background: var(--button-bg);
    border: var(--border-thin) solid var(--button-border);
    width: 2.5rem;
    height: 2.5rem;
    padding: var(--space-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3001;
    transition: all var(--transition-normal);
}

/* Close fullscreen hover only on desktop with precise pointer */
@media (hover: hover) and (pointer: fine) {
    .close-fullscreen:hover {
        background: var(--button-hover-bg);
        border-color: var(--theme-primary);
    }
}
 
/* Touch feedback for mobile */
.close-fullscreen:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.close-fullscreen::before {
    content: '';
    width: 1.5rem;
    height: 1.5rem;
    background-image: url('../assets/images/icons/exit-fullscreen.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* --- Planetary Data Content --- */
.terminal-style-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-md);
    
    color: var(--text-primary);
    background: var(--bg-terminal);
    -webkit-overflow-scrolling: touch;
}

.planetary-data-line {
    padding: 0.125rem 0;
    font-size: var(--font-size-terminal);
    font-family: 'VT323', monospace;
    line-height: 1.3;
}

.planetary-data-line.header {
    color: var(--theme-warning);
    text-shadow: 0 0 0.3125rem var(--theme-warning);
    margin-bottom: var(--space-md);
}

.planetary-data-line.subheader {
    color: var(--message-info);
    text-shadow: 0 0 0.3125rem var(--message-info);
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
}