/* Interlude admin — brand palette mirrors interlude-web's globals.css (identity v1.0). */
@font-face { font-family: "PT Sans Caption"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/pt-sans-caption-400.woff2") format("woff2"); }
@font-face { font-family: "Tajawal"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/tajawal-400-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Tajawal"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/tajawal-700-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "PT Sans Caption"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/pt-sans-caption-700.woff2") format("woff2"); }
:root {
    --brand: #ef4c23;
    --brand-dark: #c93a14;
    --brand-soft: #fde8e0;
    --ink: #282827;
    --muted: #6b6a66;
    --line: #eadfd3;
    --canvas: #faf5ef;
    --surface: #fff;
    --sidebar: #282827;
    --good: #0f7a4d;
    --good-bg: #e3f5ec;
    --warn: #8a5a00;
    --warn-bg: #fff3d6;
    --bad: #a3262e;
    --bad-bg: #fde6e7;
    --bs-primary: var(--brand);
    --bs-primary-rgb: 239, 76, 35;
    --bs-link-color: var(--brand-dark);
    --bs-link-color-rgb: 201, 58, 20;
    --bs-link-hover-color: var(--brand);
}

html, body { background: var(--canvas); color: var(--ink); font-size: 14px; }
body { font-family: "PT Sans Caption", "Tajawal", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", Tahoma, sans-serif; }
[dir="rtl"] { font-family: "Tajawal", "PT Sans Caption", "Noto Sans Arabic", Tahoma, system-ui, sans-serif; }

/* ---- dark theme (Bootstrap 5.3 data-bs-theme + our tokens) ---------------- */
[data-bs-theme="dark"] {
    --canvas: #1b1a19; --surface: #262524; --ink: #f4ede6; --muted: #aaa49b; --line: #3b3936; --sidebar: #121211;
    --brand-dark: #ff7a55; --brand-soft: #3b2219;
    --good: #5fd39b; --good-bg: #173a2b; --warn: #f0c36a; --warn-bg: #3d3216; --bad: #ff8f95; --bad-bg: #432024;
    --bs-link-color-rgb: 255, 122, 85; --bs-link-hover-color: #ef4c23;
    --bs-body-bg: var(--canvas); --bs-body-color: var(--ink); --bs-border-color: var(--line);
}
[data-bs-theme="dark"] .table-card th { background: #2d2c2a; }
[data-bs-theme="dark"] .badge-muted, [data-bs-theme="dark"] .seat-bar { background: #34322f; }
[data-bs-theme="dark"] .media-tile, [data-bs-theme="dark"] .media-picked .media-file { background: #302e2c; }
[data-bs-theme="dark"] .md-preview, [data-bs-theme="dark"] .json-view, [data-bs-theme="dark"] .email-preview { background: #1f1e1d; }
[data-bs-theme="dark"] .topbar { background: var(--surface); }
[data-bs-theme="dark"] .login-card { box-shadow: 0 20px 50px rgba(0,0,0,.6); }
[data-bs-theme="dark"] .brand img[src$="interlude-full-light.svg"] { filter: none; }

/* theme toggle */
.theme-toggle { margin-inline: 12px 0; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; width: 34px; height: 30px; line-height: 1; cursor: pointer; }
.theme-toggle:hover { border-color: var(--brand); }
.theme-toggle .t-light { display: none; }
[data-bs-theme="dark"] .theme-toggle .t-light { display: inline; }
[data-bs-theme="dark"] .theme-toggle .t-dark { display: none; }

.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand-dark); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand-dark); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(239, 76, 35, .18); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* ---- shell --------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--sidebar); color: #e4dcd2; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px 32px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 20px; text-decoration: none; padding: 4px 10px 18px; letter-spacing: .2px; }
.brand img { height: 34px; width: auto; }
.brand span { font-weight: 400; color: #f7e9dd; font-size: 14px; margin-inline-start: 4px; }
.nav-groups { display: flex; flex-direction: column; gap: 1px; }
.nav-group { text-transform: uppercase; font-size: 11px; letter-spacing: .08em; color: #a39d94; padding: 16px 10px 6px; }
.nav-item { display: block; color: #efe7dd; text-decoration: none; padding: 7px 10px; border-radius: 6px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; height: 56px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-user { text-decoration: none; color: var(--ink); text-align: end; line-height: 1.1; }
.topbar-user small { display: block; color: var(--muted); font-size: 11px; }
.content { padding: 24px 28px 64px; max-width: 1280px; width: 100%; }

@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .content { padding: 16px; }
}

/* ---- page chrome ------------------------------------------------------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-header h1 { font-size: 24px; font-weight: 650; margin: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-block; font-size: 13px; color: var(--muted); text-decoration: none; margin-bottom: 4px; }
.back-link:hover { color: var(--brand); }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search-input { max-width: 280px; }
.w-40 { width: 40%; }

.table-card, .form-card, .card-plain { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.form-card, .card-plain { padding: 20px; margin-bottom: 18px; }
.table-card { overflow-x: auto; }
.table-card .table { --bs-table-bg: transparent; }
.table-card th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fbf6f0; white-space: nowrap; }
.table-card td, .table-card th { padding: 10px 14px; }
tr.clickable { cursor: pointer; }
.section-title { font-size: 15px; font-weight: 650; margin: 0 0 12px; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; padding: 36px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; word-break: break-word; }

/* ---- badges -------------------------------------------------------------- */
.badge-status { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-muted { background: #f3ece4; color: var(--muted); }

/* ---- dashboard ----------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; text-decoration: none; color: inherit; display: block; }
.stat:hover { border-color: var(--brand); }
.stat .value { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat.alert-stat .value { color: var(--bad); }
.seat-bar { height: 6px; border-radius: 3px; background: #f3ece4; overflow: hidden; min-width: 90px; }
.seat-bar > span { display: block; height: 100%; background: var(--brand); }
.seat-bar.full > span { background: var(--bad); }

/* ---- media --------------------------------------------------------------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.media-tile { position: relative; border: 2px solid transparent; border-radius: 8px; padding: 0; background: #f3ece4; overflow: hidden; aspect-ratio: 4 / 3; cursor: pointer; }
.media-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.media-name { position: absolute; inset-inline: 0; bottom: 0; font-size: 11px; color: #fff; background: rgba(0,0,0,.5); padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: start; }
.media-file { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 80px; color: var(--muted); font-weight: 600; }
.media-picked img { max-width: 220px; max-height: 150px; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; }
.media-picked .media-file { width: 220px; background: #f3ece4; border-radius: 8px; }
.gallery-strip { display: flex; flex-wrap: wrap; gap: 10px; }
.gallery-strip .item { width: 150px; }
.gallery-strip img { width: 150px; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* ---- markdown ------------------------------------------------------------ */
.md-tabs { display: flex; gap: 4px; align-items: center; margin-bottom: 6px; }
.md-tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 2px 10px; font-size: 13px; }
.md-tabs button.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.md-preview { border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; min-height: 120px; background: #fffcf9; }
.md-preview h1, .md-preview h2, .md-preview h3 { font-size: 1.15rem; margin-top: .6rem; }

/* ---- toasts & login -------------------------------------------------------- */
.toast-stack { position: fixed; top: 70px; inset-inline-end: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast-item { display: flex; gap: 12px; align-items: center; min-width: 260px; max-width: 420px; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); background: var(--surface); border-inline-start: 4px solid var(--brand); }
.toast-danger { border-inline-start-color: var(--bad); }
.toast-item span { flex: 1; }
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--sidebar), #3a2018); padding: 16px; }
.login-card { background: var(--surface); width: 100%; max-width: 380px; border-radius: 14px; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-brand img { height: 48px; width: auto; }
.login-brand { color: var(--brand); font-weight: 800; font-size: 22px; margin-bottom: 18px; }

.row-editor td { vertical-align: top; }
.row-editor .form-control, .row-editor .form-select { min-width: 90px; }
.json-view { background: #faf5ef; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 12px; max-height: 360px; overflow: auto; }

#blazor-error-ui { background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); display: none; inset-inline-start: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; inset-inline-end: 0.75rem; top: 0.5rem; }
.blazor-error-boundary { background: var(--bad-bg); padding: 1rem; color: var(--bad); border-radius: 8px; }
.blazor-error-boundary::after { content: "Something went wrong on this page."; }
h1:focus, h1:focus-visible { outline: none; }
.nav-tabs .nav-link { color: var(--muted); }
.nav-tabs .nav-link.active { color: var(--brand-dark); font-weight: 600; }
.lang-tag { display: inline-block; font-size: 11px; font-weight: 700; color: var(--brand-dark); background: var(--brand-soft); border-radius: 4px; padding: 0 6px; margin-inline-end: 6px; }
.msg-list { list-style: none; margin: 0; padding: 0; }
.msg-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.msg-list li:last-child { border-bottom: 0; }
.msg-channel { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--brand-dark); background: var(--brand-soft); border-radius: 4px; padding: 1px 6px; }

/* ---- money ------------------------------------------------------------------ */
/* Amounts never wrap between symbol and number. The Saudi Riyal sign is an
   inline SVG (few fonts carry U+20C1 yet), sized and coloured like text. */
.money { white-space: nowrap; }
.riyal-sign { height: 0.85em; width: auto; vertical-align: -0.08em; }

/* ---- notification settings --------------------------------------------------- */
.email-preview { display: block; width: 100%; height: 820px; border: 0; background: #f3ece4; }
.stat[role=button] { cursor: pointer; }
.list-group-item.active { background: var(--brand); border-color: var(--brand); }
.logo-on-dark { display: none; }
[data-bs-theme="dark"] .logo-on-light { display: none; }
[data-bs-theme="dark"] .logo-on-dark { display: inline; }

/* ---- language switch + RTL ------------------------------------------------ */
.lang-toggle { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 14px; text-decoration: none; margin-inline-start: 12px; }
.lang-toggle:hover { border-color: var(--brand); color: var(--ink); }
.login-lang { position: absolute; top: 16px; inset-inline-end: 16px; }
.login-shell { position: relative; }
/* The brand font has no Arabic glyphs; Tajawal (loaded above) takes over for Arabic text, and leads the stack in RTL pages. */
[dir="rtl"] body { font-family: "Tajawal", "PT Sans Caption", system-ui, "Segoe UI", Tahoma, sans-serif; }
[dir="rtl"] .back-link { display: inline-block; }
/* Codes, URLs, e-mail addresses and numbers keep reading left to right inside Arabic text. */
[dir="rtl"] input[dir="ltr"], [dir="rtl"] textarea[dir="ltr"], [dir="rtl"] .font-monospace, [dir="rtl"] code { direction: ltr; text-align: left; }
[dir="rtl"] .pagination, [dir="rtl"] .btn-group { direction: rtl; }
