/* ============================================
   BeamNG Dashboard - Digital Cluster Design (Corvette Style)
   ============================================ */

:root {
    --primary: #ffcc00;
    /* Corvette Yellow/Orange */
    --secondary: #ffffff;
    --danger: #ff0000;
    --bg-dark: #000000;
    --text-primary: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Orbitron', 'Roboto', sans-serif;
    background: #000;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Dashboard Container with Honeycomb Grid */
.dashboard {
    width: 100%;
    height: 100%;
    /* Honeycomb / Grid Pattern Background */
    background:
        radial-gradient(circle at center, rgba(20, 20, 30, 0.8) 0%, #000 90%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 40px),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 40px);
    display: flex;
    position: relative;
    overflow: hidden;
}

/* Connection Status */
.connection-status {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.5;
    z-index: 100;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #555;
}

.connection-status.connected .status-dot {
    background: #0f0;
    box-shadow: 0 0 5px #0f0;
}

/* Digital Cluster Container */
.digital-cluster {
    position: relative;
    width: 100%;
    height: 100%;
}

/* RPM Section (SVG Layer) */
.rpm-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.rpm-svg {
    width: 100%;
    height: 100%;
}

/* The Track Line */
.rpm-track {
    fill: none;
    stroke: #222;
    /* Dark Gray track */
    stroke-width: 16;
    stroke-linecap: butt;
    stroke-dasharray: 6 3;
    /* Matches reference tighter segments */
}

/* The Visual Bar */
.rpm-fill {
    fill: none;
    stroke: url(#rpmDigitalGradient);
    stroke-width: 16;
    stroke-linecap: butt;
    transition: stroke-dashoffset 0.05s linear;
    filter: drop-shadow(0 0 8px rgba(255, 160, 0, 0.5));
}

/* Ticks Text inside SVG */
.rpm-step {
    fill: #aaa;
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: bold;
    text-anchor: middle;
}

.rpm-step.red {
    fill: #aa0000;
}

/* Darker red for inactive/tick */


/* Small digital RPM box (top right) - Styled to match "Image 2" */
.rpm-data {
    position: absolute;
    top: 15vh;
    left: 0;
    /* Pushed fully to edge/overflow slightly if needed */
    width: 110px;
    height: 70px;
    text-align: right;
    border: 2px solid #ff0000;
    /* Bright Red Border */
    /* Thicker right border accent */
    border-top: 2px solid #ff0000;
    padding: 2px 8px;
    background: #000;
    /* Opaque Black Background */
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 50;
    /* Ensure it covers anything behind it */
}

.rpm-data::before {
    /* Optional decorative clearer */
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    border-top: 2px solid #ff0000;
    border-right: 2px solid #ff0000;
}

.digital-rpm-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 36px;
    color: #fff;
    font-weight: 600;
    display: block;
    line-height: 1;
    margin-bottom: 2px;
}


.digital-rpm-label {
    font-size: 14px;
    color: #aaa;
    letter-spacing: 1px;
    display: block;
    text-align: right;
    font-weight: bold;
}

/* Clock Display */
.clock-display {
    position: absolute;
    top: calc(15vh + 75px);
    /* Positioned below .rpm-data (top: 15vh, height: 70px + border/padding) */
    left: 0;
    width: 110px;
    text-align: right;
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    color: #fff;
    font-weight: bold;
    letter-spacing: 2px;
    z-index: 50;
    padding-right: 8px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}


/* Center Cluster (Left Signal - Gear - Right Signal) */
.center-cluster {
    position: absolute;
    top: 60%;
    left: 45%;
    /* Slightly left to balance Speed on right */
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 30px;
    z-index: 20;
}

/* Gear Section (Reset absolute positioning for flex context) */
.gear-section {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    text-align: center;
}

.digital-gear-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 25vh;
    /* Large Central Gear */
    font-weight: 700;
    color: #ffcc00;
    text-shadow: 0 0 30px rgba(255, 204, 0, 0.4);
    line-height: 1;
    margin-bottom: -1vh;
}

.digital-gear-label {
    font-size: 2vh;
    color: #666;
    letter-spacing: 5px;
    display: block;
}


/* Speed Indicator (Side) */
.speed-section {
    position: absolute;
    top: 60%;
    right: 15vw;
    transform: translateY(-50%);
    text-align: right;
    z-index: 20;
}

.digital-speed-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 20vh;
    /* Smaller than Gear now, but still prominent */
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    line-height: 1;
}

.digital-speed-unit {
    font-size: 3vh;
    color: #888;
    letter-spacing: 2px;
    display: block;
    margin-top: 0;
}


/* Turn Signals (Chevrons) */
.turn-signal {
    width: 8vh;
    height: 8vh;
    opacity: 0.05;
    /* Barely visible when inactive to avoid 'hazard' look */
    color: #0f0;
    transition: opacity 0.1s;
}

.turn-signal.active {
    opacity: 1;
    filter: drop-shadow(0 0 15px #0f0);
}

.turn-signal svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}


/* Warning Lights */
.warning-lights {
    position: fixed;
    right: 2vw;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1vh;
    padding: 1vh;
    z-index: 50;
}

.warning-light {
    width: 7vh;
    height: 7vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #333;
    border-radius: 1vh;
    opacity: 0.3;
}

.warning-light.active {
    opacity: 1;
    border-color: currentColor;
    box-shadow: 0 0 10px currentColor;
}

.warning-light svg {
    width: 50%;
    height: 50%;
    fill: #888;
}

.warning-light span {
    font-size: 1.8vh;
    color: #888;
    font-weight: bold;
}

/* Colors */
#lightHandbrake.active {
    color: #f00;
}

#lightHandbrake.active svg,
#lightHandbrake.active span {
    fill: #f00;
    color: #f00;
}

#lightOil.active {
    color: #f00;
}

#lightOil.active svg {
    fill: #f00;
}

#lightBattery.active {
    color: #f00;
}

#lightBattery.active svg {
    fill: #f00;
}

#lightTemp.active {
    color: #f00;
}

#lightTemp.active svg {
    fill: #f00;
}

#lightABS.active {
    color: #fa0;
}

#lightABS.active span {
    color: #fa0;
}

#lightTC.active {
    color: #fa0;
}

#lightTC.active span {
    color: #fa0;
}

/* Unified Headlights */
#lightHeadlights.low {
    color: #0f8;
    opacity: 1;
    box-shadow: 0 0 10px #0f8;
}

/* Green Low Beam */
#lightHeadlights.low svg {
    fill: #0f8;
}

#lightHeadlights.high {
    color: #0af;
    opacity: 1;
    box-shadow: 0 0 15px #0af;
    border-color: #0af;
}

/* Blue High Beam */
#lightHeadlights.high svg {
    fill: #0af;
}


/* Settings Button */
.settings-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0.3;
    z-index: 200;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.settings-btn:hover {
    opacity: 1;
}

.settings-btn svg {
    width: 24px;
    height: 24px;
}

/* Fullscreen Button */
.fullscreen-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    opacity: 0.3;
    z-index: 200;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.fullscreen-btn:hover {
    opacity: 1;
}

.fullscreen-btn svg {
    width: 32px;
    height: 32px;
}

/* Mobile Landscape Optimization */
@media (max-height: 500px) {
    .digital-speed-value {
        font-size: 35vh;
    }

    .digital-gear-value {
        font-size: 15vh;
    }

    .rpm-data {
        right: 0vw;
        transform: scale(0.9);
        transform-origin: top right;
    }

    .clock-display {
        top: calc(15vh + 65px);
        /* Adjusted for scaled rpm-data */
        transform: scale(0.9);
        transform-origin: top right;
    }
}

/* Hide old elements */
.gauges-container,
.gauge,
.pedals-container,
.mini-gauge,
.car-info {
    display: none !important;
}