/* =============================================================================
   CityRent – Unified Design System
   app.css · v1.0
============================================================================= */

/* ── Google Font (chargé via <head>) ────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Custom Properties ───────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:           #0f1117;
  --sidebar-bg:   #16181f;
  --surface:      #1e2130;
  --surface2:     #252839;
  --surface3:     #2d3148;

  /* Accent */
  --accent:       #4f7cff;
  --accent-dim:   #2a3f7e;
  --accent-light: #6b8fff;

  /* Text */
  --text:         #e8eaf0;
  --text-muted:   #8890a6;
  --text-dim:     #5c6378;

  /* Borders */
  --border:       #2c2f3e;

  /* Status colours */
  --danger:       #f05060;
  --success:      #3ecf8e;
  --warning:      #f0a030;
  --info:         #50a0f0;

  /* Shapes */
  --radius:       14px;
  --radius-sm:    8px;
  --radius-xs:    4px;

  /* Shadows */
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.25);
  --shadow-md:    0 6px 24px rgba(0,0,0,0.35);
  --shadow-lg:    0 16px 48px rgba(0,0,0,0.5);
}

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

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ────────────────────────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Navigation ────────────────────────────────────────────────────────────────── */
.nav {
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 200;
  height: 52px;
  flex-shrink: 0;
}

.nav-brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 24px;
  white-space: nowrap;
  text-decoration: none;
}

.nav-links { display: flex; gap: 2px; }

.nav-link {
  padding: 0 14px;
  height: 52px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color 0.18s, background 0.18s;
  border-bottom: 2px solid transparent;
  position: relative;
}
.nav-link:hover  { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-link.active { color: var(--accent-light); border-bottom-color: var(--accent); }

/* ── Page Header ──────────────────────────────────────────────────────────────── */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-shrink: 0;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header h1 em { font-style: normal; color: var(--accent-light); }

.page-meta { font-size: 13px; color: var(--text-muted); }

/* ── Hero Gradient Section ────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0f1117 0%, #1a1f35 50%, #0f1117 100%);
  border-bottom: 1px solid var(--border);
  padding: 36px 24px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(79,124,255,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 50%, rgba(62,207,142,0.06) 0%, transparent 60%);
  pointer-events: none;
}
.hero-inner { max-width: 900px; margin: 0 auto; position: relative; }
.hero h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 12px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--text-muted); font-size: 14px; }

/* ── Stats Row ────────────────────────────────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  min-width: 120px;
}
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--accent-light); }
.stat-card.green .stat-value { color: var(--success); }
.stat-card.orange .stat-value { color: var(--warning); }
.stat-card.blue .stat-value   { color: var(--info); }
.stat-card.red .stat-value    { color: var(--danger); }

/* Legacy aliases used in fleet_cars.php */
.stats { display: flex; gap: 24px; align-items: center; }
.stat  { display: flex; flex-direction: column; align-items: center; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--accent-light); }
.stat-label { font-size: 11px; color: var(--text-muted); }

/* ── Filters Bar ──────────────────────────────────────────────────────────────── */
.filters {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; }

.filter-group label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.filter-group input,
.filter-group select,
.field input,
.field select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  min-width: 140px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.filter-group input:focus,
.filter-group select:focus,
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,124,255,0.15);
}
.filter-group input[type="date"],
.field input[type="date"] { color-scheme: dark; }

/* ── Search Form (hero variant) ──────────────────────────────────────────────── */
.search-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}

.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; }
.field.large { flex: 2; }

.field label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.field input,
.field select {
  padding: 10px 14px;
  font-size: 14px;
}

/* duration badge inside search form */
.duration-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  height: 42px;
}
.duration-badge .val  { font-size: 18px; font-weight: 700; color: var(--accent-light); }
.duration-badge .unit { font-size: 12px; color: var(--text-muted); }

/* ── Buttons ──────────────────────────────────────────────────────────────────── */
.btn, button.btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover { background: var(--accent-light); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  height: 42px; padding: 0 24px; font-size: 14px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(79,124,255,0.35); }

.btn-success {
  background: linear-gradient(135deg, var(--success), #2aaa74);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(62,207,142,0.3); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-outline:hover { background: var(--surface2); color: var(--text); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #d93040; }

.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 30px; height: 30px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all 0.18s;
  font-family: inherit;
}
.btn-icon:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-light); }

/* ── Main Content ─────────────────────────────────────────────────────────────── */
.main { flex: 1; padding: 24px; }

/* ── Table ────────────────────────────────────────────────────────────────────── */
.table-wrap,
.table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  background: var(--surface2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

tr:hover td { background: var(--surface2); cursor: pointer; }
tr:last-child td { border-bottom: none; }

/* ── Badges & Chips ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}

.badge-accent  { background: var(--accent-dim); color: var(--accent-light); }
.badge-success { background: rgba(62,207,142,0.15); color: var(--success); }
.badge-danger  { background: rgba(240,80,96,0.15);  color: var(--danger); }
.badge-warning { background: rgba(240,160,48,0.15); color: var(--warning); }
.badge-info    { background: rgba(80,160,240,0.15); color: var(--info); }
.badge-muted   { background: rgba(136,144,166,0.15); color: var(--text-muted); }

/* Status badge with dot */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.status-badge::before { content: '●'; font-size: 8px; }
.status-badge.active, .status-badge.success { background: rgba(62,207,142,0.15); color: var(--success); }
.status-badge.inactive, .status-badge.danger { background: rgba(240,80,96,0.15); color: var(--danger); }
.status-badge.archived, .status-badge.warning { background: rgba(240,160,48,0.15); color: var(--warning); }
.status-badge.info    { background: rgba(80,160,240,0.15); color: var(--info); }
.status-badge.muted   { background: rgba(136,144,166,0.15); color: var(--text-muted); }

/* Category chip */
.category-badge, .category-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-dim); color: var(--accent-light);
  padding: 3px 9px; border-radius: var(--radius-xs);
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
}
.category-code {
  background: var(--accent-dim); color: var(--accent-light);
  padding: 2px 6px; border-radius: 3px;
  font-size: 10px; font-weight: 600;
}

/* Canal badge */
.canal-badge {
  background: var(--surface3); color: var(--text-dim);
  padding: 2px 8px; border-radius: var(--radius-xs);
  font-size: 10px; font-weight: 600; letter-spacing: 0.5px;
}

/* Car info cell */
.car-info { display: flex; flex-direction: column; gap: 2px; }
.car-plate { font-weight: 700; font-size: 13px; color: var(--accent-light); font-family: monospace; letter-spacing: 0.5px; }
.car-model { font-size: 12px; color: var(--text); }
.car-brand { font-size: 11px; color: var(--text-muted); }

/* Spec badges */
.specs { display: flex; gap: 6px; flex-wrap: wrap; }
.spec-badge {
  background: var(--surface2); padding: 3px 8px;
  border-radius: var(--radius-xs); font-size: 10px;
  color: var(--text-muted); white-space: nowrap;
}

/* Price cells */
.price-cell, .price-day { font-weight: 700; color: var(--success); white-space: nowrap; }
.price-deposit, .price-duration { font-size: 11px; color: var(--text-muted); }
.price-info { display: flex; flex-direction: column; gap: 2px; }

/* Booking status */
.booking-status { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.booking-current   { color: var(--success); }
.booking-next      { color: var(--warning); }
.booking-available { color: var(--text-muted); }
.duration-badge-sm {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface3); padding: 3px 8px;
  border-radius: var(--radius-xs); font-size: 11px; color: var(--text-muted);
}

/* ── Pagination ───────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.pagination-info { font-size: 13px; color: var(--text-muted); }
.pagination-pages { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination-pages a,
.pagination-pages span {
  padding: 5px 12px;
  background: var(--surface2);
  border-radius: var(--radius-xs);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.18s;
}
.pagination-pages a:hover { background: var(--accent-dim); }
.pagination-pages a.active { background: var(--accent); color: white; }
.pagination-pages span.dots { color: var(--text-muted); background: transparent; padding: 5px 4px; }

/* ── Cards ────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.card:hover { border-color: var(--accent-dim); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.card-header {
  background: linear-gradient(135deg, var(--surface2), var(--surface3));
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.card-body  { padding: 16px 18px; flex: 1; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border); }

/* ── Modal ────────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.78);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; animation: cr-fadeIn 0.2s ease; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: cr-slideUp 0.22s ease;
  box-shadow: var(--shadow-lg);
}

.modal-sm { max-width: 540px; }
.modal-lg { max-width: 1000px; }

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.modal-header h2, .modal-title {
  font-size: 17px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; cursor: pointer; padding: 4px; line-height: 1; font-family: inherit;
}
.modal-close:hover { color: var(--text); }

.modal-body  { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; gap: 12px;
  flex-shrink: 0;
}

/* ── Detail Grid (inside modals / cards) ─────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.detail-card {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.detail-card h3,
.detail-card h4 {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); font-weight: 600;
  margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.detail-row {
  display: flex; justify-content: space-between;
  padding: 5px 0; font-size: 13px;
}
.detail-label, .dl { color: var(--text-muted); }
.detail-value, .dv { font-weight: 500; text-align: right; max-width: 200px; word-break: break-word; }
.dv.green  { color: var(--success); }
.dv.accent { color: var(--accent-light); }
.dv.mono   { font-family: monospace; font-size: 12px; }

/* ── Booking Summary (inside modal) ──────────────────────────────────────────── */
.booking-summary {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 18px;
}
.booking-summary h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.bs-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.bs-label { color: var(--text-muted); }
.bs-value { font-weight: 600; }
.bs-value.price { color: var(--success); font-size: 22px; }

/* ── States ───────────────────────────────────────────────────────────────────── */
.state-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.state-icon  { font-size: 48px; margin-bottom: 14px; }
.state-title { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.state-sub   { font-size: 14px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }

/* ── Loading spinner ─────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: cr-spin 0.8s linear infinite;
  margin-bottom: 14px;
}
@keyframes cr-spin { to { transform: rotate(360deg); } }

/* ── Alerts ───────────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 13px;
  display: flex; align-items: flex-start; gap: 8px;
}
.alert-danger  { background: rgba(240,80,96,0.12);  color: var(--danger);  border: 1px solid rgba(240,80,96,0.25); }
.alert-success { background: rgba(62,207,142,0.12); color: var(--success); border: 1px solid rgba(62,207,142,0.25); }
.alert-info    { background: rgba(80,160,240,0.12); color: var(--info);    border: 1px solid rgba(80,160,240,0.25); }
.alert-warning { background: rgba(240,160,48,0.12); color: var(--warning); border: 1px solid rgba(240,160,48,0.25); }

/* ── Form fields ─────────────────────────────────────────────────────────────── */
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-field label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.form-field input, .form-field select, .form-field textarea {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--text); font-size: 14px; font-family: inherit;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,124,255,0.15);
}

/* ── Dividers ─────────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ── Success Modal State ─────────────────────────────────────────────────────── */
.success-modal { text-align: center; padding: 36px 24px; }
.success-icon  { font-size: 54px; margin-bottom: 14px; }
.success-title { font-size: 22px; font-weight: 700; color: var(--success); margin-bottom: 8px; }
.success-ref {
  background: var(--surface2); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); padding: 14px; margin: 14px 0;
  font-family: monospace; font-size: 20px; font-weight: 700;
  color: var(--accent-light); letter-spacing: 2px;
}
.success-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }

/* ── Keyframe animations ─────────────────────────────────────────────────────── */
@keyframes cr-fadeIn  { from { opacity:0 } to { opacity:1 } }
@keyframes cr-slideUp { from { transform: translateY(18px); opacity:0 } to { transform: translateY(0); opacity:1 } }
@keyframes cr-pulse   { 0%,100%{opacity:1} 50%{opacity:.4} }
@keyframes cr-bounce  { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-7px)} }

/* ── Responsive ────────────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  th.hide-md, td.hide-md { display: none; }
  .stats-row { flex-wrap: wrap; }
}
@media (max-width: 900px) {
  th.hide-sm, td.hide-sm { display: none; }
}
@media (max-width: 768px) {
  .nav-link span.label { display: none; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .filters { flex-direction: column; }
  .search-form { flex-direction: column; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 16px; }
  .modal { max-width: 100%; margin: 0; border-radius: 0; max-height: 100vh; }
}

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