/* =====================================================================
   DepEd Leyte Division — Queueing Management System
   Global stylesheet
   ===================================================================== */

:root {
    --primary: #02542D;
    --primary-dark: #013A1F;
    --primary-light: #0A7040;
    --background: #F5F7F6;
    --surface: #FFFFFF;
    --text: #17201B;
    --muted: #6B756F;
    --border: #E2E8E4;

    --warning: #B5750A;
    --danger: #A3281F;
    --success: #0A7040;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;

    --shadow-sm: 0 1px 3px rgba(2, 84, 45, 0.08);
    --shadow-md: 0 6px 20px rgba(2, 84, 45, 0.10);

    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--background);
    color: var(--text);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 0.5em; font-weight: 700; letter-spacing: -0.01em; }

a { color: var(--primary); }

/* ---- Top bar ---------------------------------------------------- */
.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary);
    color: #fff;
    padding: 14px 24px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 20;
}
.app-topbar__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.app-topbar__logo { font-size: 22px; }
.app-topbar__title { font-size: 16px; }
.app-topbar__user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.app-topbar__name { font-weight: 600; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge--role { background: rgba(255,255,255,0.18); color: #fff; }
.badge--waiting  { background: #FFF3D9; color: #8A5A00; }
.badge--called   { background: #DCEEFF; color: #0B4B8A; }
.badge--serving  { background: #E1F2E8; color: #0A7040; }
.badge--completed{ background: #E7EDEA; color: #3E4A44; }
.badge--skipped  { background: #FBE3E1; color: #A3281F; }
.badge--cancelled{ background: #ECECEC; color: #6B756F; }
.badge--transferred { background: #EFE3FB; color: #5B2C9E; }

/* ---- Layout ------------------------------------------------------ */
.app-main { max-width: 1200px; margin: 0 auto; padding: 28px 24px 60px; }
.app-footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.grid { display: grid; gap: 20px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
    .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* ---- Buttons ------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.05s ease, filter 0.15s ease;
    text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--secondary { background: var(--primary-light); color: #fff; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--warning { background: var(--warning); color: #fff; }
.btn--ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.5); }
.btn--outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn--lg { padding: 22px 28px; font-size: 20px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Forms --------------------------------------------------------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], select, textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 84, 45, 0.15);
}
.form-group { margin-bottom: 18px; }

/* ---- Front desk transaction tiles ---------------------------------- */
.tx-tile {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.1s ease;
}
.tx-tile:hover { border-color: var(--primary-light); }
.tx-tile.is-selected { border-color: var(--primary); background: #F0F7F3; }
.tx-tile__label { font-size: 18px; font-weight: 700; color: var(--primary-dark); margin-bottom: 6px; }
.tx-tile__range { font-family: var(--font-mono); color: var(--muted); font-size: 14px; }

/* ---- Window operator screen ----------------------------------------- */
.window-panel { text-align: center; }
.window-panel__heading { font-size: 15px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.window-panel__number {
    font-family: var(--font-mono);
    font-size: 96px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
    margin: 14px 0;
    font-variant-numeric: tabular-nums;
}
.window-panel__actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 24px; }
@media (max-width: 560px) { .window-panel__actions { grid-template-columns: 1fr; } }

/* ---- Public display ---------------------------------------------------- */
.display-page {
    background: var(--primary-dark);
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-ui);
    overflow: hidden;
}
.display-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    border-bottom: 2px solid rgba(255,255,255,0.15);
}
.display-header__title { font-size: 24px; font-weight: 700; letter-spacing: 0.03em; }
.display-header__subtitle { font-size: 14px; opacity: 0.75; margin-top: 2px; }
.display-header__clock { text-align: right; font-variant-numeric: tabular-nums; }
.display-header__date { font-size: 15px; opacity: 0.85; }
.display-header__time { font-size: 26px; font-weight: 700; letter-spacing: 0.02em; }

.display-splitrow {
    display: flex;
    align-items: stretch;
    border-bottom: 2px solid rgba(255,255,255,0.15);
    height: 480px;
}
.display-hero, .display-video-half {
    flex: 1 1 50%;
    width: 50%;
    height: 480px;
}

.display-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
    border-right: 2px solid rgba(255,255,255,0.15);
}
.display-hero__label { font-size: 18px; letter-spacing: 0.15em; opacity: 0.8; text-transform: uppercase; }
.display-hero__number {
    font-family: var(--font-mono);
    font-size: 10vw;
    line-height: 1;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    margin: 6px 0;
    transition: transform 0.25s ease;
}
.display-hero__number.is-flash { animation: flashScale 0.9s ease; }
@keyframes flashScale {
    0% { transform: scale(1); }
    25% { transform: scale(1.08); color: #FFD873; }
    100% { transform: scale(1); }
}
.display-hero__window { font-size: 24px; font-weight: 700; opacity: 0.95; }

.display-video-half {
    background: #000;
    position: relative;
    overflow: hidden;
}
.display-video-half iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 0;
    display: block;
    transform: translate(-50%, -50%);
}

.display-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    background: rgba(255,255,255,0.15);
}
@media (min-width: 1400px) { .display-grid { grid-template-columns: repeat(6, 1fr); } }
.display-cell {
    background: var(--primary-dark);
    padding: 16px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.display-cell__window { font-size: 15px; letter-spacing: 0.08em; opacity: 0.75; text-transform: uppercase; }
.display-cell__number { font-family: var(--font-mono); font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; }
.display-cell__queue { font-size: 12px; opacity: 0.7; }
.display-cell--idle { opacity: 0.5; }
.display-cell__next {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.15);
    font-size: 12px;
    opacity: 0.75;
}
.display-cell__next-label { letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; margin-bottom: 3px; }
.display-cell__next-numbers { font-family: var(--font-mono); font-size: 15px; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
    .display-splitrow { flex-direction: column; }
    .display-hero, .display-video-half { width: 100%; flex-basis: auto; }
    .display-hero { border-right: none; border-bottom: 2px solid rgba(255,255,255,0.15); }
}


/* ---- Tables --------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: #FAFBFA; }

/* ---- Stat cards ------------------------------------------------------ */
.stat-card { text-align: center; }
.stat-card__value { font-size: 40px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.stat-card__label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }

/* ---- Alerts ------------------------------------------------------------ */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.alert--error { background: #FBE3E1; color: #A3281F; }
.alert--success { background: #E1F2E8; color: #0A7040; }
.alert--info { background: #DCEEFF; color: #0B4B8A; }

/* ---- Login page --------------------------------------------------------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--background); padding: 20px; }
.login-card { width: 100%; max-width: 400px; }
.login-card__logo { text-align: center; font-size: 40px; margin-bottom: 10px; }
.login-card__title { text-align: center; font-size: 18px; margin-bottom: 24px; color: var(--primary-dark); }

.utility-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-title { font-size: 20px; font-weight: 700; color: var(--primary-dark); margin-bottom: 16px; }
.tag-list { display: flex; gap: 8px; flex-wrap: wrap; }

.sidebar-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 24px; }
.sidebar-nav a {
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.sidebar-nav a.is-active, .sidebar-nav a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
