/* YallaGooo — dark mode for the portal and the admin panel.
   Turned on by <html data-theme="dark">: set in <head> from the saved choice, otherwise from the system setting. */

:root[data-theme="dark"] {
    color-scheme: dark;
    --ink: #F3E9EC; --ink-2: #D6C6CB; --muted: #A3929A; --line: #3A2C32; --bg: #161114; --card: #221A1E;
    --side: #0F0B0D;
    --red-50: #33191F; --red-100: #45202A; --red-200: #5C2A38; --red-700: #FF9CAA; --red-900: #FFD9DE;
    --ok: #4CC38A; --warn: #E2A84B; --info: #74A8EA;
    --shadow: 0 4px 18px rgba(0, 0, 0, .35);
}

[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
[data-theme="dark"] a { color: #FF8A9B; }
[data-theme="dark"] .topbar { background: rgba(22, 17, 20, .92); }

/* surfaces that used plain white */
[data-theme="dark"] .btn, [data-theme="dark"] .empty, [data-theme="dark"] .kpi, [data-theme="dark"] .seg label,
[data-theme="dark"] .chip span, [data-theme="dark"] .tabs a, [data-theme="dark"] .order-card, [data-theme="dark"] .captain-row,
[data-theme="dark"] .auth-card, [data-theme="dark"] .login-card, [data-theme="dark"] .role-choice, [data-theme="dark"] .notif,
[data-theme="dark"] .toast, [data-theme="dark"] dialog.modal, [data-theme="dark"] .ob-ic, [data-theme="dark"] .map-side button,
[data-theme="dark"] .doc-card, [data-theme="dark"] .map-modes span, [data-theme="dark"] .rating-picker span,
[data-theme="dark"] .rich-editor, [data-theme="dark"] .img-drop img, [data-theme="dark"] .ad-stats > div,
[data-theme="dark"] .table, [data-theme="dark"] .row-card, [data-theme="dark"] .msg, [data-theme="dark"] .media-item,
[data-theme="dark"] .team-tile, [data-theme="dark"] .type-card, [data-theme="dark"] .placement, [data-theme="dark"] .icon-preview,
[data-theme="dark"] details.more > div, [data-theme="dark"] .icon-btn {
    background: var(--card); color: var(--ink);
}
[data-theme="dark"] .item-row, [data-theme="dark"] .logo-prev { background: #2A2025; }
[data-theme="dark"] .btn.primary { background: var(--grad); color: #fff; border-color: transparent; }
[data-theme="dark"] .btn.danger, [data-theme="dark"] .icon-btn.danger:hover { background: #3A1C20; color: #FF9A92; border-color: #5C2A2E; }
[data-theme="dark"] .btn.wa { background: #132C24; color: #6FE0A6; border-color: #22503E; }
[data-theme="dark"] .tabs a.active { background: var(--grad); color: #fff; }
[data-theme="dark"] .table th { background: #2A2025; }
[data-theme="dark"] input[type=text], [data-theme="dark"] input:not([type]), [data-theme="dark"] input[type=number],
[data-theme="dark"] input[type=email], [data-theme="dark"] input[type=password], [data-theme="dark"] input[type=date],
[data-theme="dark"] input[type=datetime-local], [data-theme="dark"] input[type=time], [data-theme="dark"] input[type=url],
[data-theme="dark"] input[type=file], [data-theme="dark"] select, [data-theme="dark"] textarea {
    background: #1B1418; color: var(--ink); border-color: var(--line);
}
[data-theme="dark"] input:focus, [data-theme="dark"] select:focus, [data-theme="dark"] textarea:focus { background: #201719; }
[data-theme="dark"] .switch i { background: #3E2F35; }
[data-theme="dark"] .pl-art { background: #2A2025; border-color: var(--line); }

/* messages & pills */
[data-theme="dark"] .flash.ok { background: #132C24; color: #8BE3B5; }
[data-theme="dark"] .flash.err { background: #3A1C20; color: #FF9A92; }
[data-theme="dark"] .flash.warn, [data-theme="dark"] .note { background: #33280F; color: #F2C877; border-color: #54431C; }
[data-theme="dark"] .pill.amber, [data-theme="dark"] .doc-status .warn, [data-theme="dark"] .day-steps li.amber .ds-ic { background: #33280F; color: #F2C877; }
[data-theme="dark"] .pill.blue, [data-theme="dark"] .day-steps li.blue .ds-ic { background: #172A40; color: #8FBDF2; }
[data-theme="dark"] .pill.red, [data-theme="dark"] .day-steps li.red .ds-ic, [data-theme="dark"] .doc-status .bad { background: var(--red-100); color: #FF9CAA; }
[data-theme="dark"] .pill.green, [data-theme="dark"] .doc-status .ok, [data-theme="dark"] .day-steps li.green .ds-ic { background: #132C24; color: #7FD9A8; }
[data-theme="dark"] .pill.grey, [data-theme="dark"] .doc-status span, [data-theme="dark"] .day-steps .ds-ic, [data-theme="dark"] .pick-state span { background: #2C2327; color: var(--muted); }

/* portal specifics */
[data-theme="dark"] .online-bar { background: #241B1F; }
[data-theme="dark"] .online-bar.on { background: linear-gradient(135deg, #12291F, #172B23); border-color: #22503E; }
[data-theme="dark"] .approval-box { background: #14243A; border-color: #2A4A70; }
[data-theme="dark"] .loc-request { background: #2E2614; border-color: #6B5320; }
[data-theme="dark"] .loc-request.ok { background: #12291C; border-color: #255C3C; color: #7FD8A4; }
[data-theme="dark"] .notif.unread { background: #2C1A20; border-color: var(--red-200); }
[data-theme="dark"] .doc-pick { background: #1E1619; border-color: var(--red-200); }
[data-theme="dark"] .doc-card .doc-img, [data-theme="dark"] .avatar.img { background: #2C2327; }
[data-theme="dark"] .dl-track, [data-theme="dark"] .bar > span:nth-child(2) { background: #2C2327; }
[data-theme="dark"] .pending-ic { background: #172A40; }
[data-theme="dark"] .pending-ic.rej { background: var(--red-100); }
[data-theme="dark"] .policies-check { background: var(--red-50); }
[data-theme="dark"] .presence, [data-theme="dark"] .dl-trip { border-color: var(--card); box-shadow: 0 0 0 1.5px var(--card); }
[data-theme="dark"] .live-dot { background: #4A3A40; }
[data-theme="dark"] .day-hero { background: linear-gradient(135deg, #8E2337, #5E1A2C); }
[data-theme="dark"] .auth-side { background: linear-gradient(160deg, #8E2337, #3A1019); }

/* maps: dark tiles, dark popups */
[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.6); }
[data-theme="dark"] .leaflet-container { background: #1B1418; }
[data-theme="dark"] .leaflet-popup-content-wrapper, [data-theme="dark"] .leaflet-popup-tip { background: var(--card); color: var(--ink); }
[data-theme="dark"] .leaflet-control-zoom a, [data-theme="dark"] .leaflet-control-attribution { background: var(--card) !important; color: var(--ink) !important; }

/* theme switch button in the top bar */
.theme-toggle { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); cursor: pointer; }
.theme-toggle:hover { border-color: var(--red-300); }
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: inline; }
.auth-main { position: relative; }
.auth-theme { position: absolute; top: 18px; left: 18px; }
.auth-help { position: absolute; top: 18px; left: 66px; display: inline-grid; place-items: center; color: var(--red-600); }
