/* ===========================
   CNFCI UI KIT (memorable)
   Brand: CNFCI (Vert + Orange)
   File: /assets/css/cnfci.css
   =========================== */

:root{
  --cnfci-green: #2FA84F;        /* vert logo */
  --cnfci-green-2:#1E8A3D;       /* vert foncé */
  --cnfci-orange:#F59E0B;        /* orange logo */
  --cnfci-black: #111827;

  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #6b7280;
  --line: #e5e7eb;

  --shadow: 0 10px 25px rgba(17,24,39,.06);
  --radius: 16px;
  --radius-sm: 12px;

  --focus: rgba(47,168,79,.25);
}

/* Base */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--cnfci-black);
}

/* Container */
.container{
  width:min(1100px, 100%);
  margin:0 auto;
  padding:18px;
}

/* Card */
.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

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

/* ===========================
   Brandbar (logo sur chaque page)
   =========================== */
.brandbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(47,168,79,.12), rgba(245,158,11,.08));
  border: 1px solid rgba(47,168,79,.18);
  box-shadow: 0 12px 28px rgba(2,6,23,.05);
  margin-bottom: 14px;
}

.brand-left{
  display:flex;
  align-items:center;
  gap:12px;
  min-width: 0;
}

.brand-logo{
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  flex: 0 0 auto;
}

.brand-logo img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.brand-title{ min-width:0; }
.brand-title h1{
  margin:0;
  font-size: 18px;
  line-height:1.2;
  font-weight: 900;
  letter-spacing: .2px;
}

.brand-title .sub{
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 680px;
}

.brand-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

/* ===========================
   Topbar
   =========================== */
.topbar{
  margin-top: 14px;
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 12px;
  flex-wrap:wrap;
}

.topbar .title{
  font-size: 20px;
  font-weight: 1000;
  letter-spacing: .2px;
}

.topbar .user{
  color: var(--muted);
  font-size: 13px;
}

/* ===========================
   Buttons
   =========================== */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor:pointer;
  text-decoration:none;
  font-weight: 800;
  font-size: 14px;
  user-select:none;
  transition:.15s ease;
}

.btn-light{
  background: #eef2f7;
  border-color: #e6eaf0;
  color: #111;
}
.btn-light:hover{filter:brightness(.98)}

.btn-primary{
  background: linear-gradient(135deg, var(--cnfci-green), var(--cnfci-green-2));
  color:#fff;
  border-color: rgba(0,0,0,.05);
  box-shadow: 0 10px 18px rgba(47,168,79,.18);
}
.btn-primary:hover{filter:brightness(.98)}

.btn-danger{
  background:#fee2e2;
  border:1px solid #fecaca;
  color:#991b1b;
}
.btn-danger:hover{filter:brightness(.98)}

/* ===========================
   Alerts
   =========================== */
.alert, .success{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid;
  margin: 12px 0;
  font-weight: 800;
  font-size: 14px;
}
.alert-success, .success{
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #065f46;
}
.alert-warn{
  background:#fffbeb;
  border-color:#fde68a;
  color:#92400e;
}

/* ===========================
   Forms
   =========================== */
label{
  display:block;
  font-weight: 900;
  margin: 12px 0 7px;
  font-size: 13px;
}

.req{
  color: var(--cnfci-orange);
  font-weight: 1000;
  margin-left:6px;
}

input, select, textarea{
  width:100%;
  max-width:100%;
  padding: 11px 12px;
  border-radius: 12px;
  border:1px solid #d9dee7;
  background:#fff;
  outline:none;
  font-size: 14px;
  transition:.15s ease;
}

input:focus, select:focus, textarea:focus{
  border-color: rgba(47,168,79,.55);
  box-shadow: 0 0 0 4px var(--focus);
}

textarea{
  min-height: 92px;
  resize:vertical;
}

.help{
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* Form grid (collecte.php) */
.form-grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:12px;
  margin-top: 10px;
}

/* Champs */
.field{ grid-column: span 12; }
.field.half{ grid-column: span 6; }
.field.third{ grid-column: span 4; }
.field.quarter{ grid-column: span 3; }

.section{
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.section h3{
  margin: 0;
  font-size: 15px;
  font-weight: 1000;
  color: var(--text);
}

/* Rows */
.row{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
}
.col{flex:1; min-width: 220px}

/* GPS bar (si tu l’utilises) */
.gpsbar{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  background:rgba(0,0,0,.03);
  border:1px solid rgba(0,0,0,.06);
  border-radius:12px;
  margin:12px 0;
  flex-wrap:wrap;
}
#gpsStatus{
  font-weight:800;
  color:#1f2937;
}

/* ===========================
   Tables (mes_collectes, view…)
   =========================== */
.table-wrap{
  overflow:auto;
  border-radius: 14px;
  border:1px solid var(--line);
  margin-top: 12px;
}
table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
}
th, td{
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align:left;
  font-size: 14px;
}
th{
  background:#f8fafc;
  font-weight:1000;
}

.badge{
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 1000;
  display:inline-block;
}
.badge.draft{background:#fffbeb; color:#92400e; border:1px solid #fde68a}
.badge.submitted{background:#ecfdf5; color:#065f46; border:1px solid #bbf7d0}

/* Filters */
.filters{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top: 10px
}
.filters a{
  padding: 8px 12px;
  border-radius: 999px;
  background:#eef2f7;
  color:#111;
  text-decoration:none;
  font-weight: 900;
  border:1px solid #e6eaf0;
}
.filters a.active{
  background: linear-gradient(135deg, rgba(47,168,79,.18), rgba(245,158,11,.12));
  border-color: rgba(47,168,79,.25);
}

/* ===========================
   Dashboard (layout + sidebar)
   =========================== */
.layout{
  display:flex;
  min-height:100vh;
}

/* Sidebar */
.sidebar{
  width:260px;
  background:#0b1220;
  color:#e5e7eb;
  padding:16px;
  position:sticky;
  top:0;
  height:100vh;
  overflow:auto;
}

.sidebar .brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 10px 14px;
  border-bottom:1px solid rgba(255,255,255,.08);
  margin-bottom:12px;
}

.sidebar .logo{
  width:42px;
  height:42px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:1000;
  color:#0b1220;
  background:linear-gradient(135deg, var(--cnfci-green), var(--cnfci-orange));
  box-shadow:0 10px 20px rgba(0,0,0,.25);
}

.sidebar .name{
  font-weight:1000;
  line-height:1.1;
}

.nav{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-top:10px;
}

.nav a{
  color:#e5e7eb;
  text-decoration:none;
  padding:10px 12px;
  border-radius:12px;
  display:flex;
  gap:10px;
  align-items:center;
  font-weight:900;
  font-size:14px;
  transition:.12s ease;
  background:rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.04);
}

.nav a:hover{ background:rgba(255,255,255,.06); }

.nav a.active{
  background:linear-gradient(135deg, rgba(47,170,67,.22), rgba(243,154,33,.14));
  border-color:rgba(47,170,67,.25);
}

/* Content */
.content{
  flex:1;
  padding:16px 0;
}

/* Cards KPI */
.cards{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:12px;
  padding:0 18px;
  margin-top:14px;
}

.metric{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}
.metric .label{
  margin:0;
  font-weight:900;
  color:var(--muted);
  font-size:13px
}
.metric .value{
  font-size:28px;
  font-weight:1000;
  letter-spacing:.3px;
  margin-top:4px
}
.metric .badge{
  width:44px;
  height:44px;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(47,170,67,.10);
  border:1px solid rgba(47,170,67,.18);
}

/* Grid2 */
.grid2{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
  padding:0 18px;
  margin-top:12px;
}

.box-title{margin:0 0 10px; font-weight:1000}
.placeholder{
  border:1px dashed #cbd5e1;
  border-radius:14px;
  padding:14px;
  color:var(--muted);
  background:#f8fafc;
}

/* ===========================
   Login (si tu veux migrer login.php vers ce style)
   =========================== */
.auth-wrap{
  min-height: 100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 22px 16px;
}
.auth-card{ width: 100%; max-width: 420px; }
.auth-footer{
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  text-align:center;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 1100px){
  .cards{grid-template-columns:repeat(2, minmax(0,1fr))}
}

@media (max-width: 900px){
  .layout{flex-direction:column}
  .sidebar{
    width:100%;
    height:auto;
    position:relative;
    border-bottom:1px solid rgba(255,255,255,.08);
  }
  .content{padding-top:6px}
  .grid2{grid-template-columns:1fr}
}

@media (max-width: 820px){
  .field.half,.field.third,.field.quarter{ grid-column: span 12; }
}

@media (max-width: 720px){
  .gpsbar{ align-items:stretch; }
  .gpsbar .btn{ width:100%; }
}

@media (max-width: 640px){
  .brandbar{padding:12px; flex-direction:column; align-items:flex-start}
  .brand-logo{width:48px;height:48px;border-radius:12px}
  .brand-title h1{font-size:14px}
  .brand-actions{width:100%}
  .btn{width:100%}
  .cards{grid-template-columns:1fr}
  .container{padding:12px}
}
/* ===========================
   PATCH: Carte + Statistiques côte à côte (dashboard)
   À coller EN BAS du cnfci.css
   =========================== */

/* On verrouille le grid2 en 2 colonnes sur desktop */
.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
  align-items: stretch;
}

/* La carte Leaflet doit avoir une hauteur, sinon elle "disparaît" */
#map{
  width:100%;
  min-height: 420px;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

/* Si tu utilises .placeholder à la place du #map, on lui donne une hauteur aussi */
.grid2 .placeholder{
  min-height: 420px;
}

/* Leaflet - correction visuelle (optionnel mais recommandé) */
.leaflet-container{
  font: inherit;
  border-radius: 14px;
}

/* Mobile: on empile uniquement sous 900px (tu l'as déjà, on le garde) */
@media (max-width: 900px){
  .grid2{
    grid-template-columns: 1fr;
  }
}
