/* ═══════════════════════════════════════════════════════════════════════════
   FIFA Border Watch — Windows 8 Live Tile UI Design System
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Windows 8 Authentic Deep Background */
    --bg-page: #0b1d28;

    /* Authentic Windows 8 Tile Colors */
    --bg-green: #00a300;
    --bg-red: #e51400;
    --bg-blue: #2b5797;
    --bg-purple: #603cba;
    --bg-dark: #1d1d1d;
    --bg-teal: #00aba9;

    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.75);

    /* Windows 8 Grid Specs */
    --tile-gap: 8px;
    --radius: 0px;
    /* Sharp corners like Windows 8 */
    --font: 'Segoe UI', 'Segoe WP', 'SF Pro Text', -apple-system, sans-serif;

    /* Grid unit sizes - baseline 120px */
    --unit: 130px;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ── Start Screen Header ───────────────────────────────────────────────── */
/* ── Start Screen Header ───────────────────────────────────────────────── */
.hero-strip {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 40px 30px;
    width: 100%;
}

/* ── Top Bar & Footer ─────────────────────────────────────────────────── */
#top-bar {
    background: var(--bg-page);
    padding: 20px 40px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-fifa {
    font-size: 2.22rem;
    font-weight: 900;
    color: var(--bg-red);
    letter-spacing: -2px;
    text-shadow: 0 0 15px rgba(229, 20, 0, 0.3);
    line-height: 1;
}

.brand-flags {
    display: flex;
    gap: 6px;
    align-items: center;
}

.flag-icon {
    width: 32px;
    height: auto;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.top-nav {
    display: flex;
    gap: 32px;
    margin-left: 60px;
    margin-right: auto;
    align-items: center;
}

.nav-link {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: #ffffff;
}

.clock {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

#bottom-bar {
    margin-top: auto;
    padding: 30px 40px;
    text-align: left;
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 1200px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.hero-strip h1 {
    font-size: 3rem;
    font-weight: 200;
    /* Thin Segoe UI look */
    letter-spacing: -1px;
    color: var(--text);
    margin-bottom: 0px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   WINDOWS TILE GRID
   ═══════════════════════════════════════════════════════════════════════════ */
.win-grid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px 60px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 40px;
    /* Gap between groups */
}

.win-group {
    display: flex;
    flex-direction: column;
}

.group-title {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

/* Base grids for wide tiles vs small tiles */
.group-tiles {
    display: grid;
    /* Wide tiles take 2 units wide, 1 unit high */
    grid-template-columns: repeat(2, calc(var(--unit) * 2 + var(--tile-gap)));
    grid-auto-rows: var(--unit);
    gap: var(--tile-gap);
}

.group-tiles-small {
    display: grid;
    /* Small tiles take 1 unit wide, 1 unit high */
    grid-template-columns: repeat(2, var(--unit));
    grid-auto-rows: var(--unit);
    gap: var(--tile-gap);
}

/* ── The Tile ──────────────────────────────────────────────────────────── */
.win-tile {
    position: relative;
    display: block;
    background-color: var(--bg-color, var(--bg-teal));
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.1s cubic-bezier(0.1, 0.7, 0.1, 1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    /* Slight crisp border */
}

/* Windows 8 'press' effect */
.win-tile:active {
    transform: scale(0.96) perspective(500px) rotateX(2deg);
}

/* Tile Layout */
.tile-content {
    position: absolute;
    inset: 0;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 2;
}

.tile-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tile-status {
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.4);
}

.tile-status.is-open {
    color: #fff;
}

.tile-status.is-closed {
    color: #ff6b6b;
}

.tile-nexus {
    font-weight: 400;
    color: rgba(255, 255, 255, 0.8);
}

/* Big center numbers */
.tile-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.big-wait {
    font-size: 4.5rem;
    font-weight: 300;
    /* Thin font is very Windows 8 */
    line-height: 1;
    letter-spacing: -2px;
}

.wait-unit {
    font-size: 1.2rem;
    font-weight: 400;
    margin-left: 2px;
    opacity: 0.6;
    letter-spacing: 0;
}

.wait-offline {
    font-size: 2rem;
    font-weight: 400;
    opacity: 0.5;
}

/* Bottom app label */
.tile-bottom {
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
}

.tile-title {
    font-size: 1rem;
    font-weight: 400;
    /* Regular weight, not bold */
    letter-spacing: 0.2px;
}

/* ── Extras Group Sizes & Colors ────────────────────────────────────────── */
.bg-blue {
    --bg-color: var(--bg-blue);
}

.bg-purple {
    --bg-color: var(--bg-purple);
}

.bg-dark {
    --bg-color: var(--bg-dark);
}

.tile-icon {
    font-size: 2rem;
}

.small-hero-text {
    font-size: 2rem;
    font-weight: 300;
    margin-top: -4px;
}

.time-text {
    font-size: 1.2rem;
    margin-top: 4px;
}

.group-tiles-small .tile-center {
    align-items: center;
}

.group-tiles-small .tile-bottom {
    justify-content: flex-start;
}

/* ── Camera Background Integration ─────────────────────────────────────── */
.tile-bg-img {
    position: absolute;
    inset: -10px;
    /* Slight bleed to allow pan animation without edges showing */
    z-index: 0;
}

.cam-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    animation: slow-pan 30s alternate infinite linear;
}

/* Very subtle shader so white text is readable against the camera feed */
.tile-shader {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.3) 40%, rgba(0, 0, 0, 0.8) 100%);
    z-index: 1;
}

@keyframes slow-pan {
    0% {
        transform: scale(1) translate(0, 0);
    }

    100% {
        transform: scale(1.08) translate(-2%, 2%);
    }
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
    :root {
        --unit: 140px;
    }

    .hero-strip {
        padding: 40px 20px 20px;
    }

    .hero-strip h1 {
        font-size: 2.2rem;
    }

    .win-grid {
        padding: 0 20px 40px;
        flex-direction: column;
        gap: 30px;
    }

    .group-tiles {
        grid-template-columns: 1fr;
    }

    /* Let wide tiles span the screen */
    .win-tile.tile-wide {
        width: 100%;
    }
}

@media (max-width: 400px) {
    :root {
        --unit: 140px;
    }

    .group-tiles-small {
        grid-template-columns: repeat(2, calc(50vw - 24px));
        grid-auto-rows: calc(50vw - 24px);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   NEW TAB & SPLIT-VIEW LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.dashboard-root {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 40px 60px;
}

/* Top Tabs */
.crossing-tabs-container {
    display: flex;
    gap: 12px;
    margin-bottom: 40px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.crossing-tab {
    flex: 1;
    min-width: 200px;
    background: #5e7a7d;
    /* Drawboard muted slate/teal */
    border: 2px solid transparent;
    padding: 24px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 120px;
}

.crossing-tab:hover {
    background: #6a8c8f;
}

.crossing-tab.active-tab {
    background: #1db954;
    /* Spotify vibrant green */
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.tab-title {
    font-size: 1.25rem;
    font-weight: 300;
    margin-top: auto;
}

.tab-status {
    font-size: 0.8rem;
    margin-top: 8px;
    color: var(--text-muted);
}

.tab-status.is-open {
    color: #a4f4a4;
}

/* Split View Stage */
.split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

/* Direction Column */
.direction-column {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 30px;
}

.dir-title {
    font-size: 2rem;
    font-weight: 200;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}

.dir-sub {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Waits row */
.dir-waits {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.wait-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.wait-label {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.wait-columns {
    display: flex;
    gap: 40px;
    margin-bottom: 5px;
}

.wait-col {
    display: flex;
    flex-direction: column;
}

.wait-big-val {
    font-size: 3.5rem;
    font-weight: 300;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.wait-unit {
    font-size: 1.2rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.6);
}

.wait-sub-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: -2px;
}

.wait-source {
    display: none;
}

/* Gallery */
.gallery-title {
    font-size: 1.1rem;
    font-weight: 300;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.main-cam-stage {
    width: 100%;
    aspect-ratio: 1.5 / 1;
    /* Taller (3:2) for better space reclamation */
    background: #000;
    margin-bottom: 0px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.large-cam {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-container .carousel-btn {
    opacity: 0.8;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 10px 15px;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
    user-select: none;
    backdrop-filter: blur(4px);
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.prev-btn {
    left: 0;
}

.next-btn {
    right: 0;
}

.carousel-indicator {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    letter-spacing: 1px;
    backdrop-filter: blur(4px);
    pointer-events: none;
    color: var(--text-muted);
}

.no-cams {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
    padding: 20px 0;
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .split-view {
        grid-template-columns: 1fr;
    }
}

/* ── Mobile & Tablet Responsiveness ───────────────────────────────────── */
@media (max-width: 768px) {
    #top-bar {
        padding: 15px 20px;
    }

    .top-bar-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .brand {
        gap: 10px;
    }

    .brand-fifa {
        font-size: 1.8rem;
        /* Scale down logo for mobile */
    }

    .top-nav {
        margin-left: 0;
        gap: 20px;
        flex-wrap: wrap;
    }

    .nav-link {
        font-size: 0.8rem;
    }

    .win-grid {
        padding: 0 20px 40px;
        gap: 40px;
    }

    /* FIX: Targeted actual dashboard tab container */
    .crossing-tabs-container {
        display: flex;
        flex-direction: column;
        /* Stack tabs vertically on mobile */
        gap: 8px;
        padding: 0 10px;
        height: auto;
        overflow-x: hidden;
    }

    .crossing-tab {
        width: 100%;
        /* Full width tabs */
        min-width: unset;
        min-height: 100px;
        flex: unset;
        margin-bottom: 0px;
    }

    .active-tab {
        border-bottom: none;
        border-left: 4px solid var(--text);
    }

    /* Adjust the specific tile content for mobile */
    .wait-detail {
        padding: 15px;
    }

    .wait-big {
        font-size: 2.5rem;
    }

    .lane-stat {
        font-size: 1.2rem;
    }

    /* Fix the crossing detail view */
    .crossing-header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .brand-fifa {
        font-size: 1.5rem;
    }

    .flag-icon {
        width: 24px;
    }
}