:root {
  --pp-primary: #0f9d6d;
  --pp-primary-dark: #0b7a54;
  --pp-sidebar-bg: #0e1f1a;
  --pp-sidebar-fg: #dcece6;
  --pp-sidebar-muted: #82a89c;
}

body {
  background-color: #f4f7f6;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
}

/* Pages login/creer-compte : centre la carte mais ne la colle jamais aux bords
   sur les petits ecrans -- "safe center" evite que le contenu soit pousse
   hors champ quand il est plus haut que la fenetre. */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  align-items: safe center;
  justify-content: center;
  padding: 2.5rem 1rem;
  background-color: #f4f7f6;
}

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar (back-office pharmacie) */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--pp-sidebar-bg);
  color: var(--pp-sidebar-fg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 1.1rem 1rem;
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: #fff;
}

.sidebar-brand .brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  background: #fff;
  border-radius: .3rem;
  padding: 2px;
}

.sidebar-alert {
  margin: .5rem .75rem 0;
  padding: .5rem .65rem;
  border-radius: .4rem;
  background: rgba(255, 193, 7, .15);
  color: #ffdd8a;
  font-size: .78rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.sidebar-alert-danger {
  background: rgba(220, 53, 69, .18);
  color: #ff9fab;
}

.sidebar-nav {
  padding: .75rem .5rem 1.5rem;
}

.nav-group-title {
  text-transform: uppercase;
  font-size: .7rem;
  letter-spacing: .05em;
  color: var(--pp-sidebar-muted);
  padding: .9rem .75rem .25rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--pp-sidebar-fg);
  padding: .5rem .75rem;
  border-radius: .4rem;
  font-size: .92rem;
}

.sidebar-nav .nav-link:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: var(--pp-primary);
  color: #fff;
}

/* Main */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: #fff;
  padding: .85rem 1.5rem;
  border-bottom: 1px solid #e3e8e6;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.topbar-user-name {
  display: inline-block;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

@media (max-width: 575.98px) {
  .topbar { padding: .75rem .85rem; }
  .topbar-user-name { max-width: 70px; }
}

.content {
  padding: 1.5rem;
  flex: 1;
}

.app-footer {
  padding: 1rem 1.5rem;
  color: #8a938f;
  font-size: .82rem;
  border-top: 1px solid #e3e8e6;
}

.btn-primary {
  background-color: var(--pp-primary);
  border-color: var(--pp-primary);
}

.btn-primary:hover {
  background-color: var(--pp-primary-dark);
  border-color: var(--pp-primary-dark);
}

.text-primary { color: var(--pp-primary) !important; }
.border-primary { border-color: var(--pp-primary) !important; }
.bg-primary { background-color: var(--pp-primary) !important; }

.stub-card {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: #fff;
  border: 1px dashed #cfd9d5;
  border-radius: .6rem;
}

.stub-card i {
  font-size: 2.5rem;
  color: var(--pp-primary);
  margin-bottom: 1rem;
}

/* Alertes stock / peremption */
.stock-alert { color: #d9394a; font-weight: 700; }
.stock-low { color: #b8860b; font-weight: 700; }
.badge-expire-soon { background: #ff8f1f !important; }
.badge-expired { background: #d9394a !important; }

/* Ecarts d'inventaire */
.diff-pos { color: #1a9c5c; font-weight: 700; }
.diff-neg { color: #d9394a; font-weight: 700; }
.diff-zero { color: #6b7280; font-weight: 700; }

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: -280px;
    z-index: 1050;
    transition: left .2s ease;
  }
  .sidebar.show { left: 0; }
}

/* =======================================================================
   Page d'accueil publique (index.php)
   ======================================================================= */

.landing-body { background-color: #f4f7f6; }
.landing-hero { background: linear-gradient(135deg, var(--pp-primary), var(--pp-primary-dark)); }

.landing-card {
  background: #fff;
  border: 1px solid #e3e8e6;
  border-radius: .75rem;
  padding: 1.5rem;
}

.landing-badge {
  background: #e3f6ee;
  color: var(--pp-primary-dark);
  font-weight: 600;
  font-size: .8rem;
  padding: .4rem .8rem;
  border-radius: 2rem;
  display: inline-block;
}

.landing-flow-step {
  background: #f4f7f6;
  border-radius: .5rem;
  padding: .6rem .9rem;
  font-weight: 600;
  font-size: .92rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.landing-flow-step--final { background: var(--pp-primary); color: #fff; }
.landing-flow-arrow { text-align: center; color: #b7c2bd; line-height: 1.2; font-weight: 700; }

.landing-plan-card {
  background: #fff;
  border: 1px solid #e3e8e6;
  border-radius: .75rem;
  padding: 1.5rem 1.25rem;
  text-align: center;
  height: 100%;
}

.landing-plan-card.featured {
  border-color: var(--pp-primary);
  box-shadow: 0 .5rem 1.5rem rgba(15,157,109,.15);
}

.landing-plan-price { font-size: 1.5rem; font-weight: 700; color: var(--pp-primary); }

/* =======================================================================
   Espace client (marketplace)
   ======================================================================= */

.client-body { background-color: #f4f7f6; }
.client-navbar { padding: .6rem 0; }

.pharmacie-card {
  background: #fff;
  border: 1px solid #e3e8e6;
  border-radius: .7rem;
  padding: 1rem 1.15rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  height: 100%;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s ease;
}

.pharmacie-card:hover {
  box-shadow: 0 .35rem 1rem rgba(15,157,109,.12);
  color: inherit;
}

.pharmacie-logo {
  width: 52px;
  height: 52px;
  border-radius: .5rem;
  object-fit: contain;
  background: #f4f7f6;
  border: 1px solid #e3e8e6;
  flex-shrink: 0;
}

.produit-card {
  background: #fff;
  border: 1px solid #e3e8e6;
  border-radius: .7rem;
  padding: 1rem;
  height: 100%;
}

.produit-image {
  width: 100%;
  height: 110px;
  object-fit: contain;
  background: #f4f7f6;
  border-radius: .5rem;
  margin-bottom: .6rem;
}

.step-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--pp-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}

/* Icones de la carte des pharmacies (Leaflet divIcon) */
.map-pin {
  background: var(--pp-primary);
  color: #fff;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  border: 2px solid #fff;
}

.map-pin-garde {
  background: #ff8f1f;
}

.order-tracker {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.order-tracker-step {
  flex: 1;
  min-width: 100px;
  text-align: center;
  padding: .6rem .4rem;
  border-radius: .5rem;
  background: #f4f7f6;
  color: #8a938f;
  font-size: .78rem;
  font-weight: 600;
}

.order-tracker-step.done { background: var(--pp-primary); color: #fff; }
.order-tracker-step.current { background: #fff; color: var(--pp-primary); border: 2px solid var(--pp-primary); }

/* =======================================================================
   Espace livreur (mobile-first)
   ======================================================================= */

.livreur-body { background-color: #eef3f1; }
.livreur-navbar { background: var(--pp-sidebar-bg); }

.livreur-stat {
  background: #fff;
  border-radius: .6rem;
  padding: .9rem;
  text-align: center;
  border: 1px solid #e3e8e6;
}

.livreur-stat .num { font-size: 1.5rem; font-weight: 700; color: var(--pp-primary); }
.livreur-stat .label { font-size: .72rem; color: #8a938f; text-transform: uppercase; letter-spacing: .03em; }

.mission-card {
  background: #fff;
  border: 1px solid #e3e8e6;
  border-radius: .6rem;
  padding: 1rem;
  margin-bottom: .75rem;
}
