/* CarFinder — styles maison, sans dépendance externe (le site doit marcher
   même sans connexion à un CDN). */

:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #22c55e;
  --accent-dark: #15803d;
  --warn: #f59e0b;
  --warn-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --navy: #0f172a;
  --navy-2: #1e293b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -8px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */

.cf-shell { min-height: 100vh; display: flex; flex-direction: column; }

.cf-topbar {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #f8fafc;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  flex-wrap: wrap;
  gap: 8px;
}

.cf-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.cf-brand img { width: 32px; height: 32px; }
.cf-brand .cf-tag { color: #7dd3fc; font-weight: 500; font-size: 12px; }

.cf-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cf-nav a, .cf-nav .cf-navlink {
  color: #cbd5e1;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.cf-nav a:hover { background: rgba(255,255,255,0.08); text-decoration: none; color: #fff; }
.cf-nav a.active { background: rgba(56, 189, 248, 0.18); color: #7dd3fc; }
.cf-nav .cf-user-pill {
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
}
.cf-nav .cf-role-badge {
  background: var(--accent);
  color: #06240f;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  text-transform: uppercase;
}

.cf-main { flex: 1; padding: 28px 20px 60px; max-width: 1160px; margin: 0 auto; width: 100%; }

.cf-page-title { font-size: 26px; font-weight: 800; margin: 0 0 4px; letter-spacing: -0.02em; }
.cf-page-sub { color: var(--text-muted); margin: 0 0 24px; font-size: 14.5px; }

/* ---------- Cards / panels ---------- */

.cf-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.cf-card h2 { margin-top: 0; font-size: 17px; font-weight: 700; }
.cf-card h3 { font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 22px 0 10px; }
.cf-card h3:first-child { margin-top: 0; }

.cf-grid { display: grid; gap: 16px; }
.cf-grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.cf-grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.cf-grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 720px) {
  .cf-grid.cols-2, .cf-grid.cols-3, .cf-grid.cols-4 { grid-template-columns: 1fr; }
}

/* ---------- Stat tiles ---------- */

.cf-stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.cf-stat .n { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.cf-stat .l { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* ---------- Forms ---------- */

label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.cf-field { margin-bottom: 16px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
textarea { resize: vertical; min-height: 90px; }
.cf-help { color: var(--text-muted); font-size: 12.5px; margin-top: 5px; }

.cf-checkline { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cf-checkline input[type=checkbox] { width: 18px; height: 18px; }
.cf-checkline label { margin: 0; font-weight: 600; color: var(--text); font-size: 14px; }

/* ---------- Buttons ---------- */

.cf-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background 0.15s, transform 0.05s;
}
.cf-btn:hover { background: var(--primary-dark); }
.cf-btn:active { transform: scale(0.98); }
.cf-btn.secondary { background: var(--surface-2); color: var(--text); border: 1.5px solid var(--border); }
.cf-btn.secondary:hover { background: #eef1f6; }
.cf-btn.danger { background: var(--danger); }
.cf-btn.danger:hover { background: #dc2626; }
.cf-btn.accent { background: var(--accent); color: #06240f; }
.cf-btn.accent:hover { background: var(--accent-dark); color: #fff; }
.cf-btn.small { padding: 6px 12px; font-size: 12.5px; }

/* ---------- Alerts / flash ---------- */

.cf-flash {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 18px;
  font-weight: 600;
}
.cf-flash.err { background: var(--danger-bg); border-color: #fecaca; color: #991b1b; }

/* ---------- Table ---------- */

table.cf-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.cf-table th { text-align: left; color: var(--text-muted); font-weight: 700; text-transform: uppercase; font-size: 11.5px; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 2px solid var(--border); }
table.cf-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.cf-table tr:hover td { background: var(--surface-2); }

.cf-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.cf-badge.ok { background: #dcfce7; color: #166534; }
.cf-badge.warn { background: #fef3c7; color: #92400e; }
.cf-badge.err { background: #fee2e2; color: #991b1b; }
.cf-badge.muted { background: #e2e8f0; color: #475569; }

/* ---------- Login ---------- */

.cf-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 20% 10%, #1e3a8a 0%, #0f172a 55%); padding: 20px; }
.cf-login-card { background: #fff; border-radius: 18px; padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: 0 30px 60px -20px rgba(0,0,0,0.4); }
.cf-login-card .cf-brand { color: var(--text); justify-content: center; margin-bottom: 4px; }
.cf-login-card .cf-brand .cf-tag { color: var(--text-muted); }
.cf-login-sub { text-align: center; color: var(--text-muted); font-size: 13.5px; margin: 4px 0 22px; }
.cf-login-card .cf-btn { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- Listing cards (user dashboard) ---------- */

.cf-listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.cf-listing {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.cf-listing .thumb { width: 100%; height: 150px; background: var(--surface-2) center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 13px; }
.cf-listing .body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.cf-listing .titre { font-weight: 700; font-size: 14.5px; line-height: 1.3; }
.cf-listing .titre a { color: var(--text); }
.cf-listing .prix { font-size: 22px; font-weight: 800; color: var(--text); }
.cf-listing .prix.deal { color: var(--accent-dark); }
.cf-listing .meta { color: var(--text-muted); font-size: 12.5px; }
.cf-listing .ecart { font-weight: 700; font-size: 12.5px; }
.cf-listing .ecart.ok { color: var(--accent-dark); }
.cf-listing .ecart.warn { color: #b45309; }
.cf-listing .footer { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.cf-listing .probleme { background: var(--warn-bg); color: #92400e; font-size: 11.5px; padding: 4px 8px; border-radius: 8px; font-weight: 600; }

.cf-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.cf-filters .cf-field { margin-bottom: 0; min-width: 140px; flex: 1; }

.cf-pagination { display: flex; gap: 8px; justify-content: center; margin-top: 24px; }
.cf-empty { text-align: center; color: var(--text-muted); padding: 60px 20px; }
