/* ══════════════════════════════════════════════════════════════
   ShipFlow v11 — Main Stylesheet
   Dark mode (default) + Light mode via [data-theme="light"]
   ══════════════════════════════════════════════════════════════ */

/* ── Dark theme (default) ──────────────────────────────────── */
:root {
  --bg:        #0f172a;
  --surface:   #1e293b;
  --surface2:  #263352;
  --border:    #334155;
  --primary:   #6366f1;
  --primary-h: #4f46e5;
  --green:     #22c55e;
  --yellow:    #f59e0b;
  --red:       #ef4444;
  --blue:      #3b82f6;
  --text:      #e2e8f0;
  --muted:     #94a3b8;
  --radius:    10px;
  --input-bg:  #0f172a;
  --row-hover: #1a2540;
  --thead-bg:  #263352;
  --card-title:#fff;
  --h1-color:  #fff;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
}

/* ── Light theme ───────────────────────────────────────────── */
[data-theme="light"] {
  --bg:        #f1f5f9;
  --surface:   #ffffff;
  --surface2:  #e2e8f0;
  --border:    #cbd5e1;
  --primary:   #6366f1;
  --primary-h: #4f46e5;
  --green:     #16a34a;
  --yellow:    #d97706;
  --red:       #dc2626;
  --blue:      #2563eb;
  --text:      #1e293b;
  --muted:     #64748b;
  --input-bg:  #f8fafc;
  --row-hover: #f1f5f9;
  --thead-bg:  #e2e8f0;
  --card-title:#0f172a;
  --h1-color:  #0f172a;
  --shadow:    0 4px 24px rgba(0,0,0,.08);
}

/* ── Smooth transition on theme switch ─────────────────────── */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
/* Exclude transitions that would feel sluggish */
input, textarea, select, button, a { transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }

html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 24px; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
  gap: 12px;
}
.brand { font-size: 1.2rem; font-weight: 700; color: var(--card-title); text-decoration: none; display:flex;align-items:center;gap:8px; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.nav-links a { color: var(--muted); font-size: .88rem; transition: color .2s; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.btn-nav { background: var(--primary); color: #fff !important; padding: 7px 16px; border-radius: 6px; font-size: .85rem !important; }
.btn-nav:hover { background: var(--primary-h); }

/* ── Theme toggle button ─────────────────────────────────────── */
.theme-toggle {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--muted);
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle .tt-icon { font-size: 1rem; line-height: 1; }
/* Track + thumb pill */
.tt-track {
  width: 36px; height: 20px; background: var(--border);
  border-radius: 10px; position: relative; flex-shrink: 0;
  transition: background .2s;
}
.tt-track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; background: var(--muted);
  border-radius: 50%; transition: transform .2s, background .2s;
}
[data-theme="light"] .tt-track { background: var(--primary); }
[data-theme="light"] .tt-track::after { transform: translateX(16px); background: #fff; }

/* ── Container ───────────────────────────────────────────────── */
.container { flex: 1; max-width: 1100px; margin: 0 auto; padding: 32px 20px; width: 100%; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert { padding: 13px 18px; border-radius: var(--radius); margin-bottom: 20px; font-size: .9rem; }
[data-theme="light"] .alert-success { background: #dcfce7; border: 1px solid var(--green); color: #166534; }
[data-theme="light"] .alert-error   { background: #fee2e2; border: 1px solid var(--red);   color: #991b1b; }
[data-theme="light"] .alert-info    { background: #dbeafe; border: 1px solid var(--blue);  color: #1e40af; }
:not([data-theme="light"]) .alert-success { background: #14532d; border: 1px solid #22c55e; color: #86efac; }
:not([data-theme="light"]) .alert-error   { background: #450a0a; border: 1px solid #ef4444; color: #fca5a5; }
:not([data-theme="light"]) .alert-info    { background: #1e3a5f; border: 1px solid #3b82f6; color: #93c5fd; }

/* ── Cards ───────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--card-title); margin-bottom: 20px; }

/* ── Grids ───────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; }

/* ── Stat cards ──────────────────────────────────────────────── */
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; text-align: center; box-shadow: var(--shadow); }
.stat-card .number { font-size: 2.2rem; font-weight: 700; color: var(--primary); }
.stat-card .label  { color: var(--muted); font-size: .85rem; margin-top: 4px; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], textarea, select {
  width: 100%; padding: 10px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: .95rem;
  outline: none; font-family: inherit;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
textarea { min-height: 90px; resize: vertical; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn { display: inline-block; padding: 10px 22px; background: var(--primary); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: .92rem; font-weight: 600; }
.btn:hover { background: var(--primary-h); text-decoration: none; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-green  { background: var(--green);  color: #fff; }
.btn-green:hover  { background: #15803d; color: #fff; }
.btn-red    { background: var(--red);   color: #fff; }
.btn-red:hover    { background: #b91c1c; color: #fff; }
.btn-yellow { background: var(--yellow); color: #fff; }
.btn-yellow:hover { background: #b45309; color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th { background: var(--thead-bg); color: var(--muted); padding: 11px 14px; text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
tbody tr:hover { background: var(--row-hover); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
/* Dark badges */
.badge-pending    { background:#422006; color:#fcd34d; }
.badge-assigned   { background:#1e3a5f; color:#93c5fd; }
.badge-in_transit { background:#312e81; color:#a5b4fc; }
.badge-delivered  { background:#14532d; color:#86efac; }
.badge-cancelled  { background:#450a0a; color:#fca5a5; }
.badge-active     { background:#14532d; color:#86efac; }
.badge-suspended  { background:#450a0a; color:#fca5a5; }
.badge-admin      { background:#312e81; color:#a5b4fc; }
.badge-customer   { background:#1e3a5f; color:#93c5fd; }
.badge-delivery   { background:#422006; color:#fcd34d; }
/* Light badge overrides */
[data-theme="light"] .badge-pending    { background:#fef3c7; color:#92400e; }
[data-theme="light"] .badge-assigned   { background:#dbeafe; color:#1e40af; }
[data-theme="light"] .badge-in_transit { background:#ede9fe; color:#5b21b6; }
[data-theme="light"] .badge-delivered  { background:#dcfce7; color:#166534; }
[data-theme="light"] .badge-cancelled  { background:#fee2e2; color:#991b1b; }
[data-theme="light"] .badge-active     { background:#dcfce7; color:#166534; }
[data-theme="light"] .badge-suspended  { background:#fee2e2; color:#991b1b; }
[data-theme="light"] .badge-admin      { background:#ede9fe; color:#5b21b6; }
[data-theme="light"] .badge-customer   { background:#dbeafe; color:#1e40af; }
[data-theme="light"] .badge-delivery   { background:#fef3c7; color:#92400e; }

/* ── Section heading ─────────────────────────────────────────── */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.section-head h1 { font-size: 1.4rem; font-weight: 700; color: var(--h1-color); }

/* ── Track page ──────────────────────────────────────────────── */
.track-box { max-width: 600px; margin: 60px auto; }
.track-result { margin-top: 28px; }
.timeline { list-style: none; padding-left: 20px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 22px 24px; color: var(--muted); font-size: .88rem; }
.timeline li::before { content:''; position:absolute; left:-8px; top:4px; width:14px; height:14px; border-radius:50%; background:var(--primary); border:2px solid var(--bg); }
.timeline li .ts { font-size:.75rem; color:var(--border); display:block; margin-bottom:2px; }

/* ── Auth pages ──────────────────────────────────────────────── */
.auth-wrap { max-width: 440px; margin: 60px auto; }

/* ── Home hero ───────────────────────────────────────────────── */
.hero { text-align: center; padding: 60px 20px 40px; }
.hero h1 { font-size: 2.5rem; font-weight: 800; color: var(--h1-color); margin-bottom: 14px; }
.hero p  { color: var(--muted); font-size: 1.05rem; max-width: 520px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); text-align: center; padding: 18px; color: var(--muted); font-size: .82rem; }

/* ── Responsive ──────────────────────────────────────────────── */
@media(max-width:700px) {
  .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; }
  .navbar { flex-wrap: wrap; }
  .hero h1 { font-size: 1.8rem; }
  .theme-toggle .tt-label { display: none; }
}

/* ══════════════════════════════════════════════════════════════
   Language Switcher
   ══════════════════════════════════════════════════════════════ */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .82rem;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color .15s, color .15s;
}
.lang-switch:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}
.lang-flag { font-size: 1rem; line-height: 1; }
.lang-label { font-weight: 600; }
@media(max-width:700px) { .lang-label { display: none; } }

/* ══════════════════════════════════════════════════════════════
   Arabic font — Google Fonts Noto Kufi Arabic is loaded in rtl.css
   When RTL, boost font-size slightly for Arabic readability
   ══════════════════════════════════════════════════════════════ */
[lang="ar"] body {
  font-family: 'Noto Kufi Arabic', 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
}
