/* =========================================
   SaaS-Core Premium Design System
========================================= */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --sidebar-bg: #ffffff;
  --hero-grad: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
  --radius: 20px;
}

/* Dark Mode Variables */
body.dark {
  --bg-main: #020617;
  --bg-card: #0f172a;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.05);
  --sidebar-bg: #0b1120;
  --shadow: 0 20px 30px rgba(0, 0, 0, 0.3);
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  transition: all 0.3s ease;
}

.dashboard {
  display: flex;
  min-height: 100vh;
}

body[dir="rtl"] {
  direction: rtl;
  text-align: right;
}



/* =========================================
   SIDEBAR
========================================= */
.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}


.logo {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 50px;
  padding-left: 15px;
}

.logo span {
  color: var(--text-main);
}



.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 14px 20px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  border-radius: 14px;
  transition: 0.3s;
  cursor: pointer;
}

.sidebar nav a i {
  font-size: 18px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

.sidebar nav a.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

/* تنسيق الـ nav في الديسكتوب */
.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%; /* خلي الـ nav ياخد طول السايد بار المتاح */
}

/* تنسيق زرار الـ Home وهو جوه الـ nav */
.sidebar nav .home-btn {
    margin-top: auto; /* هيترمي تحت خالص جوه الـ nav */
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    border-radius: 14px;
    border-top: 1px solid var(--border);
    transition: 0.3s;
}

.sidebar nav .home-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* =========================================
   MAIN CONTENT
========================================= */
.main {
  flex: 1;
  padding: 30px 40px;
  overflow-x: hidden;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.navbar h2 {
  font-size: 24px;
  font-weight: 700;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-right button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 15px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.3s;
}

.nav-right button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.user {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 6px 15px;
  border-radius: 50px;
  border: 1px solid var(--border);
}

.user span {
  font-weight: 600;
}

.user img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: var(--primary);
}

/* =========================================
   HERO SECTION (THE WOW FACTOR)
========================================= */
.hero {
  background: var(--hero-grad);
  border-radius: 30px;
  padding: 40px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.3);
}

.hero h2 {
  font-size: 32px;
  margin-bottom: 10px;
}

.hero p {
  opacity: 0.9;
  font-size: 16px;
}

.hero-stats {
  display: flex;
  gap: 40px;
}

.hero-stats div span {
  font-size: 14px;
  opacity: 0.8;
}

.hero-stats div h3 {
  font-size: 28px;
  font-weight: 800;
}

/* =========================================
   STATS CARDS
========================================= */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  margin-bottom: 40px;
}

.card {
  background: var(--bg-card);
  padding: 25px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-top i {
  width: 45px;
  height: 45px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 20px;
}

.card-top span {
  color: #10b981;
  font-weight: 700;
  font-size: 14px;
  background: rgba(16, 185, 129, 0.1);
  padding: 4px 10px;
  border-radius: 8px;
}

.card h3 {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card p {
  font-size: 28px;
  font-weight: 800;
}

/* =========================================
   CHARTS & TABLES
========================================= */

.charts {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 25px;
  margin-bottom: 40px;
}

/* كل شارت لوحده */
.chart {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 20px;
  border: 1px solid var(--border);
  height: 350px; /* ✅ الارتفاع هنا مش في charts */
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* مهم جداً عشان Chart.js يظبط نفسه */
.chart canvas {
  flex: 1;
  width: 100% !important;
}

/* باقي السيكشنات */
.table,
.activity {
  background: var(--bg-card);
  padding: 30px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.chart h3,
.table-header h3,
.activity h3 {
  font-size: 18px;
  margin-bottom: 20px;
  font-weight: 700;
}

/* Table */
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.table-header input {
  background: var(--bg-main);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 12px;
  color: var(--text-main);
  outline: none;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  color: var(--text-muted);
  font-size: 14px;
  padding-bottom: 15px;
}

td {
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.badge {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.badge.premium {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}
.badge.basic {
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-muted);
}

/* Activity */
.activity {
  margin-top: 40px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item i {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.activity-item p {
  flex: 1;
  font-weight: 500;
}

.activity-item span {
  font-size: 12px;
  color: var(--text-muted);
}

footer {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.clients-grid {
    display: grid;
    /* ده بيخلي الكروت تترص جنب بعضها، وكل كارت عرضه لا يقل عن 250px */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); 
    gap: 20px; /* المسافة بين الكروت */
    margin-top: 20px;
}

.client-card {
    background: var(--bg-main); /* أو لون أفتح شوية عشان يبان فوق الـ card الأساسي */
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column; /* يخلي المحتوى جوه الكارت بالطول */
    align-items: center; /* يخلي كل حاجة في النص */
    text-align: center;
    transition: 0.3s;
}

.client-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.client-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.client-info img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.client-info h4 {
    font-size: 16px;
    color: var(--text-main);
}

.client-info span {
    font-size: 13px;
    color: var(--text-muted);
}
/* الحاوية الشبكية */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

/* الكارت البريميوم */
.client-card {
    background: rgba(255, 255, 255, 0.03); /* شفافية خفيفة جداً */
    backdrop-filter: blur(10px); /* تأثير الزجاج الضبابي */
    border: 1px solid rgba(255, 255, 255, 0.08); /* حدود ناعمة */
    border-radius: 20px; /* زوايا دائرية أكثر احترافية */
    padding: 24px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

/* تأثير الإضاءة عند الوقوف على الكارت */
.client-card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3), 
                0 0 15px rgba(99, 102, 241, 0.2); /* توهج خفيف باللون الأساسي */
}

/* تنسيق الصورة (Avatar) */
.client-info img {
    width: 70px;
    height: 70px;
    border-radius: 18px; /* شكل المربع الدائري عصري أكتر من الدائرة الكاملة */
    object-fit: cover;
    margin-bottom: 15px;
    padding: 3px;
    background: linear-gradient(135deg, var(--primary), #a855f7); /* إطار متدرج */
}

.client-info h4 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 5px;
    color: #fff;
}

.client-info p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 15px;
}

/* تطوير شكل الـ Badges */
.badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.badge.premium {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge.basic {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
/* Premium Glass */
.badge.premium {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
}

/* Basic Glass */
.badge.basic {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

.timeline {
  position: relative;
  padding-left: 20px;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
  padding-left: 20px;
}

.timeline-item .dot {
  position: absolute;
  left: 0;
  top: 5px;

  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;

  box-shadow: 0 0 10px var(--primary);
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 15px;
  width: 2px;
  height: 100%;
  background: rgba(99, 102, 241, 0.3);
}

.timeline-item .content p {
  font-weight: 500;
}

.timeline-item .content span {
  font-size: 12px;
  color: var(--text-muted);
}      
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
  margin-top: 20px;
}

/* CARD BASE */
.client-card {
  position: relative;
  padding: 18px;
  border-radius: 18px;

  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  border: 1px solid rgba(255, 255, 255, 0.08);

  transition: 0.4s;
  overflow: hidden;
}

/* Neon Glow Border */
.client-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  padding: 1px;

  background: linear-gradient(135deg, var(--primary), #a855f7);
  opacity: 0.15;

  pointer-events: none;
}

.client-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 40px rgba(99, 102, 241, 0.25);
}

/* TOP SECTION */
.client-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}

/* AVATAR */
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;

  object-fit: cover;

  border: 2px solid rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

/* TEXT */
.client-text h4 {
  font-size: 15px;
  margin-bottom: 3px;
}

.client-text p {
  font-size: 12px;
  color: var(--text-muted);
}

/* BOTTOM */
.client-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

/* ICON */
.client-bottom i {
  color: var(--text-muted);
  cursor: pointer;
  transition: 0.3s;
}

.client-bottom i:hover {
  color: var(--primary);
}

/* BADGES (Premium Glass) */
.badge {
  padding: 5px 12px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.badge.premium {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
}

.badge.basic {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}
/* =========================================
   RESPONSIVE DESIGN
========================================= */

/* Responsive */
@media (max-width: 1100px) {
  .stats,
  .charts {
    grid-template-columns: 1fr;
  }
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 30px;
  }
}

/* Tablets */
@media (max-width: 1100px) {
  .dashboard {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
  }

  .sidebar nav {
    flex-direction: row;
    gap: 10px;
  }

  .sidebar nav a span {
    display: none; /* نخفي الكلام ونسيب الأيقونات */
  }

  .sidebar-footer {
    display: none;
  }

  .main {
    padding: 20px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .hero-stats {
    gap: 20px;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .charts {
    grid-template-columns: 1fr;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .nav-right {
    width: 100%;
    justify-content: space-between;
  }

  .user span {
    display: none;
  }

  .hero {
    padding: 25px;
  }

  .hero h2 {
    font-size: 22px;
  }

  .hero-stats {
    flex-direction: column;
    gap: 15px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 20px;
  }

  .charts {
    grid-template-columns: 1fr;
  }

  .chart {
    height: 250px; /* أصغر للموبايل */
  }

  .table-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .table-header input {
    width: 100%;
  }

  table {
    font-size: 14px;
  }

  td,
  th {
    padding: 10px 5px;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .sidebar nav {
    gap: 5px;
  }

  .sidebar nav a {
    padding: 10px;
  }

  .card p {
    font-size: 22px;
  }

  .hero h2 {
    font-size: 20px;
  }

  .hero p {
    font-size: 14px;
  }

  .chart {
    height: 220px;
  }
}
@media (max-width: 768px) {
  .sidebar {
    position: fixed !important;
    bottom: 0 !important;
    top: auto !important;       /* 🔥 يلغي top:0 */
    left: 0;
    width: 100%;
    height: 70px !important;    /* 🔥 يلغي 100vh */
    
    flex-direction: row;
    align-items: center;
    justify-content: center;

    padding: 5px 0;
    background: var(--sidebar-bg);
    border-top: 1px solid var(--border);
    z-index: 9999;
  }

  /* نخفي اللوجو */
  .logo {
    display: none;
  }

  /* nav أفقي */
  .sidebar nav {
    flex-direction: row;
    width: 100%;
    justify-content: space-around;
  }

  /* كل زر */
  .sidebar nav a {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 5px;
  }

  .sidebar nav a i {
    font-size: 18px;
  }

  .sidebar nav a span {
    font-size: 10px;
  }

   .home-btn {
    color: #10b981;
  }
  .sidebar nav {
  justify-content: space-around;
}

  /* مهم جدًا عشان المحتوى ما يتغطّيش */
  .main {
    padding-bottom: 90px;
  }
}
@media (max-width: 768px) {
  .sidebar nav a:last-child {
    color: #10b981;
  }
}

@media (max-width: 768px) {

  .home-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 5px;
    flex: 1; /* 🔥 أهم سطر عشان ياخد نفس مساحة باقي الأزرار */
    color: var(--text-muted);
    text-decoration: none;
  }

  .home-btn i {
    font-size: 18px;
  }

  .home-btn span {
    font-size: 10px;
    margin-top: 4px;
    display: none; /* أو خليه لو عايز نص */
  }
}




/* =========================================
   RESPONSIVE
========================================= */

/* Tablet */
@media (max-width: 1100px) {
  .dashboard {
    flex-direction: column;
  }

  .stats,
  .charts {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
    gap: 20px;
  }
}

/* Mobile */
@media (max-width: 768px) {

  /* Bottom Bar */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 0;
    border-top: 1px solid var(--border);
    z-index: 9999;
  }

  .logo {
    display: none;
  }

  .sidebar nav {
    flex-direction: row;
    flex: 1;
    justify-content: space-around;
  }

  .sidebar nav a,
  .home-btn {
    flex: 1;
    height: 70px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 0;
  }

  .sidebar nav a i,
  .home-btn i {
    font-size: 18px;
  }

  .sidebar nav a span,
  .home-btn span {
    display: none;
  }

  .main {
    padding-bottom: 90px;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .chart {
    height: 220px;
  }
}  