/* =================================================================
   Suly Rent ERP — Main Stylesheet
   Developed by Senu (www.senu-quantum.com)
   ================================================================= */

/* ── Google Fonts ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ── CSS Custom Properties ────────────────────────────────────── */
:root {
  --sidebar-w: 260px;
  --navbar-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.22s ease;
  --font-ar: 'Noto Sans Arabic', Arial, sans-serif;
  --font-en: 'Inter', system-ui, sans-serif;
}

/* Dark Theme (default) */
[data-theme="dark"], :root {
  --bg-primary:    #0d0d14;
  --bg-secondary:  #13131f;
  --bg-card:       rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --bg-input:      rgba(255,255,255,0.06);
  --border:        rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);
  --text-primary:  #f0f0f5;
  --text-secondary:#8888aa;
  --text-muted:    #555570;
  --sidebar-bg:    #09090f;
  --sidebar-text:  #7878a0;
  --sidebar-hover: rgba(230,57,70,0.12);
  --sidebar-active-bg: rgba(230,57,70,0.15);
  --navbar-bg:     rgba(13,13,20,0.95);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.4);
  --shadow:        0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 48px rgba(0,0,0,0.7);
  --shadow-red:    0 4px 24px rgba(230,57,70,0.25);
  --table-stripe:  rgba(255,255,255,0.02);
  --table-hover:   rgba(255,255,255,0.04);
  --scrollbar-thumb: rgba(255,255,255,0.12);
}

/* Light Theme */
[data-theme="light"] {
  --bg-primary:    #f2f2fa;
  --bg-secondary:  #e8e8f5;
  --bg-card:       #ffffff;
  --bg-card-hover: #f8f8ff;
  --bg-input:      #ffffff;
  --border:        rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.18);
  --text-primary:  #1a1a2e;
  --text-secondary:#5a5a78;
  --text-muted:    #9090b0;
  --sidebar-bg:    #1a1a2e;
  --sidebar-text:  #8888a8;
  --sidebar-hover: rgba(230,57,70,0.1);
  --sidebar-active-bg: rgba(230,57,70,0.15);
  --navbar-bg:     rgba(242,242,250,0.95);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.06);
  --shadow:        0 4px 24px rgba(0,0,0,0.1);
  --shadow-lg:     0 8px 48px rgba(0,0,0,0.15);
  --shadow-red:    0 4px 24px rgba(230,57,70,0.2);
  --table-stripe:  rgba(0,0,0,0.02);
  --table-hover:   rgba(0,0,0,0.03);
  --scrollbar-thumb: rgba(0,0,0,0.15);
}

/* ── Accent Colors (shared) ───────────────────────────────────── */
:root {
  --red:          #e63946;
  --red-hover:    #ff4d5a;
  --red-dark:     #b02a35;
  --gold:         #f4a261;
  --gold-hover:   #ffc180;
  --green:        #2ecc71;
  --green-hover:  #3de07f;
  --blue:         #3498db;
  --gray:         #6c6c8a;
}

/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ar);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

[dir="ltr"] body { font-family: var(--font-en); }

a { color: var(--red); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--red-hover); }

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

img { max-width: 100%; height: auto; display: block; }

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ── Layout ───────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

[dir="rtl"] .sidebar { left: auto; right: 0; border-right: none; border-left: 1px solid var(--border); }

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.sidebar-logo img { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; }
.sidebar-logo-text { font-weight: 700; font-size: 1rem; color: var(--text-primary); line-height: 1.2; }
.sidebar-logo-text small { display: block; font-size: 0.7rem; font-weight: 400; color: var(--text-secondary); }

.sidebar-nav { flex: 1; padding: 16px 0; }

.nav-section-label {
  padding: 8px 20px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  border-radius: 0;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--red);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--red);
  border-radius: 0 2px 2px 0;
}
[dir="rtl"] .nav-link.active::before { left: auto; right: 0; border-radius: 2px 0 0 2px; }

.nav-link i { width: 20px; text-align: center; font-size: 1rem; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}
[dir="rtl"] .nav-badge { margin-left: 0; margin-right: auto; }

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user-avatar {
  width: 36px; height: 36px;
  background: var(--red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: white;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.72rem; color: var(--text-secondary); }

/* ── Top Navbar ───────────────────────────────────────────────── */
.top-navbar {
  position: fixed;
  top: 0; right: 0; left: var(--sidebar-w);
  height: var(--navbar-h);
  background: var(--navbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 90;
  gap: 12px;
}
[dir="rtl"] .top-navbar { left: 0; right: var(--sidebar-w); }

.navbar-left { display: flex; align-items: center; gap: 12px; }
.navbar-right { display: flex; align-items: center; gap: 10px; }

.btn-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-hamburger:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-icon-nav {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-icon-nav:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-strong); }

.lang-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  display: flex; align-items: center; gap: 6px;
}
.lang-toggle:hover { border-color: var(--red); color: var(--red); }

.user-dropdown { position: relative; }
.user-dropdown-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: all var(--transition);
}
.user-dropdown-btn:hover { border-color: var(--border-strong); }
.user-dropdown-btn .avatar {
  width: 26px; height: 26px;
  background: var(--red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: white;
}
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;
  z-index: 200;
}
[dir="rtl"] .user-dropdown-menu { right: auto; left: 0; }
.user-dropdown.open .user-dropdown-menu { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  text-decoration: none;
  transition: all var(--transition);
}
.dropdown-item:hover { background: var(--bg-card); color: var(--text-primary); }
.dropdown-item.danger:hover { color: var(--red); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* ── Main Content ─────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--navbar-h);
  min-height: calc(100vh - var(--navbar-h));
  padding: 28px 28px 60px;
  flex: 1;
}
[dir="rtl"] .main-content { margin-left: 0; margin-right: var(--sidebar-w); }

/* ── Page Header ──────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
}
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Breadcrumb ───────────────────────────────────────────────── */
.breadcrumb-nav { margin-bottom: 6px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; list-style: none; flex-wrap: wrap; }
.breadcrumb-item { font-size: 0.82rem; color: var(--text-secondary); }
.breadcrumb-item a { color: var(--text-secondary); }
.breadcrumb-item a:hover { color: var(--red); }
.breadcrumb-item + .breadcrumb-item::before { content: '/'; margin-right: 6px; color: var(--text-muted); }
[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before { margin-right: 0; margin-left: 6px; }
.breadcrumb-item.active { color: var(--text-primary); }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.card-header h2, .card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 24px; }
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* ── Stat Cards ───────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-color, var(--red));
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
  width: 50px; height: 50px;
  background: rgba(230,57,70,0.12);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: var(--accent-color, var(--red));
  flex-shrink: 0;
}
.stat-body { flex: 1; min-width: 0; }
.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent-color, var(--red));
  margin-bottom: 4px;
}
.stat-label { font-size: 0.82rem; color: var(--text-secondary); font-weight: 500; }

.stat-card.green  { --accent-color: var(--green);  .stat-icon { background: rgba(46,204,113,0.12); } }
.stat-card.gold   { --accent-color: var(--gold);   .stat-icon { background: rgba(244,162,97,0.12); } }
.stat-card.blue   { --accent-color: var(--blue);   .stat-icon { background: rgba(52,152,219,0.12); } }
.stat-card.gray   { --accent-color: var(--gray);   .stat-icon { background: rgba(108,108,138,0.12); } }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
  line-height: 1;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--red), #c0303a);
  color: white;
  box-shadow: 0 2px 12px rgba(230,57,70,0.3);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--red-hover), var(--red)); box-shadow: var(--shadow-red); color: white; }

.btn-success {
  background: linear-gradient(135deg, var(--green), #27ae60);
  color: white;
  box-shadow: 0 2px 12px rgba(46,204,113,0.25);
}
.btn-success:hover { filter: brightness(1.1); color: white; }

.btn-warning {
  background: linear-gradient(135deg, var(--gold), #e08040);
  color: white;
}
.btn-warning:hover { filter: brightness(1.1); color: white; }

.btn-danger {
  background: linear-gradient(135deg, #c0303a, #900);
  color: white;
}
.btn-danger:hover { filter: brightness(1.1); color: white; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-strong); }

.btn-outline {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}
.btn-outline:hover { background: var(--red); color: white; }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
.btn-icon.btn-sm { width: 30px; height: 30px; padding: 6px; }

/* ── Forms ────────────────────────────────────────────────────── */
.form-section { margin-bottom: 28px; }
.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--red);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group label .req { color: var(--red); margin-inline-start: 3px; }

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(230,57,70,0.12);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
select.form-control option { background: var(--bg-secondary); color: var(--text-primary); }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-control[type="range"] {
  padding: 0;
  height: 6px;
  background: var(--border);
  border: none;
  border-radius: 3px;
  cursor: pointer;
}
.form-control[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--red);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.form-row { display: grid; gap: 18px; }
.form-row.col-2 { grid-template-columns: repeat(2, 1fr); }
.form-row.col-3 { grid-template-columns: repeat(3, 1fr); }
.form-row.col-4 { grid-template-columns: repeat(4, 1fr); }

.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.78rem; color: var(--red); margin-top: 4px; }

.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
[dir="rtl"] .input-group .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
[dir="rtl"] .input-group .btn { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

/* ── Tables ───────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th {
  padding: 12px 16px;
  text-align: start;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--red);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:nth-child(even) { background: var(--table-stripe); }
.data-table tbody tr:hover { background: var(--table-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.data-table .num { font-weight: 600; font-variant-numeric: tabular-nums; }

.table-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.table-empty i { font-size: 2.5rem; margin-bottom: 12px; display: block; }

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.badge-success  { background: rgba(46,204,113,0.15);  color: #2ecc71;  border: 1px solid rgba(46,204,113,0.3); }
.badge-danger   { background: rgba(230,57,70,0.15);   color: #e63946;  border: 1px solid rgba(230,57,70,0.3);  }
.badge-warning  { background: rgba(244,162,97,0.15);  color: #f4a261;  border: 1px solid rgba(244,162,97,0.3); }
.badge-info     { background: rgba(52,152,219,0.15);  color: #3498db;  border: 1px solid rgba(52,152,219,0.3); }
.badge-secondary{ background: rgba(108,108,138,0.15); color: #8888aa;  border: 1px solid rgba(108,108,138,0.3);}
.badge-red      { background: var(--red); color: white; }

/* ── Alerts ───────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border-inline-start: 4px solid;
  margin-bottom: 20px;
  font-size: 0.9rem;
}
.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: rgba(46,204,113,0.1);  border-color: var(--green); color: #2ecc71; }
.alert-danger   { background: rgba(230,57,70,0.1);  border-color: var(--red);   color: #e63946; }
.alert-warning  { background: rgba(244,162,97,0.1); border-color: var(--gold);  color: #f4a261; }
.alert-info     { background: rgba(52,152,219,0.1); border-color: var(--blue);  color: #3498db; }

/* ── Filter & Search ──────────────────────────────────────────── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: flex-end;
  margin-bottom: 20px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-group { display: flex; flex-direction: column; gap: 5px; min-width: 150px; }
.filter-group label { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.filter-group .form-control { min-width: 140px; }
.filter-actions { display: flex; gap: 8px; align-items: flex-end; margin-top: auto; }

.search-bar { display: flex; gap: 0; max-width: 340px; }
.search-bar .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.search-bar .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
[dir="rtl"] .search-bar .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
[dir="rtl"] .search-bar .btn { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

.status-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px;
}
.status-tab {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
}
.status-tab:hover { border-color: var(--border-strong); color: var(--text-primary); }
.status-tab.active { background: var(--red); border-color: var(--red); color: white; }

/* ── Modal ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-lg { max-width: 720px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 1.2rem;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-card); color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── Car Cards (Grid) ─────────────────────────────────────────── */
.car-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.car-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
}
.car-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.car-card-img {
  height: 180px;
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  position: relative;
}
.car-card-img img { width: 100%; height: 100%; object-fit: cover; }
.car-card-img .no-photo { font-size: 3rem; color: var(--text-muted); }
.car-card-status { position: absolute; top: 10px; right: 10px; }
[dir="rtl"] .car-card-status { right: auto; left: 10px; }
.car-card-body { padding: 18px; }
.car-card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.car-card-sub { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 12px; }
.car-card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.car-card-meta span { font-size: 0.78rem; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.car-card-actions { display: flex; gap: 8px; }

/* ── Photos Grid ──────────────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.photo-item {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.photo-item:hover img { transform: scale(1.05); }
.photo-item .photo-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  opacity: 0; transition: opacity var(--transition);
}
.photo-item:hover .photo-overlay { opacity: 1; }
.photo-primary-badge {
  position: absolute; bottom: 6px; left: 6px;
  background: var(--red); color: white;
  font-size: 0.65rem; font-weight: 700; padding: 2px 6px; border-radius: 4px;
}

/* Drag-drop upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
  position: relative;
  display: block;
  user-select: none;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--red);
  background: rgba(230,57,70,0.05);
  color: var(--text-secondary);
}
/* CRITICAL: always hide the actual file input — click is handled by JS */
.upload-zone input[type="file"] {
  display: none !important;
  position: absolute;
  width: 0; height: 0;
  opacity: 0;
  pointer-events: none;
}
.upload-zone i { font-size: 2rem; margin-bottom: 8px; display: block; color: var(--text-muted); }
.upload-zone p { margin: 4px 0; }
.upload-filename { font-size: 0.82rem; color: var(--text-secondary); margin-top: 6px; word-break: break-all; }

/* ── File List ────────────────────────────────────────────────── */
.file-list { list-style: none; }
.file-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  background: var(--bg-card);
}
.file-list li:hover { background: var(--bg-card-hover); }
.file-icon { font-size: 1.2rem; color: var(--red); width: 24px; text-align: center; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 0.88rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 0.75rem; color: var(--text-muted); }
.file-actions { display: flex; gap: 6px; }

/* ── Fuel Bar ─────────────────────────────────────────────────── */
.fuel-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 2px;
}
.fuel-bar { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.fuel-display { display: flex; align-items: center; gap: 8px; }
.fuel-display small { font-size: 0.78rem; color: var(--text-secondary); white-space: nowrap; }

/* ── Pagination ───────────────────────────────────────────────── */
.pagination-nav { display: flex; justify-content: center; margin-top: 24px; }
.pagination { display: flex; gap: 6px; list-style: none; align-items: center; }
.page-link {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-decoration: none;
  transition: all var(--transition);
  font-weight: 500;
}
.page-link:hover { border-color: var(--red); color: var(--red); }
.page-link.active { background: var(--red); border-color: var(--red); color: white; }

/* ── Overdue Pulse ────────────────────────────────────────────── */
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(230,57,70,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(230,57,70,0); }
}
.overdue-pulse { animation: pulse-red 2s infinite; }

/* ── Tabs ─────────────────────────────────────────────────────── */
.tab-nav {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab-link {
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  text-decoration: none;
  transition: all var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.tab-link:hover { color: var(--text-primary); }
.tab-link.active { color: var(--red); border-bottom-color: var(--red); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Checkbox & Radio ─────────────────────────────────────────── */
.check-list { display: flex; flex-direction: column; gap: 10px; }
.check-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.check-item:hover { border-color: var(--red); background: rgba(230,57,70,0.04); }
.check-item input[type="checkbox"] {
  width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px;
  accent-color: var(--red);
}
.check-item .check-text { font-size: 0.88rem; line-height: 1.5; }

/* ── Toast Notifications ──────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
[dir="rtl"] #toast-container { right: auto; left: 24px; }
.toast {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  font-weight: 500;
  max-width: 320px;
  display: flex; align-items: center; gap: 10px;
  animation: slideInToast 0.3s ease;
  border-inline-start: 4px solid var(--green);
  color: var(--text-primary);
}
.toast.error { border-inline-start-color: var(--red); }
.toast.warning { border-inline-start-color: var(--gold); }
.toast.info { border-inline-start-color: var(--blue); }
@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
[dir="rtl"] @keyframes slideInToast {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

/* ── Summary Bar ──────────────────────────────────────────────── */
.summary-bar {
  display: flex; gap: 24px; flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.summary-item { display: flex; flex-direction: column; gap: 2px; }
.summary-item .s-value { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.summary-item .s-label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }
.summary-item.highlight .s-value { color: var(--red); }
.summary-item.positive .s-value { color: var(--green); }

/* ── Quick Action Cards ───────────────────────────────────────── */
.quick-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.quick-action-card {
  flex: 1; min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.quick-action-card:hover {
  background: rgba(230,57,70,0.08);
  border-color: var(--red);
  color: var(--red);
  transform: translateY(-2px);
}
.quick-action-card i { font-size: 2rem; margin-bottom: 8px; display: block; }
.quick-action-card span { font-size: 0.88rem; font-weight: 600; }

/* ── Invoice Preview ──────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.info-row {
  display: contents;
}
.info-label {
  padding: 10px 14px;
  background: var(--table-stripe);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.info-value {
  padding: 10px 14px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  border-inline-start: 1px solid var(--border);
}

/* ── Color Helpers ────────────────────────────────────────────── */
.text-red    { color: var(--red) !important; }
.text-green  { color: var(--green) !important; }
.text-gold   { color: var(--gold) !important; }
.text-muted  { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.fw-bold     { font-weight: 700 !important; }
.fw-600      { font-weight: 600 !important; }
.text-end    { text-align: end !important; }
.text-center { text-align: center !important; }
.mt-auto     { margin-top: auto; }
.d-flex      { display: flex; }
.align-center{ align-items: center; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.mb-0        { margin-bottom: 0 !important; }
.mb-2        { margin-bottom: 8px !important; }
.mb-3        { margin-bottom: 16px !important; }
.mb-4        { margin-bottom: 24px !important; }
.w-100       { width: 100%; }

/* ── Login Page ───────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: fixed;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(230,57,70,0.08) 0%, transparent 70%);
  top: -200px; left: -200px;
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: fixed;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(244,162,97,0.06) 0%, transparent 70%);
  bottom: -200px; right: -200px;
  pointer-events: none;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  position: relative; z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { width: 80px; height: 80px; object-fit: contain; margin: 0 auto 12px; }
.login-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--red); }
.login-logo p { font-size: 0.82rem; color: var(--text-secondary); }
.login-lang { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; }
.login-lang a {
  padding: 5px 16px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
  text-decoration: none; transition: all var(--transition);
}
.login-lang a.active, .login-lang a:hover { background: var(--red); border-color: var(--red); color: white; }

/* ── App footer ───────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.app-footer a { color: var(--text-muted); }
.app-footer a:hover { color: var(--red); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row.col-4 { grid-template-columns: repeat(2, 1fr); }
  .form-row.col-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }

  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
  }
  body.sidebar-open .sidebar-overlay { display: block; }

  .top-navbar { left: 0 !important; right: 0 !important; }
  .btn-hamburger { display: flex !important; }
  .main-content { margin-left: 0 !important; margin-right: 0 !important; padding: 16px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .form-row.col-2, .form-row.col-3, .form-row.col-4 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .filter-bar { padding: 14px; }
  .info-grid { grid-template-columns: 1fr; }
  .info-label { border-bottom: none; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .car-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
}

/* ── RTL Specifics ────────────────────────────────────────────── */
[dir="rtl"] .stat-icon { margin-right: 0; }
[dir="rtl"] .form-control[type="range"]::-webkit-slider-thumb { }
[dir="rtl"] .alert { border-left: none; border-right: 4px solid; }
[dir="rtl"] .nav-link.active::before { border-radius: 2px 0 0 2px; }

/* ── Print hidden ─────────────────────────────────────────────── */
@media print {
  .sidebar, .top-navbar, .btn, .filter-bar, .pagination-nav,
  .modal-overlay, #toast-container, .page-header-actions,
  .card-footer, .sidebar-overlay, .app-footer { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
