/* styles.css - Waznah PRO v23.0 (Premium Redesign) */
:root {
  --primary: #0f172a;
  --primary-light: #e2e8f0;
  --accent: #3b82f6;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.04);
  --sidebar-width: 260px;
  --sidebar-collapsed: 68px;
  --bottom-nav-height: 60px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* === Layout === */
.admin-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* === Dark Premium Sidebar === */
.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  border-left: none;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: width 0.3s ease, transform 0.3s ease;
  z-index: 100;
}

.main-content {
  padding: 25px;
  overflow-y: auto;
  height: 100%;
}

/* === Sidebar === */
.sidebar-brand {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand img {
  height: 36px;
}

.sidebar-brand h3 {
  margin: 0;
  color: #f1f5f9;
  font-size: 17px;
  font-weight: 700;
}

.sidebar-brand span {
  color: #475569 !important;
}

.sidebar-nav {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto !important;
  max-height: calc(100vh - 120px) !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

/* Section labels in sidebar */
.sidebar-nav > div[style*="font-size:11px"] {
  color: #475569 !important;
  font-size: 10px !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 14px !important;
  margin-bottom: 4px !important;
  padding-right: 12px;
}

.nav-item {
  padding: 9px 12px;
  border-radius: 8px;
  color: #94a3b8;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: right;
  font-size: 13px;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #cbd5e1;
}

.nav-item.active {
  background: rgba(59,130,246,0.12);
  color: #60a5fa;
  font-weight: 600;
  border-right: 3px solid #3b82f6;
}

.nav-item.logout {
  color: #f87171;
}

.nav-item.logout:hover {
  background: rgba(239,68,68,0.12);
  color: #fca5a5;
}

/* === Top Bar === */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  background: #dcfce7;
  color: #166534;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
}

/* === Stats Grid (Premium) === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 18px 20px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
}

.stat-card.red { background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%); }
.stat-card.red::before { background: var(--danger); }
.stat-card.blue { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); }
.stat-card.blue::before { background: var(--accent); }
.stat-card.yellow { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); }
.stat-card.yellow::before { background: var(--warning); }
.stat-card.green { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); }
.stat-card.green::before { background: var(--success); }
.stat-card.purple { background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%); }
.stat-card.purple::before { background: #8b5cf6; }

.stat-card .icon {
  font-size: 32px;
  opacity: 0.25;
}

.stat-card.red .icon { color: var(--danger); }
.stat-card.blue .icon { color: var(--accent); }
.stat-card.yellow .icon { color: var(--warning); }
.stat-card.green .icon { color: var(--success); }
.stat-card.purple .icon { color: #8b5cf6; }

.stat-card .info h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.stat-card .info p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* === Table Card === */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.table-card {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 500px;
  flex: 1;
}

.table-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}

.filters-group {
  display: flex;
  gap: 8px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 8px;
}

.filter-btn {
  background: none;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: 0.2s;
}

.filter-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-group {
  flex: 1;
  max-width: 400px;
}

.search-group input {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}

.table-responsive {
  overflow-y: auto;
  overflow-x: auto;
  flex: 1;
}

.main-table {
  width: 100%;
  border-collapse: collapse;
}

.main-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  padding: 10px 8px;
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.main-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.filter-row th {
  padding: 5px 4px !important;
}

.filter-row input {
  width: 100%;
  min-width: 40px;
  padding: 6px 8px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-sizing: border-box;
}

.main-table tr:hover {
  background: #f8fafc;
}

/* === Status Pills === */
.status-pill {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}

.step-0,
.step-1 {
  background: #e0f2fe;
  color: #0369a1;
}

.step-2,
.step-3,
.step-4 {
  background: #ffedd5;
  color: #c2410c;
}

.step-5,
.step-6 {
  background: #f3e8ff;
  color: #7e22ce;
}

.step-7 {
  background: #fef08a;
  color: #854d0e;
}

.step-8 {
  background: #dbeafe;
  color: #1d4ed8;
}

.step-9 {
  background: #dcfce7;
  color: #15803d;
}

.step-10 {
  background: #f1f5f9;
  color: #64748b;
}

/* === Login Screen === */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-body);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 100%;
  max-width: 400px;
}

.error-text {
  color: var(--danger);
  font-size: 12px;
  margin-top: 10px;
  text-align: center;
}

/* === Buttons & Inputs === */
.btn {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  transition: 0.2s;
}

.btn.action {
  background: var(--primary);
  color: white;
}

.btn.action:hover {
  background: #1e293b;
}

.btn.secondary {
  background: #e2e8f0;
  color: #334155;
}

.btn.secondary:hover {
  background: #cbd5e1;
}

.btn.danger {
  background: var(--danger);
  color: white;
}

.btn.outline {
  background: transparent;
  border: 1px solid currentColor;
}

.btn.danger.outline {
  color: var(--danger);
  border-color: var(--danger);
}

.btn.sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn.full-width {
  width: 100%;
  display: block;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.input-style {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  font-family: inherit;
}

.input-style:focus {
  border-color: var(--accent);
  outline: none;
}

/* === Modal Styles === */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-box {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* .modal-box.large removed (merged with grid definition below) */

.modal-box.medium {
  width: 500px;
  max-width: 95%;
}

.modal-box.small {
  width: 350px;
  max-width: 95%;
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  /* Allow wrapping on small screens */
  gap: 10px;
  background: #fafafa;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.close-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: #666;
  cursor: pointer;
}

/* === Cockpit Grid === */
/* === Cockpit Grid === */
.cockpit-grid {
  display: grid;
  /* Right (Content): Fluid, Left (Actions): Fixed/Min width */
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
  /* Prevent stretching height unnecessarily */
}

/* Make modal wider to accommodate the sidebar, but responsive */
/* Make modal wider to accommodate the sidebar, but responsive */
.modal-box.large {
  width: 96% !important;
  /* Forced width to ensure no overrides */
  max-width: 1400px !important;
  height: 92vh !important;
  max-height: 92vh !important;
  margin: 2vh auto !important;
  display: flex !important;
  flex-direction: column !important;
}

/* On smaller screens, stack the grid to avoid squishing */
@media (max-width: 1200px) {

  /* Increased breakpoint from 1000px to 1200px for safety */
  .cockpit-grid {
    grid-template-columns: 1fr;
    /* Stack vertically */
  }

  .modal-box.large {
    width: 96%;
    height: 90vh;
  }
}

.section {
  background: #f8fafc;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.customer-card {
  grid-column: span 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  /* Safety wrap */
  gap: 10px;
  background: white;
  border: 1px solid var(--primary);
}

.context-area {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.action-zone-wrapper {
  background: white;
  border: 2px solid var(--border);
  display: flex;
  flex-direction: column;
}

.zone-header {
  padding: 10px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.actions-grid {
  padding: 15px;
  display: grid;
  gap: 10px;
}

/* === Hamburger Button (Mobile Only) === */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.2s;
}
.hamburger-btn:hover { background: #f1f5f9; }
.hamburger-btn .material-icons-round { font-size: 26px; }

/* === Sidebar Overlay (Mobile) === */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.open {
  display: block;
  opacity: 1;
}

/* === Mobile Bottom Navigation === */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
  z-index: 98;
  justify-content: space-around;
  align-items: center;
  padding: 4px 0;
  padding-bottom: env(safe-area-inset-bottom, 4px);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s;
  min-width: 56px;
}
.bottom-nav-item .material-icons-round { font-size: 22px; }
.bottom-nav-item.active {
  color: #3b82f6;
}
.bottom-nav-item.active .material-icons-round {
  background: rgba(59,130,246,0.1);
  border-radius: 12px;
  padding: 2px 12px;
}

/* === Mobile (Phones) === */
@media (max-width: 767px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  /* Sidebar becomes a drawer */
  .sidebar {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    z-index: 200;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
  }
  .sidebar.open {
    right: 0;
  }

  /* Show hamburger & bottom nav */
  .hamburger-btn { display: flex; }
  .mobile-bottom-nav { display: flex; }

  /* Main content padding for bottom nav */
  .main-content {
    padding: 15px 12px;
    padding-bottom: calc(var(--bottom-nav-height) + 15px);
  }

  /* Top bar: hide less important buttons */
  .top-bar .btn.action[style*="background-color:#0b5ed7"] { display: none !important; }
  .top-bar #userEmailDisplay { display: none !important; }

  /* Stats: 2 columns on mobile */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card { padding: 14px; }
  .stat-card .icon { font-size: 24px; }
  .stat-card .info h3 { font-size: 18px; }
  .stat-card .info p { font-size: 11px; }

  /* Filters: horizontal scroll */
  .filters-group {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding: 3px;
  }
  .filters-group::-webkit-scrollbar { display: none; }
  .filter-btn {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 12px;
    padding: 6px 12px;
  }

  /* Table: hide non-essential columns (5,6,7,8,9) */
  #dashboardView .main-table th:nth-child(5),
  #dashboardView .main-table td:nth-child(5),
  #dashboardView .main-table th:nth-child(6),
  #dashboardView .main-table td:nth-child(6),
  #dashboardView .main-table th:nth-child(7),
  #dashboardView .main-table td:nth-child(7),
  #dashboardView .main-table th:nth-child(8),
  #dashboardView .main-table td:nth-child(8),
  #dashboardView .main-table th:nth-child(9),
  #dashboardView .main-table td:nth-child(9) {
    display: none;
  }

  /* Activity summary: 2x2 grid */
  #todayActivitySummary {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 12px !important;
  }
  #todayActivitySummary > div:nth-child(2) {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100%;
  }
  #todayActivitySummary .btn { display: none !important; }

  /* Cockpit grid */
  .cockpit-grid { grid-template-columns: 1fr; }
  .customer-card,
  .action-zone-wrapper { grid-column: span 1; }
  .customer-card {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  /* Incomplete sessions */
  #incompleteSessionsList {
    grid-template-columns: 1fr !important;
  }

  /* Charts */
  .charts-row {
    grid-template-columns: 1fr !important;
  }
}

/* === Chat UI Styles (Modern & Professional) === */
#chatMessages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  flex: 1; /* Make it expand to fill all remaining space in the container */
  overflow-y: auto;
  background-color: #f8fafc;
  background-image: radial-gradient(#cbd5e1 0.7px, transparent 0.7px);
  background-size: 16px 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-bottom: 0px;
  scroll-behavior: smooth;
  min-height: 250px;
}

.msg-bubble {
  max-width: 80%;
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
  margin-top: 5px;
}

.msg-bubble:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.05);
}

/* رسائل الإدارة (أنت) - الجهة اليمنى (RTL) */
.msg-admin {
  align-self: flex-start;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #f8fafc;
  border-radius: 16px 2px 16px 16px;
  text-align: right;
  border-right: 4px solid #3b82f6; /* Blue highlight */
}

.msg-admin .msg-sender-header {
  color: #93c5fd;
}

/* رسائل العميل - الجهة اليسرى (RTL) */
.msg-customer {
  align-self: flex-end;
  background: #ffffff;
  color: #1e293b;
  border-radius: 2px 16px 16px 16px;
  text-align: right;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #10b981; /* Green highlight */
}

.msg-customer .msg-sender-header {
  color: #10b981;
}

/* رسائل البوت (المساعد الذكي) - الجهة اليسرى (RTL) */
.msg-bot {
  align-self: flex-end;
  background: #eff6ff;
  color: #1e293b;
  border-radius: 2px 16px 16px 16px;
  text-align: right;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #6366f1; /* Purple highlight */
}

.msg-bot .msg-sender-header {
  color: #6366f1;
}

.msg-sender-header {
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.msg-time {
  display: block;
  font-size: 9px;
  margin-top: 6px;
  opacity: 0.7;
  text-align: left;
}

.msg-admin .msg-time {
  color: #cbd5e1;
}

.msg-customer .msg-time, .msg-bot .msg-time {
  color: #64748b;
}

/* Force wrapping for consistency */
#chatMessages div,
#detDesc,
.problem-box p {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.customer-card .cust-info,
.customer-card .car-info {
  width: 100%;
  /* Ensure full width availability */
}

.car-info div {
  justify-content: center !important;
  /* Center the VIN tags */
}

.modal-box {
  max-height: 85vh;
  /* Fallback */
  max-height: 85dvh;
  width: 95% !important;
  /* Force fit */
}

/* === Tablet (iPad) — Collapsed Sidebar === */
@media (min-width: 768px) and (max-width: 1100px) {
  .admin-layout {
    grid-template-columns: var(--sidebar-collapsed) 1fr;
  }

  .sidebar {
    width: var(--sidebar-collapsed);
    overflow: visible;
  }

  .sidebar-brand {
    padding: 15px 10px;
    justify-content: center;
  }
  .sidebar-brand > div { display: none; }
  .sidebar-brand img { height: 32px; }

  .sidebar-nav {
    padding: 8px;
    align-items: center;
  }

  /* Hide section labels and text on tablet */
  .sidebar-nav > div[style*="font-size:11px"] { display: none; }
  .sidebar-nav > div[style*="margin-top:auto"] { margin-top: auto !important; }

  .nav-item {
    justify-content: center;
    padding: 10px;
    font-size: 18px;
    border-radius: 10px;
    position: relative;
    width: 46px;
    height: 46px;
  }
  .nav-item.active {
    border-right: none;
    background: rgba(59,130,246,0.18);
  }

  /* Tooltip on hover */
  .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  .nav-item:hover::after {
    opacity: 1;
  }
  .nav-item.logout::after { content: 'خروج'; }

  .main-content {
    padding: 15px;
  }

  .cockpit-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .customer-card {
    grid-column: span 1;
  }

  .modal-box.large {
    width: 90%;
    max-height: 90vh;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card { padding: 15px; }
  .stat-card .icon { font-size: 24px; }
  .stat-card .info h3 { font-size: 20px; }

  /* Hide some table columns on tablet (7,8,9) */
  #dashboardView .main-table th:nth-child(7),
  #dashboardView .main-table td:nth-child(7),
  #dashboardView .main-table th:nth-child(8),
  #dashboardView .main-table td:nth-child(8),
  #dashboardView .main-table th:nth-child(9),
  #dashboardView .main-table td:nth-child(9) {
    display: none;
  }

  .map-box { height: 400px; }
}

/* === Admin Specific Styles (Moved from admin.html) === */
/* تنسيقات خاصة بالخريطة لتظهر بشكل صحيح */
.map-box {
  height: 250px;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 2px solid #ddd;
  z-index: 1;
}

#miniMap {
  height: 100%;
  width: 100%;
}

/* تنسيق الرسوم البيانية */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 25px;
}

.chart-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  height: 350px;
  position: relative;
}

/* تنسيقات الجوال للشارت */
@media (max-width: 1100px) {
  .charts-row {
    grid-template-columns: 1fr;
    height: auto;
  }

  .chart-card {
    height: 300px;
    margin-bottom: 15px;
  }
}

/* شارات الحالة */
.badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: bold;
  display: inline-block;
  white-space: nowrap;
}

.badge.green {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.badge.yellow {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #facc15;
}

.badge.red {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #ef4444;
}

/* عداد الوقت */
.timer-badge {
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
  display: inline-block;
  width: 100%;
  text-align: center;
}

.timer-badge.green {
  background: #ecfdf5;
  color: #047857;
  border: 1px dashed #059669;
}

.timer-badge.red {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px dashed #ef4444;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }

  100% {
    opacity: 1;
  }
}

/* تحسين زر التصدير */
.export-btn {
  background: #1e293b;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  transition: 0.3s;
}

.export-btn:hover {
  background: #334155;
}

/* === Testimonials (Reviews) Carousel CSS === */
.reviews-section {
  padding: 50px 20px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  direction: rtl;
  text-align: center;
}

.reviews-carousel-container {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  padding: 20px 0;
}

.reviews-carousel-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  padding: 10px;
  scrollbar-width: none; /* Firefox */
}

.reviews-carousel-track::-webkit-scrollbar {
  display: none; /* Safari/Chrome */
}

.review-slide-card {
  min-width: 320px;
  max-width: 350px;
  flex: 1 0 320px;
  background: white;
  padding: 25px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  text-align: right;
  scroll-snap-align: center;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.02), 0 4px 6px -2px rgba(0, 0, 0, 0.01);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.review-slide-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  border-color: #facc15;
}

.review-stars {
  color: #fbbf24;
  font-size: 20px;
  margin-bottom: 15px;
  display: flex;
  gap: 3px;
}

.review-text-content {
  font-size: 14.5px;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 20px;
  flex: 1;
  font-style: italic;
}

.review-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}

.review-author-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.review-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7 0%, #f59e0b 100%);
  color: #b45309;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

.review-author-name {
  font-weight: bold;
  font-size: 13.5px;
  color: #0f172a;
}

.review-location-tag {
  font-size: 11.5px;
  color: #94a3b8;
}

/* Controls for desktop slider */
.carousel-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 25px;
}

.carousel-btn {
  background: white;
  border: 1px solid #e2e8f0;
  color: #475569;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.03);
  transition: all 0.2s;
}

.carousel-btn:hover {
  background: #f8fafc;
  color: var(--primary);
  border-color: var(--primary);
  transform: scale(1.05);
}