/* Interlude admin — brand palette mirrors interlude-web's globals.css. */
:root {
    --brand: #078d89;
    --brand-dark: #056d6a;
    --brand-soft: #dff5f4;
    --ink: #202325;
    --muted: #676d70;
    --line: #e7e9ea;
    --canvas: #f5f7f7;
    --sidebar: #172426;
    --good: #0f7a4d;
    --good-bg: #e3f5ec;
    --warn: #8a5a00;
    --warn-bg: #fff3d6;
    --bad: #a3262e;
    --bad-bg: #fde6e7;
    --bs-primary: var(--brand);
    --bs-primary-rgb: 7, 141, 137;
    --bs-link-color: var(--brand-dark);
    --bs-link-color-rgb: 5, 109, 106;
    --bs-link-hover-color: var(--brand);
}

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

.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(7, 141, 137, .15); }
.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: #cfd8d8; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px 32px; }
.brand { display: block; color: #fff; font-weight: 700; font-size: 20px; text-decoration: none; padding: 4px 10px 18px; letter-spacing: .2px; }
.brand span { font-weight: 400; color: #8fb5b3; font-size: 14px; margin-left: 4px; }
.nav-groups { display: flex; flex-direction: column; gap: 1px; }
.nav-group { text-transform: uppercase; font-size: 11px; letter-spacing: .08em; color: #7f9a99; padding: 16px 10px 6px; }
.nav-item { display: block; color: #d6e2e1; 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: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-user { text-decoration: none; color: var(--ink); text-align: right; 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: #fff; 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: #fafbfb; 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: #fff; 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: #eef0f0; color: var(--muted); }

/* ---- dashboard ----------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; 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: #eef0f0; 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: #f2f4f4; 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; left: 0; right: 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: left; }
.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: #f2f4f4; 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: #fff; 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: #fcfdfd; }
.md-preview h1, .md-preview h2, .md-preview h3 { font-size: 1.15rem; margin-top: .6rem; }

/* ---- toasts & login -------------------------------------------------------- */
.toast-stack { position: fixed; top: 70px; right: 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: #fff; border-left: 4px solid var(--brand); }
.toast-danger { border-left-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), #0e3a3a); padding: 16px; }
.login-card { background: #fff; width: 100%; max-width: 380px; border-radius: 14px; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.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: #f7f9f9; 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; left: 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; right: 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; }
