/* ============================================================
   Kilokwa Market Place — Design system (mobile-first)
   Bleu marine #0A2E7A · Orange #FF6B00 · Turquoise #1AA6A0
   ============================================================ */
:root {
  --blue: #0A2E7A;
  --blue-dark: #071f56;
  --blue-light: #e8eefb;
  --orange: #FF6B00;
  --orange-light: #fff0e5;
  --teal: #1AA6A0;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --bg: #f2f5fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e9f2;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(10, 46, 122, .08);
  --shadow-lg: 0 8px 30px rgba(10, 46, 122, .14);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3, h4 { color: var(--blue); line-height: 1.25; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border: none; border-radius: 10px; cursor: pointer;
  font-size: 15px; font-weight: 600; transition: .2s; text-align: center;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover { background: #e05e00; }
.btn-outline { background: #fff; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-danger { background: #fee2e2; color: var(--red); }
.btn-success { background: var(--green); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

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

/* ---------- Formulaires ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--blue); font-size: 14px; }
.form-control {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 15px; background: #fff; transition: .2s;
}
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }
textarea.form-control { resize: vertical; min-height: 90px; }
.input-icon { position: relative; }
.input-icon .form-control { padding-left: 42px; }
.input-icon > span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 17px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }
.form-hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- Alertes / Flash ---------- */
.alert { padding: 13px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; font-size: 14px; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: var(--blue-light); color: var(--blue); }

/* ---------- Badges de statut ---------- */
.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12.5px; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: var(--blue-light); color: var(--blue); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-muted { background: #f1f5f9; color: var(--muted); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.table th { background: var(--blue); color: #fff; text-align: left; padding: 12px 14px; font-size: 13px; white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: #f8faff; }
.table .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }

/* ---------- Skeleton loaders (style Flutter) ---------- */
.skeleton {
  background: linear-gradient(90deg, #e8edf5 25%, #f4f7fc 50%, #e8edf5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { background: #fff; border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.skeleton-card .sk-img { height: 150px; margin-bottom: 10px; }
.skeleton-card .sk-line { height: 13px; margin-bottom: 8px; }
.skeleton-card .sk-line.short { width: 60%; }

/* ---------- Header public ---------- */
.app-header {
  background: var(--blue); color: #fff; padding: 14px 16px;
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 12px rgba(7, 31, 86, .35);
}
.app-header .logo { display: flex; align-items: center; gap: 10px; color: #fff; }
.app-header .logo img { height: 36px; }
.app-header .logo .name { font-weight: 800; font-size: 18px; line-height: 1.1; }
.app-header .logo .name small { display: block; color: var(--orange); font-size: 11px; font-weight: 600; letter-spacing: .5px; }

/* ---------- Bottom navigation mobile ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: #fff; display: flex; justify-content: space-around;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -3px 16px rgba(10, 46, 122, .12);
  border-top: 1px solid var(--border);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 10px;
  position: relative; min-width: 58px;
}
.bottom-nav a .ico { font-size: 20px; }
.bottom-nav a.active { color: var(--blue); }
.bottom-nav .count {
  position: absolute; top: 0; right: 8px; background: var(--orange); color: #fff;
  font-size: 10px; min-width: 17px; height: 17px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.has-bottom-nav { padding-bottom: 82px; }

/* ---------- Sidebar (admin / fournisseur desktop) ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 245px; background: var(--blue); color: #fff; flex-shrink: 0;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 90;
  transition: transform .25s;
}
.sidebar .brand { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.14); }
.sidebar .brand img { height: 42px; }
.sidebar .brand .brand-name { font-weight: 800; font-size: 17px; }
.sidebar .brand .brand-name small { display: block; color: var(--orange); font-size: 11px; font-weight: 600; }
.sidebar nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.82);
  padding: 11px 14px; border-radius: 10px; margin-bottom: 4px; font-weight: 600; font-size: 14px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar nav a.active { background: var(--orange); color: #fff; }
.sidebar .side-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.14); font-size: 13px; }
.main { flex: 1; margin-left: 245px; padding: 22px; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 20px;
}
.topbar h1 { font-size: 22px; }
.menu-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--blue); }
.sidebar-overlay { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 85;
  }
  .main { margin-left: 0; padding: 16px; }
  .menu-toggle { display: block; }
}

/* ---------- Statistiques (cartes KPI) ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; align-items: center; gap: 14px; }
.stat-card .icon {
  width: 50px; height: 50px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-card .value { font-size: 22px; font-weight: 800; color: var(--blue); }
.stat-card .label { font-size: 13px; color: var(--muted); }
.icon-blue { background: var(--blue-light); }
.icon-orange { background: var(--orange-light); }
.icon-green { background: #dcfce7; }
.icon-red { background: #fee2e2; }

/* ---------- Divers ---------- */
.text-muted { color: var(--muted); }
.text-orange { color: var(--orange); }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.hidden { display: none !important; }
.container { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* ---------- Toast AJAX ---------- */
#toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--blue); color: #fff; padding: 12px 22px; border-radius: 30px;
  font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: .3s; z-index: 999;
  box-shadow: var(--shadow-lg); max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.toast-error { background: var(--red); }
#toast.toast-success { background: var(--green); }
