@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --c-blue-900: #1a237e;
  --c-blue-700: #283593;
  --c-blue-500: #3949ab;
  --c-blue-300: #7986cb;
  --c-blue-100: #c5cae9;
  --c-blue-50:  #e8eaf6;
  --c-gold-700: #f9a825;
  --c-gold-500: #fdd835;
  --c-gold-300: #fff176;
  --c-gold-100: #fff9c4;
  --c-red:      #e53935;
  --c-green:    #43a047;
  --c-orange:   #fb8c00;

  --bg:         #f5f6fa;
  --surface:    #ffffff;
  --border:     #e0e3eb;
  --text:       #1e293b;
  --muted:      #64748b;
  --primary:    var(--c-blue-700);
  --primary-light: var(--c-blue-50);
  --accent:     var(--c-gold-500);
  --danger:     var(--c-red);
  --success:    var(--c-green);
  --warning:    var(--c-orange);

  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg:  0 4px 12px rgba(0,0,0,.1);
  --radius:     8px;
  --radius-lg:  12px;
  --font:       "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  background: var(--primary); color: #fff;
  padding: 0 24px; height: 56px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.topbar .brand { color: #fff; font-weight: 800; font-size: 18px; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.topbar .brand span { opacity: .7; font-weight: 400; font-size: 13px; }
.topbar nav { display: flex; gap: 2px; margin-left: 24px; }
.topbar nav a {
  color: rgba(255,255,255,.75); font-weight: 600; font-size: 13px;
  padding: 8px 14px; border-radius: 6px; text-decoration: none; transition: .15s;
}
.topbar nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar nav a.active { background: rgba(255,255,255,.2); color: #fff; }
.topbar .spacer { flex: 1; }
.topbar .user-info { color: rgba(255,255,255,.8); font-size: 13px; }
.topbar .btn-logout {
  background: rgba(255,255,255,.15); color: #fff; border: none; padding: 6px 14px;
  border-radius: 6px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.topbar .btn-logout:hover { background: rgba(255,255,255,.25); }

.container { padding: 24px; max-width: 1280px; margin: 0 auto; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 24px; margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

/* ---------- Stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 20px; text-align: center;
}
.stat-card .stat-value { font-size: 32px; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; }
.toolbar .grow { flex: 1; }

/* ---------- Controls ---------- */
select, input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], textarea {
  font: inherit; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; background: var(--surface); outline: none; transition: .15s;
}
select:focus, input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--c-blue-100); }
textarea { resize: vertical; min-height: 80px; width: 100%; }

label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; color: var(--muted); }
label.field input, label.field select, label.field textarea { width: 100%; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 16px; border-radius: var(--radius); transition: .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--c-blue-500); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger:hover { opacity: .9; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.ghost { border: none; background: none; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-light); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: var(--bg); color: var(--muted); font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--border); white-space: nowrap; }
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--primary-light); }
tbody tr { cursor: pointer; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 50px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge.foot_senior { background: #dbeafe; color: #1e40af; }
.badge.foot_junior { background: #e0e7ff; color: #3730a3; }
.badge.flag { background: #fef3c7; color: #92400e; }
.badge.valide { background: #d1fae5; color: #065f46; }
.badge.expiré, .badge.manquant { background: #fee2e2; color: #991b1b; }
.badge.bientôt { background: #fef3c7; color: #92400e; }
.badge.actif { background: #d1fae5; color: #065f46; }
.badge.inactif { background: #f1f5f9; color: #64748b; }
.badge.blessé { background: #fee2e2; color: #991b1b; }
.badge.payée { background: #d1fae5; color: #065f46; }
.badge.partielle { background: #fef3c7; color: #92400e; }
.badge.impayée { background: #fee2e2; color: #991b1b; }
.badge.disponible { background: #d1fae5; color: #065f46; }
.badge.attribué { background: #dbeafe; color: #1e40af; }
.badge.hors_service { background: #f1f5f9; color: #64748b; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tabs button {
  font: inherit; font-weight: 600; font-size: 14px; background: none; border: none;
  padding: 10px 20px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: .15s;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; }
.modal.hidden { display: none; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); }
.modal-panel {
  position: relative; background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; max-height: 80vh;
  overflow-y: auto; padding: 28px;
}
.modal-panel h2 { margin-bottom: 20px; }
.modal-close { position: absolute; top: 12px; right: 16px; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); }
.modal-close:hover { color: var(--text); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 24px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; z-index: 200; box-shadow: var(--shadow-lg);
  transition: opacity .3s;
}
.toast.hidden { opacity: 0; pointer-events: none; }
.toast.err { background: var(--danger); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--c-blue-900) 0%, var(--c-blue-500) 100%);
}
.login-card {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 40px; width: 100%; max-width: 400px; text-align: center;
}
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-card .subtitle { color: var(--muted); margin-bottom: 24px; }
.login-card label.field { text-align: left; }
.login-card .btn { width: 100%; margin-top: 8px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .icon { font-size: 48px; margin-bottom: 12px; }

/* ---------- Section filter pills ---------- */
.pills { display: flex; gap: 6px; }
.pill {
  font: inherit; font-weight: 600; font-size: 12px; padding: 5px 14px;
  border-radius: 50px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; color: var(--muted); transition: .15s;
}
.pill:hover { border-color: var(--primary); color: var(--primary); }
.pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Detail panel ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; margin-bottom: 20px; }
.detail-grid .label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.detail-grid .value { font-size: 14px; margin-bottom: 8px; }
.detail-section { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.detail-section h3 { margin-bottom: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 6px; }
  .topbar .brand { font-size: 16px; }
  .topbar nav { order: 10; width: 100%; gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-left: 0; padding-bottom: 2px; }
  .topbar nav a { font-size: 12px; padding: 6px 10px; white-space: nowrap; }
  .topbar .spacer { display: none; }
  .topbar .user-info { margin-left: auto; font-size: 12px; }
  .topbar .btn-logout { font-size: 12px; padding: 4px 10px; }
  .container { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
  .toolbar { gap: 8px; }
}
