/* ================================================================
   AFRICOT DEVIS — Feuille de styles principale
   Palette : bleu foncé #1e3a5f | accent #2e86de | gris #f0f4f8
================================================================ */

:root {
  --sidebar-width: 240px;
  --topnav-height: 56px;
  --primary:    #1e3a5f;
  --accent:     #2e86de;
  --accent-lt:  #eaf3fb;
  --success:    #27ae60;
  --warning:    #f39c12;
  --danger:     #e74c3c;
  --bg:         #f0f4f8;
  --card-bg:    #ffffff;
  --text:       #2c3e50;
  --text-muted: #7f8c8d;
  --border:     #dee2e6;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.07);
  --shadow-md:  0 4px 20px rgba(0,0,0,.1);
  --radius:     10px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.africot-navbar {
  background: var(--primary) !important;
  height: var(--topnav-height);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1100;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  flex-wrap: nowrap !important;   /* empêche le wrap sur Android Chrome */
  overflow: hidden;
}

/* ── Logo AFRICOT navbar ────────────────────────────────────── */
.africot-logo {
  display: flex;
  align-items: center;
  gap: 0;
  text-decoration: none !important;
  line-height: 1.15;
  flex: 1;
  min-width: 0;
  margin-right: 0 !important;
  overflow: hidden;
}
/* Carré blanc arrondi qui entoure uniquement l'icône */
.africot-logo-icon {
  background: #ffffff;
  border-radius: 12px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 6px;
}
.africot-logo-icon img {
  height: 32px;
  width: auto;
  display: block;
}
/* Texte sur fond sombre */
.africot-logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
  padding-left: 10px;
}
.africot-logo-name,
.africot-logo-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.africot-logo-name {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: #ffffff;
  letter-spacing: .6px;
  line-height: 1.15;
}
.africot-logo-sub {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: .68rem;
  font-weight: 600;
  color: #5bc8f5;
  letter-spacing: .8px;
  text-transform: uppercase;
  line-height: 1.2;
}

.brand-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff;
}
.brand-name { font-weight: 700; font-size: 1.05rem; color: #fff; letter-spacing: .5px; }
.brand-sep  { color: rgba(255,255,255,.3); margin: 0 4px; }
.brand-sub  { color: rgba(255,255,255,.6); font-size: .85rem; }

.sidebar-toggle { font-size: 1.3rem !important; }
.sidebar-toggle:hover { background: rgba(255,255,255,.1) !important; border-radius: 6px; }

.user-avatar {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: #fff;
}

/* ── Layout wrapper ─────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  margin-top: var(--topnav-height);
  min-height: calc(100vh - var(--topnav-height));
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  min-height: calc(100vh - var(--topnav-height));
  position: fixed;
  top: var(--topnav-height);
  left: 0;
  z-index: 1000;
  overflow-y: auto;
  transition: transform .25s ease;
  padding: 1rem 0 2rem;
}

.sidebar-nav .nav { gap: 2px; padding: 0 .75rem; }

.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.35);
  padding: 1rem 1rem .25rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,.7);
  border-radius: 8px;
  padding: .6rem .85rem;
  font-size: .9rem;
  transition: all .18s;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 3px 10px rgba(46,134,222,.4); }
.sidebar-nav .nav-link.text-danger-emphasis { color: rgba(255,120,120,.8) !important; }
.sidebar-nav .nav-link.text-danger-emphasis:hover { background: rgba(231,76,60,.2); color: #ff8080 !important; }

/* ── Main content ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  transition: margin .25s ease;
  min-width: 0;
}

.content-container { padding: 1.75rem 2rem; }

/* ── Page header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.page-header-left h1 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}
.page-header-left .breadcrumb { margin: 0; font-size: .8rem; }
.page-header-left .breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
  font-weight: 600;
  color: var(--primary);
}

/* ── Stats cards ────────────────────────────────────────────── */
.stat-card {
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  color: #fff;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover {
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.stat-card::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}
.stat-card .stat-icon {
  font-size: 2rem;
  width: 56px; height: 56px;
  background: rgba(255,255,255,.2);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-card .stat-value { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { font-size: .82rem; opacity: .85; margin-top: 3px; }

.stat-card.blue   { background: linear-gradient(135deg, #1e3a5f, #2e86de); }
.stat-card.green  { background: linear-gradient(135deg, #1a7f4b, #27ae60); }
.stat-card.orange { background: linear-gradient(135deg, #b7580a, #f39c12); }
.stat-card.purple { background: linear-gradient(135deg, #5b2c8c, #8e44ad); }

/* ── Tables ─────────────────────────────────────────────────── */
.table-africot thead th {
  background: #f8f9fa;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table-africot tbody tr { transition: background .12s; }
.table-africot tbody tr:hover { background: var(--accent-lt); }
.table-africot td { vertical-align: middle; font-size: .9rem; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary   { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: #1a72c7; border-color: #1a72c7; }
.btn-africot   { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-africot:hover { background: #152c47; color: #fff; }

.btn-action { border: none; background: transparent; padding: .3rem .45rem; border-radius: 6px; }
.btn-action.edit   { color: var(--accent); }
.btn-action.delete { color: var(--danger); }
.btn-action.view   { color: var(--success); }
.btn-action.dup    { color: var(--warning); }
.btn-action:hover  { background: var(--bg); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-label { font-weight: 600; font-size: .875rem; color: var(--text); margin-bottom: .35rem; }
.form-control, .form-select {
  border-radius: 8px;
  border: 1.5px solid var(--border);
  font-size: .9rem;
  padding: .5rem .85rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-select {
  padding-right: 2.5rem; /* espace pour la flèche du dropdown */
}
.form-control-sm, .form-select-sm {
  padding: .3rem .65rem;
  font-size: .875rem;
}
.form-select-sm {
  padding-right: 2rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46,134,222,.15);
}

/* ── Devis form ─────────────────────────────────────────────── */
.devis-ligne-row td { padding: .4rem .5rem !important; }
.devis-ligne-row .form-control { padding: .35rem .55rem; font-size: .85rem; }
.devis-ligne-row .form-select  { padding: .35rem 2rem .35rem .55rem; font-size: .85rem; }

.totaux-box {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.totaux-box .tot-row {
  display: flex;
  justify-content: space-between;
  padding: .35rem 0;
  border-bottom: 1px solid rgba(255,255,255,.12);
  font-size: .95rem;
}
.totaux-box .tot-row:last-child { border: none; font-size: 1.2rem; font-weight: 700; }
.totaux-box .tot-label { opacity: .8; }
.totaux-box .tot-value { font-weight: 600; }

/* ── Search bar ─────────────────────────────────────────────── */
.search-input-wrap { position: relative; }
.search-input-wrap .bi { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-input-wrap .form-control { padding-left: 2.2rem; }

/* ── Login page ─────────────────────────────────────────────── */
/* ── Page connexion ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, #2e86de 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.login-wrapper {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Logo au-dessus de la carte — sur fond bleu foncé */
.login-brand {
  text-align: center;
  width: 100%;
}
.africot-logo-login {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  line-height: 1.15;
  text-align: left;
}
.africot-logo-login .africot-logo-icon {
  width: 62px;
  height: 62px;
  border-radius: 14px;
  padding: 8px;
}
.africot-logo-login .africot-logo-icon img { height: 44px; }
/* Texte blanc sur fond bleu — parfaitement lisible */
.africot-logo-login .africot-logo-name {
  font-size: 1.5rem;
  letter-spacing: .8px;
  color: #ffffff;
}
.africot-logo-login .africot-logo-sub {
  font-size: .78rem;
  letter-spacing: .9px;
  color: #7dd3f8;
}
.login-tagline {
  color: rgba(255,255,255,.6);
  font-size: .82rem;
  margin-top: .5rem;
  margin-bottom: 0;
  letter-spacing: .3px;
}

/* Carte formulaire */
.login-card {
  width: 100%;
  background: #fff;
  border-radius: 16px;
  padding: 2rem 2.5rem 2.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1.5rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--bg);
}

.login-logo {
  width: 70px; height: 70px;
  background: var(--primary);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: #fff; margin: 0 auto 1.25rem;
}
.login-card h1 { font-size: 1.5rem; font-weight: 800; color: var(--primary); text-align: center; }
.login-card .sub { color: var(--text-muted); font-size: .9rem; text-align: center; margin-bottom: 1.75rem; }

/* ── Badge statut ───────────────────────────────────────────── */
.badge { font-size: .75rem; padding: .35em .65em; border-radius: 6px; font-weight: 600; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.25); }
  .main-content { margin-left: 0; }
  .content-container { padding: 1.25rem 1rem; }
}

/* ── Mobile (< 576px) ───────────────────────────────────────── */
@media (max-width: 575px) {
  /* Navbar plus compacte */
  :root { --topnav-height: 50px; }
  .africot-navbar { padding-left: .6rem !important; padding-right: .6rem !important; }
  .sidebar-toggle { margin-right: .4rem !important; }

  /* Icône logo réduite */
  .africot-logo { gap: 0; }
  .africot-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    padding: 5px;
  }
  .africot-logo-icon img { height: 24px; }

  /* Page header */
  .page-header { margin-bottom: 1rem; gap: .5rem; }
  .page-header-left h1 { font-size: 1.1rem; }

  /* Padding contenu réduit */
  .content-container { padding: .9rem .75rem; }

  /* Tableaux : scroll horizontal fluide */
  .table-responsive { -webkit-overflow-scrolling: touch; }

  /* Bouton d'action pleine largeur dans page-header */
  .page-header > .btn,
  .page-header > a.btn { width: 100%; justify-content: center; text-align: center; }
}

/* ── Overlay mobile ─────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* ── Animations ─────────────────────────────────────────────── */
.fade-in { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Prestation picker ──────────────────────────────────────── */
.picker-row { background: var(--accent-lt); border-radius: 6px; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* ── Print ──────────────────────────────────────────────────── */
@media print {
  .sidebar, .africot-navbar, .btn, .no-print { display: none !important; }
  .main-content { margin: 0 !important; }
}
