/* ==========================================================================
   CUSTOMER DISPLAY SYSTEM (CDS) - QRFOOD
   Dedicated stylesheet for salon TVs and tablets
   ========================================================================== */

:root {
    --cds-bg: #0c0d12;
    --cds-surface: #14161f;
    --cds-surface-hover: #1b1e2a;
    --cds-border: rgba(255, 255, 255, 0.08);
    --cds-border-active: rgba(180, 31, 44, 0.4);
    
    --cds-red: #b41f2c;
    --cds-red-bright: #e5293e;
    --cds-red-glow: rgba(229, 41, 62, 0.35);

    --cds-amber: #f59e0b;
    --cds-amber-glow: rgba(245, 158, 11, 0.3);

    --cds-slate: #94a3b8;
    --cds-slate-glow: rgba(148, 163, 184, 0.25);

    --cds-text-primary: #ffffff;
    --cds-text-secondary: #9aa0b4;
    --cds-text-muted: #5e6478;

    --cds-radius-lg: 20px;
    --cds-radius-md: 14px;
    --cds-radius-sm: 8px;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--cds-bg);
    color: var(--cds-text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    -webkit-user-select: none;
}

.cds-body {
    background-color: var(--cds-bg);
}

.cds-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    box-sizing: border-box;
    padding: 24px;
    gap: 20px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.cds-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 20px;
    background-color: var(--cds-surface);
    border: 1px solid var(--cds-border);
    border-radius: var(--cds-radius-md);
    flex-shrink: 0;
}

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

.cds-logo {
    height: 38px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.cds-brand-divider {
    width: 1px;
    height: 24px;
    background-color: var(--cds-border);
}

.cds-brand-title {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--cds-text-secondary);
    text-transform: uppercase;
}

.cds-header-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cds-clock {
    font-size: 1.35rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
    color: var(--cds-text-primary);
    padding: 6px 14px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--cds-border);
    border-radius: var(--cds-radius-sm);
}

.cds-control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--cds-border);
    color: var(--cds-text-secondary);
    border-radius: var(--cds-radius-sm);
    padding: 8px 14px;
    height: 40px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.cds-control-btn:hover {
    background-color: var(--cds-surface-hover);
    color: var(--cds-text-primary);
    border-color: rgba(255, 255, 255, 0.18);
}

.cds-control-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    line-height: 20px;
}

/* ==========================================================================
   MAIN LAYOUT (LANDSCAPE / TV DEFAULT)
   ========================================================================== */

.cds-main {
    flex: 1;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 24px;
    min-height: 0;
}

/* ==========================================================================
   HERO CARD: LATEST READY ORDER
   ========================================================================== */

.cds-hero-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(145deg, #161822 0%, #101117 100%);
    border: 2px solid var(--cds-red);
    border-radius: var(--cds-radius-lg);
    padding: 36px 40px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 60px var(--cds-red-glow);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.cds-hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--cds-red), var(--cds-red-bright));
}

.cds-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background-color: rgba(229, 41, 62, 0.15);
    border: 1px solid rgba(229, 41, 62, 0.35);
    color: var(--cds-red-bright);
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    align-self: flex-start;
}

.cds-pulse-dot {
    width: 14px;
    height: 14px;
    background-color: var(--cds-red-bright);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--cds-red-bright);
    animation: cdsPulse 1.8s infinite;
}

@keyframes cdsPulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(229, 41, 62, 0.7);
    }
    70% {
        transform: scale(1.15);
        box-shadow: 0 0 0 14px rgba(229, 41, 62, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(229, 41, 62, 0);
    }
}

.cds-hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    margin: 20px 0;
}

.cds-hero-number-wrap {
    display: flex;
    align-items: baseline;
    justify-content: center;
    line-height: 0.9;
}

.cds-hero-hash {
    font-size: clamp(3.5rem, 8vw, 9rem);
    font-weight: 900;
    color: var(--cds-red-bright);
    margin-right: 6px;
    text-shadow: 0 0 40px var(--cds-red-glow);
}

.cds-hero-number {
    font-size: clamp(5.5rem, 13vw, 15rem);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    color: var(--cds-text-primary);
    letter-spacing: -2px;
    text-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 50px rgba(255, 255, 255, 0.15);
    transition: transform 0.3s ease;
}

.cds-hero-instruction {
    font-size: clamp(1.2rem, 2.2vw, 2.2rem);
    font-weight: 700;
    color: var(--cds-text-secondary);
    letter-spacing: 0.5px;
    margin-top: 24px;
}

/* Flash animation when a new order becomes ready */
.cds-hero-card.is-flashing {
    animation: cdsFlash 1.2s ease-in-out 3;
}

@keyframes cdsFlash {
    0%, 100% {
        border-color: var(--cds-red);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 60px var(--cds-red-glow);
    }
    50% {
        border-color: #ffffff;
        box-shadow: 0 12px 50px rgba(255, 255, 255, 0.3), 0 0 90px var(--cds-red-bright);
    }
}

/* ==========================================================================
   QUEUE COLUMNS WRAPPER (PREPARING & WAITING)
   ========================================================================== */

.cds-queue-wrapper {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 20px;
    min-height: 0;
}

.cds-queue-column {
    display: flex;
    flex-direction: column;
    background-color: var(--cds-surface);
    border: 1px solid var(--cds-border);
    border-radius: var(--cds-radius-lg);
    padding: 24px;
    overflow: hidden;
    min-height: 0;
}

.cds-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.cds-queue-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cds-status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-preparing {
    background-color: var(--cds-amber);
    box-shadow: 0 0 12px var(--cds-amber-glow);
}

.dot-waiting {
    background-color: var(--cds-slate);
    box-shadow: 0 0 12px var(--cds-slate-glow);
}

.cds-queue-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--cds-text-primary);
}

.cds-queue-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--cds-border);
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--cds-text-secondary);
}

/* ==========================================================================
   QUEUE NUMBERS GRID
   ========================================================================== */

.cds-queue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    align-content: flex-start;
    flex: 1;
}

/* Custom minimal scrollbar */
.cds-queue-grid::-webkit-scrollbar {
    width: 6px;
}

.cds-queue-grid::-webkit-scrollbar-track {
    background: transparent;
}

.cds-queue-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.cds-number-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a1d28;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--cds-radius-md);
    padding: 12px 14px;
    font-size: clamp(1.8rem, 2.8vw, 3rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--cds-text-primary);
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.cds-queue-preparing .cds-number-chip {
    border-left: 4px solid var(--cds-amber);
}

.cds-queue-waiting .cds-number-chip {
    border-left: 4px solid var(--cds-slate);
    color: #e2e8f0;
}

.cds-number-chip.is-new {
    animation: chipPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes chipPop {
    0% {
        transform: scale(0.6);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.cds-empty-state {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 80px;
    color: var(--cds-text-muted);
    font-size: 1.1rem;
    font-weight: 500;
    font-style: italic;
    border: 1px dashed rgba(255, 255, 255, 0.06);
    border-radius: var(--cds-radius-md);
}

/* ==========================================================================
   PORTRAIT / TABLET RESPONSIVENESS
   ========================================================================== */

@media (max-width: 900px), (orientation: portrait) {
    .cds-container {
        padding: 16px;
        gap: 16px;
    }

    .cds-header {
        height: 56px;
        padding: 0 16px;
    }

    .cds-brand-title {
        display: none;
    }

    .cds-brand-divider {
        display: none;
    }

    .cds-main {
        grid-template-columns: 1fr;
        grid-template-rows: 1.1fr 1fr;
        gap: 16px;
    }

    .cds-hero-card {
        padding: 24px 20px;
    }

    .cds-hero-badge {
        font-size: 1rem;
        padding: 8px 16px;
    }

    .cds-queue-wrapper {
        grid-template-rows: none;
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }

    .cds-queue-column {
        padding: 16px;
    }

    .cds-queue-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }

    .cds-number-chip {
        padding: 10px 8px;
        font-size: 1.8rem;
    }
}

@media (max-width: 600px) {
    .cds-queue-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }
}

/* LOGIN: Handled centrally by waiter.css */
body.cds-body.is-anonymous {
    overflow-y: auto !important;
}

