/* MediaFlow X — clean dark SaaS theme (RTL). */
:root {
  --bg: #0d1117;
  --bg-2: #161b22;
  --bg-3: #1c2330;
  --border: #2a3340;
  --text: #e6edf3;
  --text-dim: #8b98a8;
  --primary: #4f8cff;
  --primary-2: #3b6fd6;
  --success: #2ea043;
  --warn: #d29922;
  --danger: #f85149;
  --radius: 10px;
  --shadow: 0 4px 18px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, system-ui, -apple-system, sans-serif;
  direction: rtl;
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Auth pages ──────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-card .sub { color: var(--text-dim); margin: 0 0 24px; font-size: 14px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; font-weight: 700; font-size: 20px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 12px var(--primary); }

/* ── Forms ───────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-dim); }
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }

.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: var(--primary-2); text-decoration: none; }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }

/* ── App shell ───────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar .brand { padding: 0 8px 20px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 4px;
}
.nav a:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; }
.sidebar .spacer { flex: 1; }

.main { flex: 1; min-width: 0; }
.topbar {
  height: 60px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-dim); }
.credits-pill {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--text);
}
.content { padding: 24px; }

/* ── Cards ───────────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card .label { color: var(--text-dim); font-size: 13px; margin-bottom: 6px; }
.card .value { font-size: 28px; font-weight: 700; }
.panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.panel h2 { margin: 0 0 16px; font-size: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h2 { margin: 0; }

/* ── Tables ──────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: none; }
.muted { color: var(--text-dim); }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-queued { background: rgba(79,140,255,.15); color: var(--primary); }
.badge-processing { background: rgba(210,153,34,.15); color: var(--warn); }
.badge-done { background: rgba(46,160,67,.15); color: var(--success); }
.badge-failed { background: rgba(248,81,73,.15); color: var(--danger); }
.badge-info { background: rgba(139,152,168,.15); color: var(--text-dim); }
.badge-warn { background: rgba(210,153,34,.15); color: var(--warn); }
.badge-error { background: rgba(248,81,73,.15); color: var(--danger); }

/* ── Flash ───────────────────────────────────────────────── */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash-error { background: rgba(248,81,73,.12); border: 1px solid var(--danger); color: #ffb4af; }
.flash-success { background: rgba(46,160,67,.12); border: 1px solid var(--success); color: #aee9bb; }

.logs-box {
  background: #0a0e14;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-family: "Cascadia Code", "Courier New", monospace;
  font-size: 13px;
  direction: ltr;
  text-align: left;
  max-height: 480px;
  overflow: auto;
}
.empty { text-align: center; color: var(--text-dim); padding: 40px; }

@media (max-width: 768px) {
  .sidebar { width: 64px; padding: 16px 8px; }
  .sidebar .brand span, .nav a span { display: none; }
}
