/* ─── TOKENS ──────────────────────────────────────────────────────────────── */
:root {
  --primary: #1a3a5c;
  --primary-dark: #112840;
  --primary-light: #2563a8;
  --accent: #e8780a;
  --success: #2e7d32;
  --danger: #c62828;
  --danger-bg: #ffebee;
  --surface: #ffffff;
  --bg: #f0f4f8;
  --border: #d0dce8;
  --text: #1a2530;
  --text-muted: #5a6a7a;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 4px rgba(0,0,0,0.10);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
  --header-height: 64px;
}

/* ─── RESET ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ─── HEADER ──────────────────────────────────────────────────────────────── */
header {
  background: white;
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.2px;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
#currentUserName {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}
#btnLogout {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s;
}
#btnLogout:hover { border-color: var(--danger); color: var(--danger); }

/* ─── MAIN LAYOUT ─────────────────────────────────────────────────────────── */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ─── CARDS ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

/* ─── BREADCRUMB ──────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 0.88rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--primary-light);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--border); }
.breadcrumb .current { color: var(--text); font-weight: 600; }

/* ─── TABS ────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ─── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}
.btn-secondary:hover { border-color: var(--primary-light); color: var(--primary); }
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #b71c1c; }
.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}
.btn-icon {
  background: none;
  border: none;
  padding: 4px;
  color: var(--text-muted);
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.btn-icon:hover { color: var(--primary); background: rgba(0,0,0,0.04); }
.btn-icon.danger:hover { color: var(--danger); }

/* ─── FORMS ───────────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.form-group label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="password"],
textarea,
select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,168,0.12);
}
textarea { resize: vertical; min-height: 80px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6a7a' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
.checkbox-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

/* ─── TABLES ──────────────────────────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  margin: 0 -24px;
  padding: 0 24px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
thead th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  text-align: left;
  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: rgba(0,0,0,0.02); }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: rgba(37,99,168,0.04); }

/* ─── BADGES ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-success { background: #e8f5e9; color: var(--success); }
.badge-warning { background: #fff3e0; color: #e65100; }
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-muted { background: #f5f5f5; color: var(--text-muted); }

/* ─── TOAST ───────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  color: white;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  max-width: 400px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { background: var(--success); }
#toast.error { background: var(--danger); }

/* ─── MODAL ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal.modal-wide { max-width: 780px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}
.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── YEAR SELECTOR ───────────────────────────────────────────────────────── */
.year-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}
.year-selector button {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1rem;
  transition: border-color 0.15s, color 0.15s;
}
.year-selector button:hover { border-color: var(--primary-light); color: var(--primary); }
.year-selector .year-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 50px;
  text-align: center;
}

/* ─── SUIVI GRID ──────────────────────────────────────────────────────────── */
.suivi-grid table input[type="date"] {
  padding: 5px 6px;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 130px;
}
.suivi-grid table input[type="date"]:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(37,99,168,0.1);
}

/* Bulletin grid */
.bulletin-grid thead th {
  padding: 4px 2px;
}
.bulletin-grid tbody td {
  padding: 2px 2px;
}
.bulletin-grid tfoot td {
  padding: 2px 2px;
  background: var(--bg);
  border-top: 2px solid var(--border);
}
.bulletin-grid td.num {
  padding: 2px 7px 2px 2px;
  text-align: right;
  font-size: 0.82rem;
  font-weight: bold;
  white-space: nowrap;
}
.bulletin-grid table input[type="number"] {
  padding: 2px 4px;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 78px;
  text-align: right;
  -moz-appearance: textfield;
  box-sizing: border-box;
}
.bulletin-grid table input[type="number"]::-webkit-outer-spin-button,
.bulletin-grid table input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.bulletin-grid table input[type="number"]:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(37,99,168,0.1);
}

/* ─── EMPTY STATE ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state p {
  font-size: 0.95rem;
  margin-bottom: 16px;
}

/* ─── SEARCH ──────────────────────────────────────────────────────────────── */
.search-bar {
  position: relative;
}
.search-bar input {
  padding-left: 36px;
}
.search-bar svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

/* ─── INFO GRID ───────────────────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px 24px;
}
.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
}
.info-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.info-value {
  font-size: 0.92rem;
  color: var(--text);
}

/* ─── LOGIN ───────────────────────────────────────────────────────────────── */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height));
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}
.login-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin-bottom: 4px;
}
.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 24px;
}
.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.login-divider {
  border-top: 1px solid var(--border);
  margin: 20px 0 16px;
}
.login-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.login-hint a {
  color: var(--primary-light);
  font-weight: 600;
  text-decoration: none;
}
.login-hint a:hover { text-decoration: underline; }

/* ─── HIDDEN ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── CONFIRM DELETE ──────────────────────────────────────────────────────── */
.confirm-delete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--danger-bg);
  border-radius: var(--radius);
  padding: 4px 8px;
}
.confirm-delete span {
  font-size: 0.8rem;
  color: var(--danger);
  font-weight: 600;
}

/* ─── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .card { padding: 16px; }
  .table-container { margin: 0 -16px; padding: 0 16px; }
  .form-row { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
  .tab-btn { padding: 8px 14px; font-size: 0.82rem; white-space: nowrap; }
  .modal { max-width: 100%; }
}

/* ─── INFOS PERMANENTES BANNER ───────────────────────────────────────────── */
.info-perm-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  color: #5d4037;
  line-height: 1.5;
}
.info-perm-banner svg { flex-shrink: 0; margin-top: 2px; color: #f9a825; }

/* ─── PLANNING ────────────────────────────────────────────────────────────── */
#planningTable td { vertical-align: middle; }
#planningTable td.planning-types { white-space: nowrap; padding: 6px 12px; }
.type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  margin: 2px 4px;
  border-radius: 5px;
  border: 1.5px solid #bdbdbd;
  background: #fff;
  color: #555;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s;
  letter-spacing: 0.03em;
  min-width: 34px;
}
.type-badge:hover { filter: brightness(0.92); }
.type-badge.on { box-shadow: 0 1px 4px rgba(0,0,0,0.2); }

/* Légende planning */
.planning-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.875rem;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-label { color: var(--text-muted); }
.legend-value { font-weight: 700; color: var(--text); }

/* ─── HORAIRES TABLE ──────────────────────────────────────────────────────── */
#horairesTable input[type="time"] {
  width: 110px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.88rem;
}
#horairesTable td.heures-jour {
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

/* ─── CONGES PAYES TOTAL ──────────────────────────────────────────────────── */
.total-row td {
  background: var(--bg);
  border-top: 2px solid var(--border);
  padding: 10px 12px;
  font-size: 0.95rem;
}

