/* ==========================================================================
   LogiALVIA — assets/css/common.css
   Feuille de style commune a toutes les pages.
   Mecanismes comportementaux repris fidelement d'AgriERP (memes classes,
   meme logique d'accordeon/submenu/responsive) — seuls les tokens de
   couleur changent, conformement au CDCT ALLMANY §10.4.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Police d'icones Material Symbols Outlined hebergee EN LOCAL (Offline-First)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Material Symbols Outlined";
  font-style: normal;
  font-weight: 100 700;
  font-display: block;
  src: url("../fonts/MaterialSymbolsOutlined.woff2") format("woff2");
}
.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "liga";
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* --------------------------------------------------------------------------
   Base / Typographie — CDCT §10.4 : Roboto/Calibri, min 16px mobile
   -------------------------------------------------------------------------- */
body {
  font-family: 'Roboto', 'Calibri', sans-serif;
}
.text-xs {
  font-size: 0.85rem !important;
}
@media (max-width: 640px) {
  body { font-size: 16px; }
}

/* --------------------------------------------------------------------------
   Sidebar — degrade Bleu Marine (au lieu du degrade Vert Foret d'AgriERP)
   -------------------------------------------------------------------------- */
.sidebar-gradient {
  background: linear-gradient(180deg, #1F3864 0%, #152847 100%);
}
.custom-scrollbar::-webkit-scrollbar {
  width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #3D5789;
  border-radius: 10px;
}
.submenu {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height .3s ease, opacity .2s ease;
}
.submenu.open {
  max-height: 600px;
  opacity: 1;
}
.chev {
  transition: transform .2s ease;
}
.chev.rot {
  transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   Surbrillance active du sidebar — Ocre Dore (au lieu du Jaune Mais AgriERP)
   -------------------------------------------------------------------------- */
.sidebar-link-active {
  background-color: rgba(181, 139, 42, 0.16);
  color: #D4A94D !important;
  font-weight: 700;
  border-left: 3px solid #B58B2A;
}

/* --------------------------------------------------------------------------
   Accordeon KPI (mobile ET desktop — toggleKpiPanel, meme mecanisme exact
   qu'AgriERP, y compris la regle md:hidden sur le bouton — lecon deja
   capitalisee, jamais un accordeon visible sans effet en desktop)
   -------------------------------------------------------------------------- */
.kpi-mobile-collapsed {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height .3s ease, opacity .2s ease;
}
.kpi-mobile-collapsed.open {
  max-height: 900px;
  opacity: 1;
}
@media (min-width: 768px) {
  .kpi-mobile-collapsed {
    max-height: none !important;
    opacity: 1 !important;
    overflow: visible !important;
  }
}
.kpi-chev {
  transition: transform .2s ease;
}
.kpi-chev.rot {
  transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   Bascule Grille Quotidienne / Vue Hebdomadaire (nouveau — specifique
   LogiALVIA, Fiches Couveuse/Goliaths/Pintades/Poissons-Chats)
   -------------------------------------------------------------------------- */
.density-view {
  display: none;
}
.density-view.active {
  display: block;
}
.density-toggle-btn {
  transition: background-color .2s ease, color .2s ease;
}
.density-toggle-btn.active {
  background-color: #1F3864;
  color: #FFFFFF;
}

/* --------------------------------------------------------------------------
   DataTable responsive (table.rtable) — mobile : tableau -> cartes empilees
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  table.rtable thead {
    display: none;
  }
  table.rtable, table.rtable tbody, table.rtable tr, table.rtable td {
    display: block;
    width: 100%;
  }
  table.rtable tr {
    margin-bottom: 12px;
    border: 1px solid #D8DCE3;
    border-radius: 8px;
  }
  table.rtable td {
    text-align: right;
    padding-left: 50%;
    position: relative;
  }
  table.rtable td[data-label]::before {
    content: attr(data-label);
    position: absolute;
    left: 12px;
    font-weight: 700;
    text-align: left;
    color: #1F3864;
  }
}

/* --------------------------------------------------------------------------
   Impression PDF — jamais le sidebar/topbar dans l'export
   -------------------------------------------------------------------------- */
@media print {
  .no-print { display: none !important; }
}

/* --------------------------------------------------------------------------
   Sidebar replie (desktop) — meme comportement, largeur w:72px a w:288px
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
  .sidebar-collapsed-label { display: none; }
}
