/* ============================================================
   نظام التصميم الموحد — Walid System
   لوحة تحكم شحن ومتابعة طلبات COD (توصيل عند الاستلام) بالجزائر
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@700;800;900&family=Tajawal:wght@400;500;700;900&display=swap');

:root {
  /* --- الألوان الأساسية --- */
  --ink-900: #14213D;
  --ink-700: #2B3A55;
  --ink-500: #5B6B8C;
  --ink-300: #9AA6C0;

  --paper-0:   #FFFFFF;
  --paper-50:  #FAF7F2;
  --paper-100: #F2ECE1;
  --line:      #E7E0D2;
  --line-soft: #EFEAE0;

  /* --- ألوان الهوية (حيوية) --- */
  --accent:       #FF5A1F;   /* برتقالي الشحن — أزرار وإجراءات رئيسية */
  --accent-dark:  #E14B14;
  --accent-soft:  #FFE7DA;

  --violet:       #6D28D9;   /* بنفسجي — يُستخدم في التدرج فقط */
  --violet-soft:  #EFE6FB;

  --teal:         #00A896;   /* أخضر مزرق — نجاح/تأكيد */
  --teal-dark:    #018075;
  --teal-soft:    #DCF6F2;

  /* --- تدرج الهوية (يُستخدم بحكمة: شريط علوي، أزرار رئيسية، أرقام بارزة) --- */
  --gradient-brand: linear-gradient(115deg, var(--accent) 0%, #FF8A3D 45%, var(--violet) 100%);

  /* --- ألوان الحالات (تُستخدم مع status-card / badges) --- */
  --status-confirmed-fg: #0E7C6B; --status-confirmed-bg: #DFF7F0;
  --status-cancelled-fg: #C21E2B; --status-cancelled-bg: #FCE4E2;
  --status-uploaded-fg:  #1D4ED8; --status-uploaded-bg:  #E4ECFD;
  --status-delayed-fg:   #B4620A; --status-delayed-bg:   #FEEDD6;
  --status-archived-fg:  #5B6472; --status-archived-bg:  #ECEDEF;
  --status-unsorted-fg:  #7A4B32; --status-unsorted-bg:  #F3E7DE;
  --status-noanswer-fg:  #9A3E12; --status-noanswer-bg:  #FBE6D8;

  /* --- ظلال / زوايا --- */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-xs: 0 1px 2px rgba(20,33,61,.05);
  --shadow-sm: 0 2px 8px rgba(20,33,61,.07);
  --shadow-md: 0 8px 24px rgba(20,33,61,.10);
  --shadow-lg: 0 16px 40px rgba(20,33,61,.16);

  font-size: 16px;
}

@media (max-width: 768px) { :root { font-size: 15px; } }

/* ============================================================
   إعادة ضبط أساسية
   ============================================================ */
* { box-sizing: border-box; }

html { direction: rtl; }

body {
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  background: linear-gradient(180deg, #f5f7ff 0%, #eef3ff 52%, #f8fafc 100%);
  color: var(--ink-900);
  margin: 0;
  padding: 0;
  direction: rtl;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.ws-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

main, .page, .container {
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(2px);
}

/* ============================================================
   الطباعة
   ============================================================ */
h1, h2, h3, h4 {
  font-family: 'Cairo', 'Tajawal', sans-serif;
  color: var(--ink-900);
  font-weight: 800;
  margin: 0 0 16px;
  line-height: 1.35;
}
h1 { font-size: 1.9rem; font-weight: 900; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

p { color: var(--ink-700); }

a {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 700;
}
a:hover { text-decoration: underline; }

::selection { background: var(--accent-soft); color: var(--accent-dark); }

/* شريط تمرير أنيق */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--paper-100); }
::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 10px; }

/* ============================================================
   شريط التنقل العلوي (Navbar)
   ============================================================ */
.ws-navbar {
  background: var(--ink-900);
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.ws-navbar::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 3px;
  background: var(--gradient-brand);
}

.ws-navbar .ws-brand {
  font-family: 'Cairo', sans-serif;
  font-weight: 900;
  font-size: 1.15rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ws-navbar nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.ws-navbar nav a {
  color: #C9D2E8;
  font-weight: 600;
  font-size: .92rem;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  transition: background .15s ease, color .15s ease;
}
.ws-navbar nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.ws-navbar nav a.active { background: var(--accent); color: #fff; }

/* رأس الصفحة */
.ws-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.ws-page-header h1 { margin: 0; }
.ws-page-header .ws-subtitle { color: var(--ink-500); font-size: .95rem; margin-top: 4px; }

/* ============================================================
   البطاقات والإحصائيات
   ============================================================ */
.ws-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.ws-stat-card {
  background: var(--paper-0);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.ws-stat-card::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gradient-brand);
}
.ws-stat-card .ws-stat-label {
  color: var(--ink-500);
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.ws-stat-card .ws-stat-value {
  font-family: 'Cairo', sans-serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--ink-900);
}
.ws-stat-card .ws-stat-value small { font-size: 1rem; color: var(--ink-500); font-weight: 700; }

.ws-card {
  background: var(--paper-0);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}

/* ============================================================
   الأزرار
   ============================================================ */
.btn, button, input[type="submit"] {
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  cursor: pointer;
  color: #fff;
  background: var(--accent);
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
  box-shadow: var(--shadow-xs);
}
.btn:hover, button:hover, input[type="submit"]:hover {
  background: var(--accent-dark);
  box-shadow: var(--shadow-sm);
}
.btn:active, button:active { transform: translateY(1px); }

.btn.ws-primary { background: var(--gradient-brand); }
.btn.ws-secondary { background: var(--paper-100); color: var(--ink-900); }
.btn.ws-secondary:hover { background: var(--line); }
.btn.ws-success { background: var(--teal); }
.btn.ws-success:hover { background: var(--teal-dark); }
.btn.ws-danger { background: var(--status-cancelled-fg); }
.btn.ws-ghost { background: transparent; color: var(--ink-700); box-shadow: none; border: 1px solid var(--line); }
.btn.ws-ghost:hover { background: var(--paper-100); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ============================================================
   المدخلات والنماذج
   ============================================================ */
input[type="text"], input[type="number"], input[type="password"],
input[type="search"], input[type="date"], input[type="tel"],
select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: 'Tajawal', sans-serif;
  margin-bottom: 12px;
  box-sizing: border-box;
  background: var(--paper-0);
  color: var(--ink-900);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
label { font-weight: 700; color: var(--ink-700); font-size: .88rem; display: block; margin-bottom: 6px; }

/* ============================================================
   الجداول
   ============================================================ */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper-0);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
}

th, td {
  border-bottom: 1px solid var(--line-soft);
  padding: 13px 16px;
  text-align: right;
  font-size: .92rem;
}

th {
  background: var(--ink-900);
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--paper-50); }
tbody tr:nth-child(even) { background: rgba(242,236,225,.35); }
tbody tr:nth-child(even):hover { background: var(--paper-50); }

/* ============================================================
   بطاقات الحالة (status badges)
   ============================================================ */
.status-card, .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  margin: 2px;
  font-weight: 700;
  font-size: .82rem;
  line-height: 1.4;
  box-shadow: none;
}
.status-card::before, .badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.status-confirmed { background: var(--status-confirmed-bg); color: var(--status-confirmed-fg); }
.status-cancelled { background: var(--status-cancelled-bg); color: var(--status-cancelled-fg); }
.status-uploaded  { background: var(--status-uploaded-bg);  color: var(--status-uploaded-fg); }
.status-delayed   { background: var(--status-delayed-bg);   color: var(--status-delayed-fg); }
.status-archived  { background: var(--status-archived-bg);  color: var(--status-archived-fg); }
.status-unsorted  { background: var(--status-unsorted-bg);  color: var(--status-unsorted-fg); }
.status-noanswer  { background: var(--status-noanswer-bg);  color: var(--status-noanswer-fg); }

/* ============================================================
   التنبيهات
   ============================================================ */
.ws-alert {
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-weight: 600;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.ws-alert.info    { background: var(--violet-soft); color: var(--violet); border-color: #E1D4F7; }
.ws-alert.success { background: var(--teal-soft); color: var(--teal-dark); border-color: #C4EEE7; }
.ws-alert.warning { background: var(--status-delayed-bg); color: var(--status-delayed-fg); border-color: #FBDDA9; }
.ws-alert.danger  { background: var(--status-cancelled-bg); color: var(--status-cancelled-fg); border-color: #F6C7C4; }

/* ============================================================
   الجداول على الشاشات الصغيرة
   ============================================================ */
@media (max-width: 768px) {
  .ws-container { padding: 14px; }
  .ws-navbar { padding: 0 14px; }

  table, thead, tbody, th, td, tr { display: block; }
  thead tr { display: none; }

  tbody tr {
    margin-bottom: 14px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    background: var(--paper-0);
    padding: 6px 12px;
    box-shadow: var(--shadow-xs);
  }
  tbody tr:nth-child(even) { background: var(--paper-0); }

  td {
    padding: 10px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed var(--line-soft);
  }
  td:last-child { border-bottom: none; }
  td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--ink-500);
    font-size: .82rem;
  }
}
