/* Clean TV Mode Layout - Debug Colors */

/* TV Mode Overlay - Full Screen */
#tvModeOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: #000000;
    display: none;
    overflow: hidden;
}

/* Exit Button - Top Right */
.tv-exit-button {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10000;
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tv-exit-button:focus {
    outline: 2px solid #FE5000;
    outline-offset: 2px;
}

.tv-exit-button:hover {
    color: #FE5000;
    transform: scale(1.2);
}

/* Main Layout Container */
.tv-layout-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 12px;
    margin: 0;
    gap: 12px;
    box-sizing: border-box;
}

/* Header Section - 12% of available space */
.tv-header-section {
    height: calc(12vh - 7.2px);
    background: #000000;
    border: 2px solid #FE5000;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(254, 80, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 30px;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    position: relative;
}

/* Texture overlay for header */
.tv-header-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/static/assets/tv-header-texture.png');
    background-size: 200px 200px;
    background-repeat: repeat;
    opacity: 0.3;
    border-radius: 6px;
    pointer-events: none;
    z-index: 1;
}

/* Ensure content stays above texture */
.tv-header-section > * {
    position: relative;
    z-index: 2;
}

/* TV Logo styling */
.tv-logo {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    height: 50px;
    width: auto;
    max-width: 400px;
    object-fit: contain;
}

/* TV Logo Text fallback */
.tv-logo-text {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Bebas Neue', 'Arial Black', sans-serif;
    font-size: 2.5rem;
    font-weight: 400;
    letter-spacing: 2px;
    color: white;
    display: block;
    z-index: 2;
}

/* TV Mode Title styling */
.tv-mode-title {
    font-family: 'Bebas Neue', 'Arial Black', sans-serif;
    font-size: 3rem;
    font-weight: 400;
    letter-spacing: 2px;
    color: #FE5000;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.tv-mode-title:hover {
    color: #FF8A50;
    transform: scale(1.05);
}

/* Gauges Section - 23% of available space */
.tv-gauges-section {
    height: calc(23vh - 14.4px);
    background: #0a0a0a;
    border: 2px solid #FE5000;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(254, 80, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    padding: 12px;
    gap: 12px;
    box-sizing: border-box;
}

/* TV Slider bars - 3 equally spaced sliders */
.tv-slider-container {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8px;
    box-sizing: border-box;
    position: relative;
}

/* Slider label */
.tv-slider-label {
    color: #FE5000;
    font-size: clamp(0.8rem, 2vw, 1.3rem);
    font-family: 'Bebas Neue', 'Arial Black', sans-serif;
    font-weight: 400;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 20;
    position: relative;
    line-height: 1;
}

/* Slider value display */
.tv-slider-value {
    color: white;
    font-size: max(1.2rem, min(2rem, 3vw));
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
    line-height: 1;
}

/* Slider track container */
.tv-slider-track {
    width: 100%;
    height: clamp(40px, 6vh, 60px);
    background: #222;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    border: 2px solid #666;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.7);
}

/* Slider fill bar */
.tv-slider-fill {
    height: 100%;
    background: #FE5000;
    border-radius: 2px;
    transition: none;
    position: relative;
    overflow: visible;
    box-shadow: 0 0 10px rgba(254, 80, 0, 0.4);
}

/* Remove glow animation for 1980s control panel look */

/* Slider detail text */
.tv-slider-detail {
    color: #999;
    font-size: clamp(0.5rem, 1.2vw, 0.7rem);
    font-family: 'Bebas Neue', 'Arial Black', sans-serif;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-align: center;
    margin-top: 4px;
    line-height: 1.2;
}

/* Percentage text centered in slider track - white Bebas */
.tv-slider-percentage {
    color: white;
    font-size: clamp(0.8rem, 2.5vw, 1.4rem);
    font-family: 'Bebas Neue', 'Arial Black', sans-serif;
    font-weight: 400;
    letter-spacing: 1px;
    z-index: 15;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    min-width: 0;
    line-height: 1;
    white-space: nowrap;
}

/* Red pulsing animation for 0% and low values (below 15%) */
.tv-slider-fill.zero-value,
.tv-slider-fill.low-value {
    background: #ff0000 !important;
    animation: redPulseFill 1s ease-in-out infinite alternate;
}

.tv-slider-percentage.zero-value,
.tv-slider-percentage.low-value {
    color: #ff0000 !important;
    animation: redPulseText 1s ease-in-out infinite alternate;
}

.tv-slider-track.zero-value,
.tv-slider-track.low-value {
    border-color: #ff0000 !important;
    animation: redPulseTrack 1s ease-in-out infinite alternate;
}

.tv-slider-label.zero-value,
.tv-slider-label.low-value {
    color: #ff0000 !important;
    animation: redPulseText 1s ease-in-out infinite alternate;
}

/* Animation for fill and track with glow */
@keyframes redPulseFill {
    0% { 
        opacity: 0.6;
        box-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
    }
    100% { 
        opacity: 1;
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
    }
}

@keyframes redPulseTrack {
    0% { 
        opacity: 0.6;
        box-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
    }
    100% { 
        opacity: 1;
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
    }
}

/* Animation for text without glow to prevent glitchy outline */
@keyframes redPulseText {
    0% { 
        opacity: 0.7;
    }
    100% { 
        opacity: 1;
    }
}

/* Responsive adjustments for different screen sizes */
@media screen and (max-width: 1200px) {
    .tv-slider-label {
        font-size: clamp(0.7rem, 1.8vw, 1.1rem);
        margin-bottom: 3px;
    }
    
    .tv-slider-track {
        height: clamp(35px, 5vh, 50px);
    }
    
    .tv-slider-percentage {
        font-size: clamp(0.7rem, 2vw, 1.1rem);
    }
    
    .tv-slider-detail {
        font-size: clamp(0.4rem, 1vw, 0.6rem);
        font-family: 'Bebas Neue', 'Arial Black', sans-serif;
        letter-spacing: 0.5px;
    }
}

@media screen and (max-width: 768px) {
    .tv-gauges-section {
        height: calc(20vh - 10px);
        padding: 8px;
        gap: 8px;
    }
    
    .tv-slider-label {
        font-size: clamp(0.6rem, 1.5vw, 0.9rem);
        margin-bottom: 2px;
    }
    
    .tv-slider-track {
        height: clamp(30px, 4vh, 40px);
    }
    
    .tv-slider-percentage {
        font-size: clamp(0.6rem, 1.8vw, 1rem);
    }
    
    .tv-slider-detail {
        font-size: clamp(0.3rem, 0.8vw, 0.5rem);
        font-family: 'Bebas Neue', 'Arial Black', sans-serif;
        letter-spacing: 0.5px;
    }
}

/* Map Section - 65% of available space */
.tv-map-section {
    height: calc(65vh - 42px);
    display: flex;
    gap: 12px;
}

/* Map Display Area - 85% of map width */
.tv-map-display {
    flex: 1;
    background: #0a0a0a;
    border: 2px solid #FE5000;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(254, 80, 0, 0.15);
    position: relative;
    min-width: 0;
    overflow: hidden;
}

/* TV Map Container */
.tv-map-container {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
}

/* TV Site Summary Container - Compact TV-Optimized Sizing */
.tv-site-summary-container {
    position: absolute;
    top: clamp(15px, 2vh, 30px);
    left: clamp(15px, 2vw, 40px);
    bottom: clamp(20px, 3vh, 50px);
    background: rgba(0, 0, 0, 0.95) !important;
    border: clamp(2px, 0.2vw, 3px) solid #FE5000 !important;
    border-radius: clamp(6px, 0.8vw, 12px);
    padding: clamp(15px, 1.8vw, 30px);
    color: white;
    min-width: clamp(200px, 15vw, 280px);
    max-width: clamp(250px, 18vw, 320px);
    max-height: calc(100vh - clamp(70px, 8vh, 120px));
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.tv-site-summary-container.visible {
    opacity: 1;
    visibility: visible;
}

.tv-site-summary-title {
    font-size: clamp(1.4rem, 2.8vw, 2.2rem) !important;
    margin-bottom: clamp(8px, 1.2vh, 15px) !important;
    color: #FE5000 !important;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: clamp(0.8px, 0.15vw, 1.5px);
    text-transform: uppercase;
    line-height: 1.1;
}

.tv-site-summary-stat {
    margin-bottom: clamp(6px, 1vh, 12px) !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Weather Section Styles */
.tv-weather-section {
    margin-top: clamp(10px, 1.5vh, 20px);
}

.tv-weather-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #FE5000, transparent);
    margin: clamp(8px, 1.2vh, 15px) 0;
}

.tv-weather-title {
    font-size: clamp(1.1rem, 2.2vw, 1.6rem) !important;
    margin-bottom: clamp(6px, 1vh, 10px) !important;
    color: #FE5000 !important;
    font-weight: bold;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: clamp(0.5px, 0.1vw, 1px);
    text-transform: uppercase;
}

.tv-weather-current {
    margin-bottom: clamp(8px, 1.2vh, 15px);
}

.tv-weather-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(4px, 0.8vh, 8px);
}

.tv-weather-temp {
    font-size: clamp(1.2rem, 2.4vw, 1.8rem) !important;
    color: #FE5000 !important;
    font-weight: bold;
    font-family: 'Bebas Neue', sans-serif;
}

.tv-weather-desc {
    font-size: clamp(0.8rem, 1.6vw, 1.1rem) !important;
    color: #ccc;
    text-transform: capitalize;
}

.tv-weather-details {
    display: flex;
    justify-content: space-between;
    gap: clamp(8px, 1.2vw, 15px);
}

.tv-weather-detail {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.tv-weather-detail-label {
    font-size: clamp(0.7rem, 1.4vw, 0.9rem) !important;
    color: #999;
    text-transform: uppercase;
    font-weight: 500;
}

.tv-weather-detail-value {
    font-size: clamp(0.8rem, 1.6vw, 1rem) !important;
    color: white;
    font-weight: bold;
}

.tv-forecast-title {
    font-size: clamp(1rem, 2vw, 1.4rem) !important;
    margin-bottom: clamp(6px, 1vh, 10px) !important;
    color: #FE5000 !important;
    font-weight: bold;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: clamp(0.5px, 0.1vw, 1px);
    text-transform: uppercase;
}

.tv-forecast-items {
    display: flex;
    flex-direction: column;
    gap: clamp(3px, 0.6vh, 6px);
    max-height: clamp(80px, 12vh, 120px);
    overflow-y: auto;
}

.tv-forecast-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(2px, 0.4vh, 4px) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tv-forecast-item:last-child {
    border-bottom: none;
}

.tv-forecast-time {
    font-size: clamp(0.7rem, 1.4vw, 0.9rem) !important;
    color: #999;
    font-weight: 500;
    min-width: clamp(40px, 6vw, 50px);
}

.tv-forecast-temp {
    font-size: clamp(0.8rem, 1.6vw, 1rem) !important;
    color: #FE5000 !important;
    font-weight: bold;
    min-width: clamp(35px, 5vw, 45px);
    text-align: center;
}

.tv-forecast-desc {
    font-size: clamp(0.7rem, 1.4vw, 0.9rem) !important;
    color: #ccc;
    flex: 1;
    text-align: right;
    text-transform: capitalize;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tv-site-summary-label {
    font-size: clamp(1rem, 1.8vw, 1.6rem) !important;
    color: #ddd;
    font-weight: 500;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: clamp(0.3px, 0.08vw, 0.8px);
}

.tv-site-summary-value {
    color: #FE5000 !important;
    font-size: clamp(1.2rem, 2.2vw, 1.8rem) !important;
    font-weight: bold;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: clamp(0.3px, 0.08vw, 0.8px);
}

/* Console Logs Subsection - Narrower for more map space */
.tv-console-logs {
    width: 220px;
    background: #0a0a0a;
    border: 2px solid #FE5000;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(254, 80, 0, 0.15);
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow: hidden;
    flex-shrink: 0;
}

.tv-console-title {
    font-family: 'Bebas Neue', 'Arial Black', sans-serif;
    color: #FE5000;
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 1px solid #FE5000;
    padding-bottom: 8px;
}

.tv-console-content {
    color: #00ff00;
    font-size: 0.75rem;
    font-family: 'Courier New', 'Consolas', monospace;
    flex: 1;
    overflow: hidden;
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #333;
}

.console-log-entry {
    margin-bottom: 2px;
    opacity: 0.9;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    transition: opacity 0.3s ease;
}

.console-log-entry.new {
    color: #FE5000;
    text-shadow: 0 0 3px #FE5000;
    animation: consoleGlow 0.5s ease-out;
}

.console-log-entry.old {
    color: #666;
    opacity: 0.6;
}

.console-log-entry.fading {
    opacity: 0;
    transition: opacity 1s ease-out;
}

@keyframes consoleGlow {
    0% { text-shadow: 0 0 10px #FE5000, 0 0 20px #FE5000; }
    100% { text-shadow: 0 0 3px #FE5000; }
}

/* Responsive adjustments */
@media screen and (max-height: 600px) {
    .tv-header-section {
        font-size: 1.5rem;
    }
    
    .tv-gauges-section,
    .tv-map-section {
        font-size: 1.4rem;
    }
}

@media screen and (min-height: 1080px) {
    .tv-header-section {
        font-size: 2.5rem;
    }
    
    .tv-gauges-section,
    .tv-map-section {
        font-size: 2.2rem;
    }
}