@import url('https://fonts.googleapis.com/css2?family=Syncopate:wght@400;700&family=Inter:wght@300;500;700;900&display=swap');

:root {
    --bg-main: #050505;
    --text-light: #ffffff;
    --text-muted: #888888;
    --brand-accent: #EB0A1E;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* -------------------------------------
 * STACKED LAYOUT (config-driven brand sections)
 * ------------------------------------- */
.stacked-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
}

.brand-section {
    flex: var(--flex-grow, 1) 1 auto;
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1.5rem;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, #111111, #000000);
}

.brand-section:last-child {
    border-bottom: none;
}

.brand-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: linear-gradient(90deg, transparent, var(--brand-accent), transparent);
    opacity: 0.9;
}

/* Brand Headers */
.brand-header {
    text-align: center;
    margin-bottom: 0.5rem;
    height: auto;
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: baseline;
    justify-content: center;
}

.brand-header h1 {
    font-family: 'Syncopate', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow: 0px 4px 20px var(--brand-accent);
}

.brand-header p {
    font-size: 1rem;
    letter-spacing: 2px;
    font-weight: 300;
    color: var(--text-muted);
    margin-top: 0;
    text-transform: uppercase;
}

/* -------------------------------------
 * QUEUE GRID
 * ------------------------------------- */
.queue-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    align-content: stretch;
    flex: 1;
}

/* The Number Card */
.unit-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    position: relative;
    overflow: hidden;
    flex: 1 1 calc(25% - 0.75rem);
    max-width: calc(25% - 0.75rem);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease;
}

.unit-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--brand-accent), transparent);
}

.unit-label {
    font-size: clamp(1.2rem, 1.6vw, 2rem);
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-muted);
    z-index: 2;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 100%;
}

.unit-number-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.unit-number {
    font-size: clamp(4rem, 6.5vw, 8rem);
    font-weight: 900;
    line-height: 1;
    z-index: 2;
    transition: all 0.3s ease;
    font-variant-numeric: tabular-nums;
    display: inline-flex;
    align-items: center;
    color: #ffffff;
    text-shadow: 0 0 20px var(--brand-accent);
}

.prefix {
    font-size: 0.75em;
    opacity: 0.85;
    margin-right: 4px;
}

/* -------------------------------------
 * ANIMATIONS
 * ------------------------------------- */
@keyframes numberPop {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.15); filter: brightness(1.5); }
    100% { transform: scale(1); filter: brightness(1); }
}

.animate-pop {
    animation: numberPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes flashBrand {
    0% { box-shadow: inset 0 0 0 rgba(255, 255, 255, 0); }
    50% { box-shadow: inset 0 0 50px var(--brand-accent); }
    100% { box-shadow: inset 0 0 0 rgba(255, 255, 255, 0); }
}

.flash-brand {
    animation: flashBrand 0.6s ease;
}

/* -------------------------------------
 * DASHBOARD SPECIFIC STYLES
 * ------------------------------------- */
body.dashboard {
    overflow-y: auto;
    padding: 1rem 2rem;
    height: 100vh;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 1rem;
}

.dashboard-header h1 {
    font-size: 2.2rem;
    margin-bottom: 0.2rem;
}

.header-links {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.link-button {
    background: rgba(255,255,255,0.1);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    transition: background 0.2s;
    border: 1px solid rgba(255,255,255,0.2);
}

.link-button:hover {
    background: rgba(255,255,255,0.2);
}

.controls-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.controls-brand-section {
    flex: 1 1 45%;
    min-width: 320px;
    background: rgba(0,0,0,0.4);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--glass-border);
    border-top: 5px solid var(--brand-accent);
}

/* 2x6 dashboard: 2 columns, up to 6 rows */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.control-card {
    background: var(--glass-bg);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    position: relative;
}

.control-card h3 {
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    letter-spacing: 1px;
    line-height: 1.4;
}

.input-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background: var(--brand-accent);
    transform: scale(1.05);
}

.number-input {
    width: 80px;
    height: 50px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    border-radius: 8px;
}

.number-input:focus {
    outline: none;
    border-color: var(--text-light);
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

#reset-all-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background: rgba(220,38,38,0.8);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: Inter, sans-serif;
    font-size: 0.8rem;
    transition: background 0.2s, opacity 0.2s;
}

#reset-all-btn:hover {
    background: rgba(220,38,38,1);
}

/* -------------------------------------
 * RESPONSIVE
 * ------------------------------------- */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        height: auto;
    }

    .controls-wrapper {
        flex-direction: column;
    }

    .controls-brand-section {
        min-width: auto;
    }

    .header-links {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
    }

    /* Display mobile overrides */
    .stacked-container {
        height: auto;
    }

    .brand-section {
        flex: none;
        padding: 1rem;
        border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    }

    .brand-header {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .brand-header h1 {
        font-size: 1.8rem;
    }

    .unit-card {
        flex: 1 1 calc(50% - 1rem);
        max-width: calc(50% - 1rem);
        min-width: 0;
    }

    .unit-label {
        font-size: clamp(0.6rem, 2.8vw, 0.9rem);
    }

    .unit-number {
        font-size: 2.2rem;
    }

    .queue-grid {
        gap: 0.5rem;
    }
}

/* Landscape phone: 3 columns */
@media (min-width: 600px) and (max-width: 768px) {
    .queue-grid {
        justify-content: center;
    }
}