:root {
    /* Neon Palette */
    --bg-deep: #0a0b10;
    --cyan-bright: #4a9aa3;
    --amber-warn: #ffae00;
    --red-danger: #ff3131;

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(15px);

    /* Layout */
    --shaft-width: 280px;
    --border-radius: 12px;
    /* IMPORTANT: --floor-height must match floor_to_pixels/1 in dashboard_helpers.ex (floor * N).
     Change both together or the elevator car will mis-align with floor labels. */
    --floor-height: 50px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Inter", sans-serif;
    background-color: #050608;
    background-image:
        radial-gradient(
            circle at 50% 50%,
            rgba(0, 242, 255, 0.05),
            transparent 70%
        ),
        linear-gradient(rgba(10, 11, 16, 0.8) 1px, transparent 1px),
        linear-gradient(90deg, rgba(10, 11, 16, 0.8) 1px, transparent 1px);
    background-size:
        100% 100%,
        40px 40px,
        40px 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: #e0e6ed;
    overflow: hidden;
}

.dashboard-container {
    width: 95vw;
    height: auto;
    max-width: 1600px;
    background-color: var(--bg-deep);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(0, 242, 255, 0.1);
    overflow: hidden;
    position: relative;
    backdrop-filter: var(--glass-blur);
}

.main-content {
    flex: none;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    padding: 24px 24px 12px 24px;
    gap: 12px;
}

/* --- Shaft Area (25%) --- */
.left-panel {
    flex: 0 0 auto;
    width: var(--shaft-width);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.shaft-container {
    flex: none;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 20px 10px;
    position: relative;
}

/* Digital Top Indicator */
.digital-indicator {
    height: 60px;
    /* Centered over .shaft-visual: labels(50px) + gap(20px) = 70px offset */
    align-self: flex-start;
    width: fit-content;
    min-width: 80px;
    position: relative;
    left: calc(50px + 20px + (100% - 50px - 20px) / 2);
    transform: translateX(-50%);
    padding: 0 16px;
    background: #000;
    border: 2px solid #222;
    border-radius: 4px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "JetBrains Mono", monospace;
    font-size: 2.5rem;
    color: var(--cyan-bright);
    text-shadow: 0 0 10px var(--cyan-bright);
    position: relative;
    overflow: hidden;
}

.digital-indicator::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.3) 3px
    );
    pointer-events: none;
}

.shaft-layout {
    height: calc(6 * var(--floor-height));
    display: flex;
    gap: 20px;
    position: relative;
}

/* Interactive Floor Labels */
.floor-labels {
    display: flex;
    flex-direction: column;
    width: 50px;
}

.floor-slot {
    height: var(--floor-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

.floor-label {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Inter", sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    color: #666;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

@media (hover: hover) {
    .floor-label:hover {
        border-color: var(--cyan-bright);
        color: var(--cyan-bright);
        box-shadow: 0 0 15px rgba(0, 242, 255, 0.2);
    }
}

.floor-label.pending {
    border-color: var(--amber-warn);
    color: var(--amber-warn);
    box-shadow: 0 0 20px rgba(255, 174, 0, 0.3);
}

.floor-label.targeting {
    border-color: var(--cyan-bright);
    color: var(--cyan-bright);
    animation: pulse-cyan 1.5s infinite;
}

@keyframes pulse-cyan {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 242, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(0, 242, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 242, 255, 0);
    }
}

/* Door Control Buttons */
.door-controls {
    display: flex;
    gap: 6px;
    justify-content: space-evenly;
    padding-top: 12px;
    margin-left: calc(
        50px + 20px
    ); /* align with .shaft-visual: labels(50px) + gap(20px) */
}

.door-controls button {
    width: 64px;
    height: 44px;
    border-radius: 4px;
    border: 2px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: #666;
    font-family: "Inter", sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

@media (hover: hover) {
    .door-controls button:hover {
        border-color: var(--amber-warn);
        color: var(--amber-warn);
        box-shadow: 0 0 15px rgba(255, 174, 0, 0.2);
    }
}

.door-controls button:active {
    background: rgba(255, 174, 0, 0.1);
}

/* Shaft Visuals */
.shaft-visual {
    flex: 1;
    border-left: 2px dashed rgba(255, 255, 255, 0.1);
    border-right: 2px dashed rgba(255, 255, 255, 0.1);
    position: relative;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(255, 255, 255, 0.02) 50%,
        transparent
    );
}

.car-container {
    width: 100%;
    height: 60px; /* Adjust based on floor count/height */
    position: absolute;
    left: 0;
}

.elevator-car {
    width: 90%;
    height: 100%;
    margin: 0 auto;
    background: linear-gradient(135deg, #2c3e50, #000);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.car-doors {
    display: flex;
    height: 100%;
    width: 100%;
}

.car-door {
    flex: 1;
    background: linear-gradient(to right, #445, #223, #445);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 1000ms ease-in-out;
}

.car-door-left {
    border-right: 1px solid var(--cyan-bright);
}
.car-door-right {
    border-left: 1px solid var(--cyan-bright);
}

.doors-open .car-door-left {
    transform: translateX(-95%);
}
.doors-open .car-door-right {
    transform: translateX(95%);
}

/* --- Activity Log (75%) --- */
/* Height matches shaft-container: padding(40) + indicator(72) + shaft-layout(6*floor-height) + door-controls(56) */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    max-height: calc(6 * var(--floor-height) + 168px);
}

.log-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    font-family: "Inter", sans-serif;
    font-size: 0.8rem;
    letter-spacing: 2px;
    font-weight: 800;
    color: #445566;
}

.activity-log {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.85rem;
    color: #abb2bf;
}

.log-entry {
    white-space: nowrap;
    line-height: 1.4;
    margin-bottom: 4px;
    padding-left: 10px;
}

.log-entry.error {
    color: var(--red-danger);
}

/* --- Footer --- */
.status-footer {
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    padding: 12px 40px;
}

.footer-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
}

.status-info {
    display: flex;
    flex-direction: column;
    width: 90px;
}

.status-label {
    font-family: "Inter", sans-serif;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #666;
}

.status-value {
    font-family: "Inter", sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

/* --- Tick Dot --- */
.tick-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #445566;
    transition: background-color 80ms ease-out;
    vertical-align: middle;
    margin-left: 4px;
}

.tick-dot--on {
    background-color: #4a9aa3;
}

/* --- Time / Speed Control --- */
.time-item {
    min-width: 160px;
}

.time-item .status-info {
    width: auto;
}

.time-readout {
    font-family: "Inter", sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: #8899aa;
    white-space: nowrap;
    text-transform: none;
    display: inline-block;
}

.speed-buttons {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.speed-btn {
    font-family: "Inter", sans-serif;
    font-size: 0.55rem;
    padding: 1px 5px;
    border: 1px solid #334455;
    border-radius: 3px;
    background: transparent;
    color: #556677;
    cursor: pointer;
    letter-spacing: 0.5px;
}

.speed-btn:hover {
    border-color: #4a9aa3;
    color: #4a9aa3;
}

.speed-btn--active {
    border-color: #4a9aa3;
    color: #4a9aa3;
    background: rgba(74, 154, 163, 0.12);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Page Footer */
.page-footer {
    position: fixed;
    bottom: 12px;
    left: 0;
    right: 0;
    text-align: center;
    font-family: "Inter", sans-serif;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #8899aa;
    letter-spacing: 0.05em;
    pointer-events: none;
}

.page-footer-sub {
    font-size: 0.7rem;
    color: #5e6e7e;
}

/* GitHub Ribbon */
.github-ribbon {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9999;
}

/* =====================================================================
   Mobile Layout (≤ 768px)
   - No activity log
   - Shaft fills full width, natural scroll
   ===================================================================== */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    .dashboard-container {
        width: 100%;
        height: auto;
        max-width: unset;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .main-content {
        flex: none;
        flex-direction: column;
        padding: 16px;
        gap: 16px;
        overflow: visible;
    }

    .right-panel {
        display: none;
    }

    .left-panel {
        width: 100%;
    }

    .shaft-container {
        flex: none;
        padding: 12px 10px;
    }

    .floor-label {
        width: 46px;
        height: 46px;
        font-size: 1.3rem;
    }

    .footer-item:not(.time-item) {
        display: none;
    }

    .status-footer {
        justify-content: center;
        height: auto;
        padding: 12px 20px;
    }

    .time-item {
        width: 100%;
        justify-content: center;
    }

    .time-item .status-info {
        width: auto;
        align-items: center;
    }

    .speed-buttons {
        justify-content: center;
        gap: 8px;
        margin-top: 8px;
    }

    .speed-btn {
        font-size: 0.85rem;
        padding: 10px 16px;
        border-radius: 6px;
        min-width: 48px;
        min-height: 44px;
    }

    .github-ribbon {
        display: none;
    }

    .page-footer {
        position: static;
        text-align: center;
        margin-top: 38px;
        padding: 0 10px 12px;
        line-height: 1.6;
        font-size: 0.65rem;
    }

    .page-footer-sub {
        font-size: 0.55rem;
        color: #5e6e7e;
    }

    .page-footer br {
        display: inline;
    }
}
