/* car.qubbat.com — الهوية البصرية وفق النموذج المرجعي (RTL، Tajawal، بطاقات بيضاء، أزرق) */

:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-strong: #0f172a;
  --muted: #64748b;
  --primary: #3b82f6;
  --primary-soft: rgba(59, 130, 246, 0.1);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar-w: 256px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card: #1e293b;
    --border: #334155;
    --text: #e2e8f0;
    --text-strong: #f8fafc;
    --muted: #94a3b8;
    --primary-soft: rgba(96, 165, 250, 0.15);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Tajawal', sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { color: var(--text-strong); margin: 0; }
.muted { color: var(--muted); font-size: 0.85rem; margin: 0.15rem 0 0; }

.layout { display: flex; min-height: 100vh; }

/* ---------- القائمة الجانبية ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-inline-start: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.brand { display: flex; gap: 0.75rem; align-items: center; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.brand-icon {
  width: 40px; height: 40px; border-radius: 10px; background: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
.brand-name { font-weight: 900; font-size: 1.2rem; color: var(--text-strong); }
.brand-sub { font-size: 0.72rem; color: var(--muted); }

.nav { flex: 1; padding: 0.75rem 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1.5rem; color: var(--text); font-weight: 500;
  border-inline-end: 4px solid transparent; transition: all 0.2s;
}
.nav-item:hover, .nav-item.active {
  background: var(--primary-soft); color: var(--primary);
  border-inline-end-color: var(--primary);
}
.nav-item.disabled { opacity: 0.5; pointer-events: none; }
.nav-icon { width: 1.4rem; text-align: center; }
.soon { margin-inline-start: auto; font-size: 0.65rem; background: var(--border); color: var(--muted); padding: 0.1rem 0.4rem; border-radius: 6px; }

.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); }
.odo-label { font-size: 0.72rem; color: var(--muted); }
.odo-value { font-weight: 900; font-size: 1.15rem; color: var(--text-strong); }
.odo-value small { font-weight: 400; font-size: 0.8rem; }
.logout { display: inline-block; margin-top: 0.5rem; font-size: 0.78rem; }

/* ---------- المحتوى ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--card) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem; display: flex; align-items: center; gap: 1rem;
}
.topbar h1 { font-size: 1.3rem; }
.menu-btn {
  display: none; background: none; border: 1px solid var(--border);
  border-radius: 8px; font-size: 1.1rem; padding: 0.35rem 0.6rem;
  cursor: pointer; color: var(--text);
}
.content { padding: 1.5rem; max-width: 1200px; width: 100%; margin: 0 auto; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 4px; }
.dot-green { background: var(--success); animation: pulse 1.5s infinite; }
.dot-gray { background: var(--muted); }
@keyframes pulse { 50% { opacity: 0.4; } }

/* ---------- البطاقات ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 1.1rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.card .label { font-size: 0.8rem; color: var(--muted); }
.card .value { font-size: 1.5rem; font-weight: 900; color: var(--text-strong); margin-top: 0.25rem; }
.card .value small { font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.card .hint { font-size: 0.72rem; color: var(--muted); margin-top: 0.35rem; }

.badge { font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 6px; }
.badge-green { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.badge-amber { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.badge-red { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.badge-gray { background: var(--border); color: var(--muted); }

/* ---------- الجداول ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 640px; }
th, td { padding: 0.7rem 1rem; text-align: right; white-space: nowrap; }
th { font-size: 0.75rem; color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 700; }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--primary-soft); }

/* ---------- النماذج ---------- */
.filters { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: end; }
.filters label { font-size: 0.75rem; color: var(--muted); display: block; margin-bottom: 0.2rem; }
input, select, button.btn {
  font-family: inherit; font-size: 0.9rem; padding: 0.45rem 0.7rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text);
}
button.btn { background: var(--primary); color: #fff; border: none; cursor: pointer; font-weight: 700; }
button.btn:hover { opacity: 0.9; }

/* ---------- الخريطة ---------- */
.map { height: 380px; border-radius: 16px; border: 1px solid var(--border); z-index: 1; }
.section-title { font-size: 1.05rem; font-weight: 700; margin: 1.5rem 0 0.75rem; color: var(--text-strong); }
.chart-note { font-size: 0.75rem; color: var(--muted); margin: 0.2rem 0 0.75rem; }

/* ---------- صفحة الدخول ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 360px; }
.login-card .card { padding: 2rem; }
.login-card input { width: 100%; margin-bottom: 0.9rem; }
.login-card button { width: 100%; padding: 0.6rem; }
.error-msg { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.75rem; }

/* ---------- الجوال: قائمة منزلقة ---------- */
.overlay { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 30; }
.overlay.show { display: block; }
@media (max-width: 900px) {
  .sidebar {
    position: fixed; inset-inline-end: 0; top: 0; z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0) !important; }
  .menu-btn { display: block; }
  .content { padding: 1rem; }
}
