/* ===== MIPOS Queue — Bright F&B Theme ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

:root {
    --bg: #f5f3f0;
    --surface: #ffffff;
    --surface-hover: #fafaf8;
    --surface-alt: #f0eeeb;
    --accent: #e8622c;
    --accent-hover: #d4551f;
    --accent-soft: #fff0eb;
    --accent-dim: rgba(232, 98, 44, 0.08);
    --accent-border: rgba(232, 98, 44, 0.18);
    --text: #1a1a1a;
    --text-dim: #6b6b6b;
    --text-dimmer: #9a9a9a;
    --text-dimmest: #c5c5c5;
    --border: #e8e5e0;
    --success: #22c55e;
    --danger: #ef4444;
    --danger-dim: #fef2f2;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.08);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== TICKET CARD ===== */
.ticket {
    background: var(--surface);
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
    max-width: 420px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.ticket::before,
.ticket::after {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    background: var(--bg);
    border-radius: 50%;
    z-index: 2;
}

.ticket::before {
    left: -14px;
}

.ticket::after {
    right: -14px;
}

.ticket.punch-high::before,
.ticket.punch-high::after {
    top: 260px;
}

.ticket.punch-low::before,
.ticket.punch-low::after {
    top: 180px;
}

.ticket-top {
    padding: 32px 28px 40px;
    text-align: center;
    background: linear-gradient(145deg, #fff5f0, #fff8f5);
    border-bottom: 2px dashed var(--border);
}

/* ===== TYPOGRAPHY ===== */
.mono {
    font-family: 'Space Mono', monospace;
}

.label-xs {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-dimmer);
    text-transform: uppercase;
}

.label-sm {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    letter-spacing: 4px;
    color: var(--text-dimmer);
    text-transform: uppercase;
}

.brand {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text);
}

.brand span {
    color: var(--accent);
}

/* ===== EST TIME BOX ===== */
.est-box {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    background: var(--accent-soft);
    padding: 10px 22px;
    border-radius: 30px;
    border: 1px solid var(--accent-border);
    margin-top: 20px;
}

.est-box .num {
    font-family: 'Space Mono', monospace;
    font-size: 26px;
    font-weight: 700;
    color: var(--accent);
}

.est-box .unit {
    font-size: 12px;
    color: var(--accent);
    opacity: 0.7;
}

.est-box .lbl {
    font-size: 10px;
    color: var(--text-dim);
    margin-right: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ===== FORM FIELDS ===== */
.ticket-body {
    padding: 36px 28px 32px;
}

.field {
    margin-bottom: 20px;
}

.field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--text-dimmer);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.field input,
.field select {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    outline: none;
}

.field input::placeholder {
    color: var(--text-dimmest);
}

.field input:focus,
.field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.field select option {
    background: var(--surface);
}

.field .error-msg {
    color: var(--danger);
    font-size: 12px;
    margin-top: 6px;
    display: none;
    font-weight: 500;
}

.field.has-error .error-msg {
    display: block;
}

.field.has-error input,
.field.has-error select {
    border-color: var(--danger);
}

/* ===== BUTTONS ===== */
.btn-primary {
    width: 100%;
    padding: 16px;
    margin-top: 8px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 14px rgba(232, 98, 44, 0.25);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232, 98, 44, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    width: 100%;
    padding: 14px;
    background: var(--surface-alt);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--border);
    color: var(--text);
}

.btn-call {
    padding: 10px 18px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(232, 98, 44, 0.2);
}

.btn-call:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 10px rgba(232, 98, 44, 0.25);
}

.btn-remove {
    padding: 10px 14px;
    background: transparent;
    color: var(--danger);
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: #fef2f2;
    border-color: var(--danger);
}

/* ===== BIG NUMBER (Status) ===== */
.big-number {
    font-family: 'Space Mono', monospace;
    font-size: 80px;
    font-weight: 700;
    line-height: 1;
    color: var(--accent);
}

.q-prefix {
    font-size: 24px;
    color: var(--text-dimmest);
    vertical-align: top;
    margin-right: 2px;
}

/* ===== DETAIL ROWS ===== */
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--surface-alt);
}

.detail-row:last-of-type {
    border: none;
}

.detail-row .k {
    font-size: 11px;
    color: var(--text-dimmer);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.detail-row .v {
    font-size: 15px;
    font-weight: 600;
}

.detail-row .v.highlight {
    color: var(--accent);
}

/* ===== CALLED ALERT ===== */
.called-alert {
    background: linear-gradient(135deg, var(--accent), #d4551f);
    color: white;
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    animation: blink 1.5s ease-in-out infinite;
    margin-top: 16px;
    display: none;
    box-shadow: 0 4px 16px rgba(232, 98, 44, 0.3);
}

.called-alert.show {
    display: block;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

/* ===== ADMIN: METRICS ===== */
.metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.metric {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 22px 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.metric .val {
    font-family: 'Space Mono', monospace;
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
}

.metric .lab {
    font-size: 11px;
    color: var(--text-dimmer);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ===== ADMIN: QUEUE CARDS ===== */
.queue-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.queue-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: grid;
    grid-template-columns: 60px 1fr auto;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.queue-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.queue-card.called-card {
    opacity: 0.55;
    border-left: 3px solid var(--accent);
}

.qc-num {
    font-family: 'Space Mono', monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    background: var(--accent-soft);
    padding: 8px 4px;
    border-radius: var(--radius-sm);
}

.qc-info .qc-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.qc-info .qc-meta {
    font-size: 12px;
    color: var(--text-dimmer);
}

.qc-info .qc-meta span {
    margin-right: 12px;
}

.qc-actions {
    display: flex;
    gap: 8px;
}

/* ===== ADMIN: HEADER ===== */
.admin-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.admin-top h2 {
    font-size: 24px;
    font-weight: 800;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal p {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-btns {
    display: flex;
    gap: 10px;
}

.modal-btns button {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    font-size: 14px;
    border: none;
    transition: all 0.2s;
}

.modal-btns .m-cancel {
    background: var(--surface-alt);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.modal-btns .m-cancel:hover {
    background: var(--border);
}

.modal-btns .m-confirm {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(232, 98, 44, 0.2);
}

.modal-btns .m-confirm:hover {
    background: var(--accent-hover);
}

.modal-btns .m-danger {
    background: var(--danger);
    color: white;
}

.modal-btns .m-danger:hover {
    background: #dc2626;
}

/* ===== LAYOUT ===== */
.page {
    max-width: 420px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.admin-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 20px;
}

/* ===== LOADING ===== */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dimmer);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 15px;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    z-index: 2000;
    transition: transform 0.3s ease;
    white-space: nowrap;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 500px) {
    .metrics {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .metric {
        padding: 14px 10px;
    }

    .metric .val {
        font-size: 24px;
    }

    .queue-card {
        grid-template-columns: 50px 1fr;
        gap: 12px;
    }

    .qc-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }

    .big-number {
        font-size: 60px;
    }

    .est-box {
        padding: 8px 14px;
    }

    .est-box .num {
        font-size: 20px;
    }

    .est-box .lbl {
        font-size: 9px;
    }
}