/* ================= Wasel control panel theme ================= */
:root {
  --wasel-accent: #6366f1;
  --wasel-accent-2: #4f46e5;
  --wasel-radius: 1rem;
}

html { font-size: 15px; position: relative; min-height: 100%; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
  margin-bottom: 70px;
  font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Kufi Arabic", system-ui, -apple-system, sans-serif;
}

/* ---- Dark (default) ---- */
[data-bs-theme="dark"] {
  --bs-body-bg: #0b0e1a;
  --bs-body-bg-rgb: 11, 14, 26;
  --bs-body-color: #e8eaf6;
  --bs-tertiary-bg: #141830;
  --bs-tertiary-bg-rgb: 20, 24, 48;
  --bs-border-color: #2a3052;
  --bs-secondary-color: #8b93b8;
  --bs-emphasis-color: #fff;
}
[data-bs-theme="dark"] body {
  background:
    radial-gradient(60rem 40rem at 90% -10%, rgba(99, 102, 241, 0.22), transparent 60%),
    radial-gradient(50rem 35rem at -10% 105%, rgba(56, 189, 248, 0.10), transparent 60%),
    #0b0e1a;
  background-attachment: fixed;
}
/* ---- Light ---- */
[data-bs-theme="light"] {
  --bs-body-bg: #f4f5fb;
  --bs-tertiary-bg: #ffffff;
  --bs-border-color: #e1e4f2;
}
[data-bs-theme="light"] body {
  background:
    radial-gradient(60rem 40rem at 90% -10%, rgba(99, 102, 241, 0.12), transparent 60%),
    #f4f5fb;
  background-attachment: fixed;
}

/* ---- Buttons ---- */
.btn { border-radius: 0.65rem; font-weight: 500; }
.btn-primary {
  --bs-btn-border-color: transparent;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-border-color: transparent;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: 0; color: #fff;
}
.btn-primary:hover, .btn-primary:focus { filter: brightness(1.12); color: #fff; }
.btn-outline-secondary { --bs-btn-border-color: var(--bs-border-color); }
[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: #c5cae9; --bs-btn-hover-bg: #1b2040; --bs-btn-hover-border-color: #4f46e5; --bs-btn-hover-color: #fff; }
.btn:focus, .btn:active:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.22rem rgba(99, 102, 241, 0.35);
}

/* ---- Navbar ---- */
.navbar {
  background-color: rgba(20, 24, 48, 0.75) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bs-border-color) !important;
  position: sticky; top: 0; z-index: 100;
}
[data-bs-theme="light"] .navbar { background-color: rgba(255, 255, 255, 0.85) !important; }
.navbar-brand { font-weight: 700; }
.navbar-brand img { border-radius: 8px; box-shadow: 0 4px 14px rgba(99, 102, 241, 0.5); }
.nav-link { border-radius: 0.5rem; padding-inline: 0.85rem !important; color: var(--bs-secondary-color); }
.nav-link:hover { color: var(--bs-emphasis-color); background: rgba(99, 102, 241, 0.12); }
.nav-link.active { color: #fff !important; background: rgba(99, 102, 241, 0.22); font-weight: 600; }

/* ---- Page header ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; font-weight: 700; }
.page-head .sub { color: var(--bs-secondary-color); font-size: 0.9rem; margin-top: 0.15rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 0 0 0.75rem; }
.section-title h2 { margin: 0; font-weight: 600; }

/* ---- Cards ---- */
.card, .panel {
  background: rgba(20, 24, 48, 0.8);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--wasel-radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
[data-bs-theme="light"] .card, [data-bs-theme="light"] .panel { background: #fff; box-shadow: 0 6px 20px rgba(60, 70, 120, 0.08); }
.panel { padding: 1.75rem; }

.stat-card { transition: transform .15s ease, border-color .15s ease; }
.stat-card:hover { transform: translateY(-2px); border-color: #4f46e5; }
.stat-card .stat-value { font-size: 2.3rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-icon {
  width: 3rem; height: 3rem; border-radius: 0.9rem;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.4rem; background: rgba(99, 102, 241, 0.18);
}

/* ---- Tables ---- */
.table-wrap {
  border: 1px solid var(--bs-border-color); border-radius: var(--wasel-radius); overflow: hidden;
  background: rgba(20, 24, 48, 0.8); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
[data-bs-theme="light"] .table-wrap { background: #fff; box-shadow: 0 6px 20px rgba(60, 70, 120, 0.08); }
.table-wrap .table { margin-bottom: 0; --bs-table-bg: transparent; --bs-table-border-color: var(--bs-border-color); }
.table-wrap thead th {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; color: var(--bs-secondary-color);
  background: rgba(99, 102, 241, 0.08); border-bottom: 1px solid var(--bs-border-color); padding: 0.85rem 1rem;
}
.table-wrap tbody td { padding: 0.8rem 1rem; }
.table-wrap tbody tr:hover > * { background: rgba(99, 102, 241, 0.06); }
.empty-row { color: var(--bs-secondary-color); text-align: center; padding: 2.5rem 1rem !important; }

/* ---- Badges ---- */
.badge { font-weight: 600; padding: 0.4em 0.75em; border-radius: 999px; }
.badge.bg-success { background: rgba(34, 197, 94, 0.16) !important; color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.4); }
.badge.bg-secondary { background: rgba(148, 163, 184, 0.14) !important; color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }
.badge.bg-warning { background: rgba(245, 158, 11, 0.16) !important; color: #fbbf24 !important; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge.bg-danger { background: rgba(239, 68, 68, 0.16) !important; color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }

/* ---- Forms ---- */
.form-label { font-size: 0.9rem; color: var(--bs-secondary-color); }
.form-control, .form-select {
  border-radius: 0.7rem; padding: 0.7rem 0.95rem; border: 1px solid var(--bs-border-color);
}
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { background-color: #0f1324; color: #fff; }
[data-bs-theme="dark"] .form-control:focus, [data-bs-theme="dark"] .form-select:focus { background-color: #0f1324; color: #fff; border-color: #6366f1; }
[data-bs-theme="dark"] .form-control:disabled { background-color: #121731; color: #8b93b8; }
.form-control::placeholder { color: #5b638c; }
.form-card { max-width: 560px; }
input[type="password"], input[type="url"], input[type="tel"], input[placeholder^="http"], input[placeholder^="+"] { direction: ltr; text-align: left; }

/* ---- Alerts ---- */
.alert { border-radius: 0.85rem; border-width: 1px; }
[data-bs-theme="dark"] .alert-success { background: rgba(34, 197, 94, 0.10); border-color: rgba(34, 197, 94, 0.4); color: #86efac; }
[data-bs-theme="dark"] .alert-danger { background: rgba(239, 68, 68, 0.10); border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }

/* ---- Secrets (shown once) ---- */
.secret-grid { display: grid; gap: 0.9rem; margin-top: 1rem; }
.secret-item { background: rgba(0, 0, 0, 0.25); border: 1px solid var(--bs-border-color); border-radius: 0.85rem; padding: 0.85rem 1rem; }
.secret-item .k { font-size: 0.78rem; color: var(--bs-secondary-color); margin-bottom: 0.35rem; }
.secret-item .v { display: flex; align-items: center; gap: 0.75rem; }
.secret-item code { flex: 1; color: #c7d2fe; font-size: 0.9rem; background: transparent; padding: 0; }
[data-bs-theme="light"] .secret-item code { color: #3730a3; }
.copy-btn { flex: none; }

code { direction: ltr; unicode-bidi: embed; display: inline-block; word-break: break-all; }
.ltr { direction: ltr; unicode-bidi: embed; }
td.ltr, th.ltr { text-align: start; }

.footer { position: absolute; bottom: 0; width: 100%; line-height: 56px; border-color: var(--bs-border-color) !important; font-size: 0.85rem; }

/* ---- Login screen: always dark, independent of the saved theme ---- */
html.login-html, body.login-page { background: #0b0e1a; color: #e8eaf6; }
body.login-page {
  min-height: 100vh; margin: 0;
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background:
    radial-gradient(60rem 40rem at 85% -10%, rgba(99, 102, 241, 0.35), transparent 60%),
    radial-gradient(50rem 35rem at -10% 110%, rgba(56, 189, 248, 0.18), transparent 60%),
    #0b0e1a;
}
.login-wrap { width: 100%; max-width: 420px; }
.login-lang { display: flex; justify-content: flex-end; margin-bottom: 0.75rem; }
.login-lang a { color: #a5b4fc; border-color: #2e3560; }
.login-lang a:hover { background: #1b2040; color: #fff; border-color: #4f46e5; }
.login-card {
  background: rgba(23, 27, 46, 0.85);
  border: 1px solid #2a3052; border-radius: 1.25rem;
  padding: 2.25rem 2rem; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}
.login-logo {
  width: 72px; height: 72px; border-radius: 20px; margin-bottom: 1rem;
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.5);
}
.login-card h1 { font-weight: 700; color: #fff; }
.login-card .subtitle { color: #8b93b8; font-size: 0.9rem; }
.login-card .form-label { color: #c5cae9; font-size: 0.9rem; }
.login-card .form-control {
  background: #0f1324; border: 1px solid #2a3052; color: #fff;
  padding: 0.8rem 1rem; border-radius: 0.75rem; direction: ltr; text-align: start;
}
.login-card .form-control::placeholder { color: #5b638c; }
.login-card .form-control:focus { background: #0f1324; color: #fff; border-color: #6366f1; }
.login-card .btn-primary { padding: 0.8rem; border-radius: 0.75rem; font-weight: 600; }
.login-card .alert-danger {
  background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5; border-radius: 0.75rem;
}
.login-foot { text-align: center; color: #5b638c; font-size: 0.8rem; margin-top: 1.25rem; }

/* ---- Warning alert (dark) ---- */
[data-bs-theme="dark"] .alert-warning { background: rgba(245, 158, 11, 0.10); border-color: rgba(245, 158, 11, 0.4); color: #fcd34d; }
