/* =====================================================================
   AUC Smart Queue — Unified visual identity (AUC Navy & Gold)
   Works in English (LTR) and Arabic (RTL) — logical properties only
   ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=Cormorant+Garamond:wght@600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
    --navy: #0A1C52;
    --navy-deep: #06123A;
    --navy-soft: #1D3271;
    --navy-tint: #E8ECF6;
    --gold: #B37028;
    --gold-light: #D4A25E;
    --gold-pale: #F6EDE0;
    --ivory: #FAF7F2;

    --bg: var(--ivory);
    --surface: #FFFFFF;
    --surface-2: #F4F1EA;
    --line: #E4DED2;
    --line-strong: #CFC6B5;
    --text: #0E1633;
    --text-2: #4A5270;
    --text-3: #7B8199;

    --ok: #1F7A4D;   --ok-bg: #E7F4EC;
    --warn: #B37028; --warn-bg: #FBF0E1;
    --bad: #B42318;  --bad-bg: #FDECEA;
    --info: #1D3271; --info-bg: #E8ECF6;

    --radius: 14px;
    --radius-lg: 20px;
    --shadow: 0 1px 2px rgba(10, 28, 82, .05), 0 6px 18px rgba(10, 28, 82, .06);
    --shadow-lg: 0 18px 50px rgba(6, 18, 58, .16);

    --font: 'Manrope', 'IBM Plex Sans Arabic', 'Segoe UI', sans-serif;
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-num: 'Manrope', 'IBM Plex Sans Arabic', sans-serif;

    --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23B37028' stroke-opacity='.09' stroke-width='1'%3E%3Cpath d='M32 4 L60 32 L32 60 L4 32 Z'/%3E%3Cpath d='M32 16 L48 32 L32 48 L16 32 Z'/%3E%3Cpath d='M0 0 L16 16 M64 0 L48 16 M0 64 L16 48 M64 64 L48 48'/%3E%3C/g%3E%3C/svg%3E");
    color-scheme: light;
}
:root[lang="ar"] { --font: 'IBM Plex Sans Arabic', 'Manrope', 'Segoe UI', Tahoma, sans-serif; }

:root[data-theme="dark"] {
    --bg: #070E26;
    --surface: #0F1A3D;
    --surface-2: #142250;
    --line: #22306A;
    --line-strong: #2E3E80;
    --text: #EEF1FA;
    --text-2: #B4BCD6;
    --text-3: #8890AE;
    --navy-tint: #18275A;
    --gold-pale: #2A2318;
    --ok-bg: #0E2E22; --warn-bg: #2E2414; --bad-bg: #351616; --info-bg: #17255A;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 22px rgba(0,0,0,.28);
    color-scheme: dark;
}

/* hide content until Arabic translation is applied (no flash) */
html.i18n-pending body { opacity: 0; }
/* protected screens stay hidden until the sign-in is confirmed (no flash of inside screens) */
html.auth-pending body > * { visibility: hidden !important; }
html.auth-pending body { background: #0A1C52 !important; min-height: 100vh; }
html.auth-pending body::after { content: ''; position: fixed; inset: 0; margin: auto; width: 64px; height: 64px; background: url(assets/emblem.png) center / contain no-repeat; animation: auc-auth-spin 1.4s linear infinite; }
@keyframes auc-auth-spin { to { transform: rotate(360deg); } }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    background-image: var(--pattern);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    transition: opacity .25s;
    overflow-x: hidden;
}
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.en, .serif { font-family: var(--font-serif); letter-spacing: .3px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.hidden { display: none !important; }
.muted { color: var(--text-3); }

/* ---------- Top bar ---------- */
.auc-topbar {
    background: var(--navy); color: #fff; border-bottom: 3px solid var(--gold);
    padding: 10px clamp(12px, 2.5vw, 28px);
    display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap;
    position: sticky; top: 0; z-index: 50; box-shadow: 0 6px 24px rgba(6, 18, 58, .25);
}
.auc-brand { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1 1 auto; }
.auc-brand img { height: 46px; width: auto; flex-shrink: 0; }
.auc-brand .divider { width: 1px; height: 34px; background: rgba(255,255,255,.22); flex-shrink: 0; }
.auc-brand .titles { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.auc-brand .t1 { font-weight: 700; font-size: clamp(15px, 1.6vw, 19px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auc-brand .t2 { font-family: var(--font-serif); color: var(--gold-light); font-size: 14px; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.top-btn {
    background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.18);
    padding: 8px 13px; border-radius: 10px; font-size: 13.5px; font-weight: 600; cursor: pointer;
    text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: .2s; white-space: nowrap; min-height: 38px;
}
.top-btn:hover { background: rgba(255,255,255,.16); border-color: var(--gold-light); }
.top-btn.gold { background: var(--gold); border-color: var(--gold); }
.top-btn.lang { border-color: rgba(212,162,94,.6); color: #F3E4CF; }
.top-btn.danger { background: rgba(180,35,24,.25); border-color: rgba(255,160,150,.4); }
select.top-btn option { color: #000; }

.conn-pill {
    display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600;
    padding: 5px 12px; border-radius: 99px; background: rgba(31,122,77,.22); color: #B9F0D1; border: 1px solid rgba(185,240,209,.35); white-space: nowrap;
}
.conn-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #3DDC84; box-shadow: 0 0 8px #3DDC84; }
.conn-pill.offline { background: rgba(180,35,24,.25); color: #FFC9C3; border-color: rgba(255,201,195,.35); }
.conn-pill.offline::before { background: #FF6B5E; box-shadow: none; }
.topbar-clock { font-family: var(--font-num); font-weight: 700; color: var(--gold-light); background: rgba(0,0,0,.18); padding: 6px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); direction: ltr; white-space: nowrap; }

/* ---------- Layout ---------- */
.page { width: min(100% - 24px, 1680px); margin: 18px auto 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card.accent { border-top: 4px solid var(--gold); }
.card.navy-accent { border-top: 4px solid var(--navy); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 17px; font-weight: 700; color: var(--text); margin: 26px 0 12px; }
.section-title > span:first-child { display: inline-flex; align-items: center; gap: 10px; }
.section-title > span:first-child::before { content: ''; width: 5px; height: 22px; background: var(--gold); border-radius: 3px; }
.section-title small { font-family: var(--font-serif); color: var(--gold); font-size: 15px; font-weight: 700; unicode-bidi: isolate; }
.grid { display: grid; gap: 14px; }

/* ---------- Buttons ---------- */
.btn {
    border: none; border-radius: 12px; padding: 12px 16px; font-size: 15px; font-weight: 700; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: .2s; text-decoration: none; line-height: 1.25; min-height: 42px; text-align: center;
}
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }
.btn:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn:not(:disabled):active { transform: translateY(0) scale(.99); }
.btn-navy { background: var(--navy); color: #fff; box-shadow: 0 6px 16px rgba(10,28,82,.22); }
:root[data-theme="dark"] .btn-navy { background: #2A3F8F; }
.btn-gold { background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: #fff; box-shadow: 0 6px 16px rgba(179,112,40,.28); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-bad { background: var(--bad); color: #fff; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
:root[data-theme="dark"] .btn-outline { color: var(--gold-light); border-color: var(--gold-light); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 18px; font-size: 17px; }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 9px; min-height: 34px; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .select, textarea.input {
    width: 100%; padding: 11px 13px; border-radius: 11px; border: 1.5px solid var(--line-strong);
    background: var(--surface); color: var(--text); font-size: 16px; font-weight: 500; outline: none; transition: .2s; min-height: 44px;
}
.input:focus, .select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(179,112,40,.15); }
.input.ok { border-color: var(--ok); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text-2); padding: 7px 11px; border-radius: 99px; font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s; min-height: 34px; }
.seg button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
:root[data-theme="dark"] .seg button.active { background: var(--gold); border-color: var(--gold); }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.gold { background: var(--gold-pale); color: var(--gold); border-color: rgba(179,112,40,.3); }
.chip.navy { background: var(--navy-tint); color: var(--navy); border-color: rgba(10,28,82,.15); }
:root[data-theme="dark"] .chip.navy { color: #C9D3F5; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.st-waiting { background: var(--info-bg); color: var(--info); }
.st-serving { background: var(--gold-pale); color: var(--gold); }
.st-done { background: var(--ok-bg); color: var(--ok); }
.st-noshow { background: var(--bad-bg); color: var(--bad); }
.st-transfer { background: var(--surface-2); color: var(--text-2); }
:root[data-theme="dark"] .st-waiting { color: #C9D3F5; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-open { background: #2FB673; box-shadow: 0 0 0 3px rgba(47,182,115,.18); }
.status-break { background: #E0A040; box-shadow: 0 0 0 3px rgba(224,160,64,.18); }
.status-closed { background: #C0392B; box-shadow: 0 0 0 3px rgba(192,57,43,.18); }

/* ---------- KPIs ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; min-width: 0; }
.kpi::after { content: ''; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--kpi-c, var(--navy)); }
.kpi .k-label { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font-family: var(--font-num); font-weight: 800; font-size: 34px; line-height: 1.15; margin-top: 6px; color: var(--kpi-c, var(--text)); }
.kpi .k-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 760px; }
.tbl th { background: var(--navy); color: #fff; font-weight: 600; font-size: 13.5px; padding: 12px; text-align: center; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: start; padding-inline-start: 18px; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); text-align: center; font-size: 14px; vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr.prio td { background: var(--gold-pale); }

/* ---------- Lock overlay ---------- */
#auc-block-overlay { position: fixed; inset: 0; z-index: 99999; background: rgba(6,18,58,.92); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.auc-block-card { background: var(--surface); color: var(--text); border-top: 5px solid var(--gold); border-radius: 22px; padding: 34px 30px; max-width: 460px; width: 100%; text-align: center; box-shadow: var(--shadow-lg); }
.auc-block-emblem { width: 70px; margin-bottom: 10px; }
.auc-block-title { font-size: 24px; font-weight: 700; color: var(--bad); margin-bottom: 8px; }
.auc-block-text { font-size: 15px; color: var(--text-2); line-height: 1.7; }
.auc-block-sub { font-family: var(--font-serif); color: var(--gold); margin-top: 16px; font-size: 14px; }

/* ---------- Developer signature (centered on every screen) ---------- */
.dev-signature {
    display: block; width: fit-content; max-width: calc(100% - 24px); margin: 20px auto 18px; padding: 8px 18px;
    text-align: center; font-family: 'Manrope', sans-serif; font-size: 13px; font-weight: 600; color: var(--text-2);
    direction: ltr; unicode-bidi: isolate; letter-spacing: .2px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 99px; box-shadow: var(--shadow);
}
.dev-signature b { color: var(--gold); font-weight: 800; }
.dev-signature.on-dark { background: rgba(255,255,255,.07); border-color: rgba(212,162,94,.35); color: #C9D1EA; box-shadow: none; }
.dev-signature.on-dark b { color: var(--gold-light); }

/* ---------- Demo ribbon ---------- */
.demo-ribbon {
    display: block; text-align: center; text-decoration: none; position: relative; z-index: 60;
    background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold)); color: #fff; font-weight: 800; font-size: 12.5px;
    padding: 5px 12px; letter-spacing: .4px;
}
.demo-ribbon::after { content: '  ↩'; opacity: .8; }

/* ---------- SweetAlert2 ---------- */
.swal2-popup { font-family: var(--font) !important; border-radius: 18px !important; max-width: calc(100vw - 24px) !important; }
.swal2-title { color: var(--navy) !important; font-weight: 700 !important; }
.swal2-confirm { background: var(--navy) !important; border-radius: 10px !important; font-weight: 700 !important; }
.swal2-cancel { border-radius: 10px !important; font-weight: 600 !important; }
.swal2-input, .swal2-select, .swal2-textarea { font-family: var(--font) !important; border-radius: 10px !important; max-width: calc(100% - 2em) !important; }
:root[data-theme="dark"] .swal2-popup { background: var(--surface) !important; color: var(--text) !important; }
:root[data-theme="dark"] .swal2-title { color: var(--gold-light) !important; }
:root[data-theme="dark"] .swal2-html-container { color: var(--text-2) !important; }

/* ---------- Misc ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
.kbd { font-family: var(--font-num); font-size: 11px; border: 1px solid var(--line-strong); border-bottom-width: 2px; padding: 0 5px; border-radius: 5px; color: var(--text-3); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .auc-brand .divider, .auc-brand .t2 { display: none; }
    .topbar-clock { display: none; }
}
@media (max-width: 640px) {
    .auc-topbar { padding: 8px 10px; }
    .auc-brand img { height: 34px; }
    .auc-brand .t1 { font-size: 15px; }
    .auc-actions { width: 100%; justify-content: flex-start; }
    .top-btn { padding: 7px 10px; font-size: 12.5px; min-height: 36px; }
    .conn-pill { display: none; }
    .kpi .k-value { font-size: 26px; }
    .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 12px 14px; }
    .page { width: calc(100% - 16px); margin-top: 12px; }
    .card { padding: 14px; border-radius: 16px; }
    .section-title { font-size: 16px; margin: 20px 0 10px; }
    .dev-signature { font-size: 11.5px; padding: 7px 14px; }
}
