/* Tarneeb admin panel — dark design with gold/green touches (separate from style.css) */
:root {
  --bg: #070d1f; --navy: #0B1530; --navy2: #13204a; --panel: #101a3a; --panel2: #16224a;
  --felt: #0f5132; --green: #2fb36b; --gold: #D4AF37; --gold2: #FFD54F;
  --text: #e8e8e8; --muted: #9aa3b5; --red: #e04848; --blue: #4aa3ff; --line: #ffffff1a;
  --radius: 14px; --sidebar: 240px; --shadow: 0 10px 30px #0006;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  color: var(--text); background: radial-gradient(1200px 600px at 100% -10%, #0f513244, transparent), var(--bg);
  font-size: 15px; line-height: 1.6;
}
a { color: var(--gold2); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; direction: ltr; unicode-bidi: plaintext; }
.gold { color: var(--gold2); }
.ok { color: var(--green); }
.bad { color: var(--red); }

/* ── sign-in screen ───────────────────────────────────── */
.login {
  min-height: 100%; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(180deg, #0b1530ee, #070d1fee), url("../img/table_background.jpg") center/cover;
}
.login-card {
  width: 100%; max-width: 400px; background: #0b1530e6; border: 1px solid #d4af3744;
  border-radius: 20px; padding: 28px; text-align: center; box-shadow: var(--shadow);
}
.login-card img { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 8px 30px #d4af3733; }
.login-card h1 { color: var(--gold); margin: 12px 0 4px; font-size: 1.4rem; }
.login-card form { display: grid; gap: 10px; margin-top: 12px; text-align: start; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 16px 0 4px; font-size: .85rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.login-err { color: var(--red); min-height: 1.4em; margin-top: 10px; font-size: .9rem; }

/* ── layout ───────────────────────────────────────────── */
.layout { display: flex; min-height: 100%; }
.sidebar {
  width: var(--sidebar); flex-shrink: 0; background: linear-gradient(180deg, var(--navy), #08102a);
  border-inline-end: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; transition: width .2s ease, transform .25s ease; z-index: 40;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 16px; color: var(--gold); font-weight: 800; white-space: nowrap; overflow: hidden; }
.sidebar .brand img { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; overflow-y: auto; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden;
}
.sidebar nav a svg { width: 20px; height: 20px; flex-shrink: 0; opacity: .85; }
.sidebar nav a:hover { background: #ffffff0d; }
.sidebar nav a.on { background: linear-gradient(90deg, #d4af3722, #d4af3711); color: var(--gold2); box-shadow: inset -3px 0 0 var(--gold); }
.sidebar nav a .badge { margin-inline-start: auto; }
.sidebar .collapse-btn { margin: 8px; }
body.collapsed .sidebar { width: 68px; }
body.collapsed .sidebar .lbl, body.collapsed .sidebar .brand span, body.collapsed .sidebar nav a .badge { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; background: #070d1fcc; backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar h2 { margin: 0; font-size: 1.15rem; color: var(--gold); }
.topbar .me { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.topbar .me img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid #d4af3766; background: var(--panel2); }
.hamburger { display: none; }
.content { padding: 20px; max-width: 1400px; width: 100%; margin: 0 auto; }
.backdrop { position: fixed; inset: 0; background: #0009; z-index: 35; }

@media (max-width: 900px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; transform: translateX(100%); width: 260px !important; }
  body.drawer-open .sidebar { transform: none; }
  body.collapsed .sidebar .lbl, body.collapsed .sidebar .brand span { display: inline; }
  .hamburger { display: inline-flex; }
  .sidebar .collapse-btn { display: none; }
  .topbar .me .name { display: none; }
  .content { padding: 14px; }
}

/* ── shared elements ───────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel2); padding: 8px 14px; border-radius: 10px;
  transition: filter .15s, background .15s; white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1a1300; border: 0; font-weight: 700; }
.btn.green { background: var(--felt); border-color: #2fb36b55; }
.btn.red { background: #5a1a1a; border-color: #e0484866; color: #ffd6d6; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: .85rem; border-radius: 8px; }
.btn.icon { padding: 6px; width: 36px; height: 36px; }
.btn svg { width: 18px; height: 18px; }
.btn.block { width: 100%; }

input[type=text], input[type=number], input[type=email], input[type=password], input[type=datetime-local], select, textarea {
  width: 100%; background: #0a1330; border: 1px solid #ffffff22; border-radius: 10px; padding: 9px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px #d4af3722; }
textarea { min-height: 80px; resize: vertical; }
label.field { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--gold); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.field .err { color: var(--red); font-size: .8rem; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 1rem; color: var(--gold2); display: flex; align-items: center; gap: 8px; }
.card h3 .right { margin-inline-start: auto; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; background: #0a1330; padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tabs button { background: transparent; border: 0; padding: 6px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--panel2); color: var(--gold2); }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: linear-gradient(160deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; inset-inline-end: -20px; top: -20px; width: 80px; height: 80px; border-radius: 50%; background: #d4af3711; }
.kpi .v { font-size: 1.6rem; font-weight: 800; color: var(--gold2); }
.kpi .l { color: var(--muted); font-size: .85rem; }
.kpi.green .v { color: var(--green); }
.kpi.red .v { color: var(--red); }
.two { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .two { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #0a1330; color: var(--muted); font-weight: 600; font-size: .85rem; position: sticky; top: 0; }
tbody tr:hover { background: #ffffff06; }
tr.clickable { cursor: pointer; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--panel2); flex-shrink: 0; display: inline-grid; place-items: center; color: var(--gold); font-weight: 700; border: 1px solid var(--line); }
.avatar.lg { width: 72px; height: 72px; font-size: 1.6rem; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; background: #ffffff14; color: var(--muted); white-space: nowrap; }
.badge.gold { background: #d4af3726; color: var(--gold2); }
.badge.green { background: #2fb36b26; color: var(--green); }
.badge.red { background: #e0484826; color: #ff8a8a; }
.badge.blue { background: #4aa3ff26; color: var(--blue); }

.pager { display: flex; justify-content: center; gap: 8px; margin-top: 12px; align-items: center; }
.empty, .loading { text-align: center; color: var(--muted); padding: 36px 10px; }
.spinner { width: 28px; height: 28px; border: 3px solid #ffffff22; border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── details side drawer ────────────────────────────── */
.drawer {
  position: fixed; inset-block: 0; inset-inline-end: 0; width: min(560px, 100%); background: var(--navy);
  border-inline-start: 1px solid #d4af3744; z-index: 60; display: flex; flex-direction: column;
  box-shadow: var(--shadow); transform: translateX(-100%); transition: transform .25s ease;
}
.drawer.open { transform: none; }
.drawer header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer header h3 { margin: 0; color: var(--gold); font-size: 1.05rem; flex: 1; }
.drawer .body { overflow-y: auto; padding: 16px; flex: 1; }
.drawer-backdrop { position: fixed; inset: 0; background: #0008; z-index: 55; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.section-title { color: var(--gold2); margin: 18px 0 8px; font-size: .95rem; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.list { display: grid; gap: 6px; }
.list .row { display: flex; justify-content: space-between; gap: 8px; background: #ffffff08; border-radius: 8px; padding: 8px 10px; font-size: .88rem; flex-wrap: wrap; }

/* ── dialogs and alerts ────────────────────────────────── */
.modal-back { position: fixed; inset: 0; background: #000a; z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 460px; background: var(--navy); border: 1px solid #d4af3755; border-radius: 16px; padding: 20px; box-shadow: var(--shadow); max-height: 92vh; overflow-y: auto; }
.modal h3 { margin: 0 0 10px; color: var(--gold); }
.modal .body { display: grid; gap: 10px; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.toasts { position: fixed; bottom: 18px; inset-inline-start: 18px; z-index: 100; display: grid; gap: 8px; max-width: min(380px, 90vw); }
.toast { background: var(--panel2); border: 1px solid var(--line); border-inline-start: 4px solid var(--gold); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); animation: up .2s ease; }
.toast.ok { border-inline-start-color: var(--green); }
.toast.err { border-inline-start-color: var(--red); }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }

.room-card { display: grid; gap: 8px; }
.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.seats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seat { background: #ffffff08; border-radius: 8px; padding: 6px 8px; font-size: .85rem; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.seat.empty-seat { color: var(--muted); font-style: italic; }
.chart svg { width: 100%; height: 220px; display: block; }
.chart .bar { fill: url(#gbar); }
.chart .bar:hover { fill: var(--gold2); }
.chart text { fill: var(--muted); font-size: 10px; }
pre.details { white-space: pre-wrap; word-break: break-word; background: #0a1330; padding: 8px; border-radius: 8px; font-size: .78rem; max-height: 160px; overflow: auto; margin: 4px 0 0; direction: ltr; text-align: left; }
.tpl { border: 1px dashed var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; }

/* notifications bell */
.bell-wrap { position: relative; margin-inline-start: auto; }
.bell-wrap + .me { margin-inline-start: 0; }
.bell { position: relative; }
.bell svg { width: 20px; height: 20px; }
.bell-count { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: .7rem; line-height: 18px; text-align: center; }
.bell-menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: min(360px, 90vw); max-height: 70vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px #0008; z-index: 50; }
.bell-menu .head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.bell-menu .item { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.bell-menu .item:hover { background: var(--panel2); }
.bell-menu .item.unread { border-inline-start: 3px solid var(--gold); }
