/* =========================
   RESET & BASE
========================= */
* {
  box-sizing: border-box;
  font-family: 'Segoe UI', Arial, sans-serif; /* Police plus moderne */
}

/* =========================
   CONTENEUR
========================= */
.container {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1); /* Donne du relief */
}

/* =========================
   TITRES
========================= */
h2, h3 {
  text-align: center;
  margin-top: 0;
  margin-bottom: 20px;
  color: #1b5e20;
}

/* =========================
   STATUS & BANNER (SYNC)
========================= */
.status {
  text-align: center;
  font-size: 14px;
  margin-bottom: 15px;
  padding: 8px;
  border-radius: 6px;
  font-weight: 500;
}

.status.online {
  color: #2e7d32;
  background: #e8f5e9;
}

.status.offline {
  color: #c62828;
  background: #ffebee;
}

.sync-banner {
  display: none; /* Piloté par JS */
  background: #fff3cd;
  color: #856404;
  padding: 12px;
  margin-bottom: 20px;
  border-radius: 8px;
  text-align: center;
  font-size: 0.9em;
  border: 1px solid #ffeeba;
  animation: fadeIn 0.3s ease-in;
}

.warning {
  background: #ffebee;
  color: #b71c1c;
  border: 2px solid #ef9a9a;
  border-radius: 8px;
  padding: 12px;
  font-weight: 800;
  text-align: center;
}

.modal-confirm {
    display: none; 
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.7); 
    z-index: 9999; justify-content: center; align-items: center;
}
.modal-content {
    background: white; padding: 20px; border-radius: 12px;
    width: 90%; max-width: 400px; text-align: center;
}

/* =========================
   FORMULAIRES
========================= */
.input-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
  color: #444;
}

input, select, textarea {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1.5px solid #ddd;
  font-size: 16px;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2e7d32;
}

input[readonly] {
  background-color: #f8f9fa;
  color: #1b5e20;
  font-weight: bold;
  border-style: dashed;
}

/* =========================
   BOUTONS & LOADER
========================= */
button {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  background: #2e7d32;
  color: white;
  cursor: pointer;
  transition: opacity 0.2s;
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  background: #a5d6a7 !important;
  cursor: not-allowed;
}

.loader {
  display: none;
  font-size: 14px;
  color: #666;
  text-align: center;
  margin-top: 10px;
}

/* =========================
   MENU ACCUEIL
========================= */
.menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu a {
  margin-top: 0;
  background: #f1f8e9;
  color: #2e7d32;
  padding: 18px;
  border-radius: 10px;
  border: 1px solid #c8e6c9;
  transition: background 0.2s;
}

.menu a:hover {
  background: #dcedc8;
}

/* Container du menu */
.menu {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

/* Style des cartes de menu */
.btn-menu {
  display: flex;
  align-items: center;
  background: #ffffff;
  padding: 15px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid #eee;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: transform 0.2s, background 0.2s;
}

.btn-menu:active {
  transform: scale(0.98);
  background: #f9f9f9;
}

/* Style des cercles d'icônes */
.btn-menu .icon {
  font-size: 28px;
  width: 55px;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%; /* Forme circulaire */
  margin-right: 15px;
  background: #f0f0f0;
}

/* Icônes sur fond coloré — cercle semi-transparent blanc */
.btn-ventes .icon, .btn-depense .icon, .btn-ponte .icon,
.btn-admin .icon, .btn-tech .icon, .btn-prophylaxie .icon,
.btn-rentabilite .icon, .btn-aliment .icon, .btn-courbe .icon,
.btn-fournisseurs .icon, .btn-rapport .icon, .btn-previsions .icon,
.btn-tresorerie .icon {
  background: rgba(255,255,255,0.2) !important;
}

/* Textes */
.btn-menu .text-group {
  display: flex;
  flex-direction: column;
  text-align: left;
}

/* Conteneur pour aligner l'input et l'icône */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

/* L'input doit laisser de la place à droite pour l'icône */
.password-wrapper input {
  padding-right: 45px;
  margin-bottom: 0; /* On gère la marge sur le wrapper si besoin */
}

/* Style de l'icône */
.toggle-icon {
  position: absolute;
  right: 12px;
  cursor: pointer;
  font-size: 20px;
  user-select: none;
  padding: 5px;
}

.toggle-icon:hover {
  opacity: 0.7;
}

.btn-menu .title {
  font-size: 16px;
  font-weight: bold;
  color: #333;
}

.btn-menu .subtitle {
  font-size: 12px;
  color: #555;
  font-weight: normal;
  font-style: italic;
  margin-top: 2px;
}

.btn-admin .title, .btn-tech .title, .btn-prophylaxie .title,
.btn-rentabilite .title, .btn-aliment .title, .btn-courbe .title,
.btn-fournisseurs .title, .btn-rapport .title, .btn-previsions .title,
.btn-tresorerie .title, .btn-ventes .title, .btn-depense .title,
.btn-ponte .title {
  color: #fff !important;
}

.btn-admin .subtitle, .btn-tech .subtitle, .btn-prophylaxie .subtitle,
.btn-rentabilite .subtitle, .btn-aliment .subtitle, .btn-courbe .subtitle,
.btn-fournisseurs .subtitle, .btn-rapport .subtitle, .btn-previsions .subtitle,
.btn-tresorerie .subtitle, .btn-ventes .subtitle, .btn-depense .subtitle,
.btn-ponte .subtitle {
  color: rgba(255,255,255,0.85) !important;
  font-style: normal;
}

/* =========================
   LIENS SECONDAIRES
========================= */
.logout-link {
  color: #d32f2f !important;
  font-size: 0.9em;
  opacity: 0.8;
}

hr {
  border: 0;
  border-top: 1px solid #eee;
  margin: 20px 0;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.navigation-footer {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.commentaire-auto {
  display: none !important;  /* ✅ Cacher complètement */
}

.btn-secondary {
    background: #666;
    color: white;
    text-align: center;
    text-decoration: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    display: block;
}

.btn-logout {
    background: #fff;
    color: #c62828;
    text-align: center;
    text-decoration: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    display: block;
    border: 1px solid #c62828;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #ffebee;
}


/* Barre de progression du cycle de vie */
.progress-container {
    width: 100%;
    background-color: #eee;
    border-radius: 10px;
    height: 10px;
    margin: 5px 0;
}
.progress-bar {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, #4caf50, #2e7d32);
    width: 0%; /* Mis à jour par le JS */
    transition: width 0.5s;
}
.progress-label {
  font-size: 0.7em;
  color: #666;
  text-align: right;
  display: block;
  margin-top: -5px;
}
	
.site-footer {
  width: 100%;
  align-self: stretch;   /* ⭐ LA LIGNE IMPORTANTE */
  text-align: center;
  padding: 20px 10px;
  color: #666;
  font-size: 0.85em;
  border-top: 1px solid #eee;
  margin-top: 30px;
  font-weight: bold;
}

.container {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

body {
  margin: 0;
  padding: 16px;
  background: #f0f2f5;
  color: #222;
  min-height: 100vh;

  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;
}

/* =========================
   RESPONSIVE — Desktop
   Mobile-first : 480px par défaut (collabo terrain)
   Desktop ≥ 768px : conteneur élargi pour l'admin
========================= */
@media (min-width: 768px) {
  body {
    padding: 24px 32px;
  }

  .container {
    max-width: 860px;
    padding: 32px 36px;
  }

  /* Pages tableaux / rapports : encore plus large */
  .container-wide {
    max-width: 1100px;
    padding: 32px 36px;
  }

  /* Grille 2 colonnes pour les sections KPI côte à côte */
  .grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  /* Tableaux : permettre scroll horizontal propre */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Boutons : taille raisonnable sur desktop (pas pleine largeur) */
  .btn-desktop-auto {
    width: auto;
    min-width: 180px;
    display: inline-block;
  }
}

@media (min-width: 1200px) {
  .container-wide {
    max-width: 1280px;
  }
}

/* =========================
   BARRE DE NAVIGATION HAUTE
========================= */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: #1b5e20;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 50;
}

.top-bar-brand {
  font-weight: bold;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  opacity: 0.95;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-user {
  font-size: 0.82rem;
  opacity: 0.85;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar-logout {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: bold;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s;
}

.top-bar-logout:hover {
  background: rgba(255,255,255,0.28);
}

/* Body avec top-bar : compenser la barre fixe de 48px */
body.has-top-bar {
  padding-top: 64px;
}
