/* ============================================================
   ACTION GROUPE — Base Styles
   Reset · Typographie · Composants partagés
   ============================================================ */

/* ----- RESET ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-body); color: var(--text); background: var(--white); overflow-x: hidden; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ----- TYPOGRAPHY ----- */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-head); line-height: 1.15; }

/* ----- BOUTONS ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border-radius: var(--radius);
  font-family: var(--font-head); font-size: 12px; font-weight: 700;
  border: 1.5px solid transparent; transition: var(--transition);
  white-space: nowrap; cursor: pointer;
}
.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline { background: transparent; color: var(--green); border: 2px solid var(--green); }
.btn-outline:hover { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn-gold:hover { background: #c48f00; }
.btn-ghost { background: transparent; color: var(--text2); border-color: var(--gray2); }
.btn-ghost:hover { border-color: var(--green); color: var(--green); }
.btn-sm { padding: 5px 12px; font-size: 11px; }
.btn-xs { padding: 3px 9px; font-size: 10px; }
.btn-lg { padding: 12px 28px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ----- BADGES ----- */
.badge {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  font-family: var(--font-head);
}
.badge-green  { background: var(--green-light); color: #27500a; }
.badge-red    { background: var(--red-light);   color: #791f1f; }
.badge-gold   { background: var(--gold-light);  color: #633806; }
.badge-blue   { background: #e6f1fb; color: #0c447c; }
.badge-gray   { background: #f1efe8; color: #444; }
.badge-dark   { background: rgba(0,0,0,0.7); color: #fff; }

/* ----- FORMULAIRES ----- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label {
  font-size: 10px; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--font-head);
}
.field input,
.field select,
.field textarea {
  padding: 8px 11px; border: 1.5px solid var(--gray2);
  border-radius: var(--radius); font-family: var(--font-body);
  font-size: 13px; color: var(--text); background: var(--white);
  outline: none; transition: border-color 0.2s; width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--green); }
.field textarea { resize: vertical; min-height: 70px; }
.field input[readonly] { background: var(--gray); cursor: default; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.form-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 11px; }
.form-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; }

/* ----- CARTES ----- */
.card {
  background: var(--white); border: 1px solid var(--gray2);
  border-radius: var(--radius-lg); padding: 16px 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.card-title { font-family: var(--font-head); font-size: 13px; font-weight: 700; color: var(--text); }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ----- KPIs ----- */
.kpi {
  background: var(--white); border: 1px solid var(--gray2);
  border-radius: var(--radius-lg); padding: 14px 16px;
}
.kpi-label {
  font-size: 10px; color: var(--text3); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 6px; font-family: var(--font-head);
}
.kpi-label i { font-size: 13px; margin-right: 3px; }
.kpi-value { font-size: 20px; font-weight: 800; color: var(--text); font-family: var(--font-head); }
.kpi-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.kpi.green .kpi-value { color: var(--green); }
.kpi.red   .kpi-value { color: var(--red); }
.kpi.gold  .kpi-value { color: var(--gold); }

/* ----- TABLEAUX ----- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%; border-collapse: collapse;
  font-size: 12px; table-layout: auto;
}
.table th {
  text-align: left; padding: 8px 10px;
  color: var(--text3); font-weight: 700; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.07em;
  border-bottom: 1.5px solid var(--gray2);
  background: var(--gray); font-family: var(--font-head);
  white-space: nowrap;
}
.table td {
  padding: 8px 10px; color: var(--text2);
  border-bottom: 1px solid var(--gray);
  vertical-align: middle;
}
.table tbody tr:hover td { background: #f7fbf4; }
.table tfoot td {
  background: var(--green-light); font-weight: 700;
  color: var(--green-dark); padding: 8px 10px;
  font-family: var(--font-head);
}
.table .row-alert td { border-left: 3px solid var(--red); background: #fff8f8; }
.table-actions { display: flex; gap: 4px; align-items: center; }
.table-actions button {
  border: none; background: none; cursor: pointer;
  padding: 4px 6px; border-radius: 6px;
  color: var(--text3); font-size: 14px; transition: var(--transition);
}
.table-actions button:hover { background: var(--gray2); color: var(--text); }
.table-actions button.delete:hover { background: var(--red-light); color: var(--red); }

/* ----- BARRE DE RECHERCHE ----- */
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search-bar input {
  flex: 1; min-width: 160px; padding: 7px 11px;
  border: 1.5px solid var(--gray2); border-radius: var(--radius);
  font-size: 12px; color: var(--text); background: var(--white); outline: none;
}
.search-bar input:focus { border-color: var(--green); }
.search-bar select {
  padding: 7px 9px; border: 1.5px solid var(--gray2);
  border-radius: var(--radius); font-size: 11px;
  color: var(--text2); background: var(--white); outline: none;
}

/* ----- ONGLETS ----- */
.tab-bar {
  display: flex; border-bottom: 2px solid var(--gray2);
  margin-bottom: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
  padding: 9px 16px; font-size: 12px; font-weight: 700;
  font-family: var(--font-head); cursor: pointer;
  color: var(--text3); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color 0.2s; white-space: nowrap;
}
.tab:hover { color: var(--green); }
.tab.active { color: var(--green); border-bottom-color: var(--green); }

/* ----- DIVBAR TRICOLORE ----- */
.divbar {
  height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold) 33%, var(--red) 33%, var(--red) 66%, var(--gold) 66%);
}

/* ----- PROGRESSION ----- */
.progress { height: 6px; background: var(--gray2); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--green); transition: width 0.4s; }

/* ----- MODALES ----- */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 2000;
  align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 22px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.2s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-family: var(--font-head); font-size: 15px; font-weight: 800; }
.modal-close { border: none; background: none; font-size: 20px; color: var(--text3); padding: 2px; }
.modal-close:hover { color: var(--text); }
.modal-footer {
  display: flex; gap: 9px; justify-content: flex-end;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--gray2);
}
@keyframes modalIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

/* ----- TOAST ----- */
#toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  padding: 11px 18px; border-radius: var(--radius);
  font-size: 12px; font-weight: 700; font-family: var(--font-head);
  max-width: 320px; opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}
#toast.show { opacity: 1; }

/* ----- UTILITAIRES ----- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 13px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 14px; }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-gold  { color: var(--gold); }
.text-muted { color: var(--text3); }
.font-bold  { font-weight: 700; }
.font-head  { font-family: var(--font-head); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.w-full { width: 100%; }

/* ----- ANIMATIONS ----- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.anim-in { animation: fadeInUp 0.5s ease forwards; }
.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.2s; opacity: 0; }
.delay-3 { animation-delay: 0.3s; opacity: 0; }
.delay-4 { animation-delay: 0.4s; opacity: 0; }
.delay-5 { animation-delay: 0.5s; opacity: 0; }

/* ----- RESPONSIVE BASE ----- */
@media (max-width: 768px) {
  .grid-4, .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .form-3, .form-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4, .kpi-grid { grid-template-columns: 1fr; }
  .form-2, .form-3, .form-4 { grid-template-columns: 1fr; }
  .modal { padding: 16px; }
}
