/* ============================================
   Styles specifiques de l'application
   - Palette : voir atih-tokens.css (charges en premier)
   - Couleurs Bootstrap : var(--bs-primary), var(--bs-info), etc.
   - Couleurs DevKit  : var(--had-100), var(--smr-100), --medium-100, etc.
   - Police de base + typo : fournies par bslib (bs_theme + DMSans-font.css)
   AUCUNE valeur hex hardcodee ici.
   ============================================ */

/* ============================================
   Classes utilitaires partagees
   ============================================ */

.summary-flex {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.summary-text {
  margin: 0;
  font-size: 14px;
  color: var(--medium-100);
}

.switch-wrapper {
  font-size: 14px;
  color: var(--medium-100);
}

.switch-wrapper .form-group {
  margin-bottom: 0;
}

/* ============================================
   Cartouches de filtres (mod_select_*)
   ============================================ */

.btn.filter-card {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--medium-200);
  border-radius: 0.5rem;
  background: var(--white);
  color: inherit;
  text-align: left;
  white-space: normal;
  cursor: pointer;
  min-height: 4.5rem;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.btn.filter-card:hover,
.btn.filter-card:focus,
.btn.filter-card:active {
  background: var(--white);
  color: inherit;
  border-color: var(--bs-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.filter-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.filter-card-title {
  font-weight: 600;
  color: var(--bs-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-card-edit {
  color: var(--grey-000);
  font-size: 0.9rem;
}

.filter-card-summary {
  color: var(--medium-100);
  font-size: 0.9rem;
  line-height: 1.3;
  display: block;
}

/* ============================================
   Popups Leaflet (carte des autorisations)
   ============================================ */

.popup-info h4 {
  margin: 0 0 4px 0;
  color: var(--bs-primary);
}

.popup-info-table {
  font-size: 13px;
  border-collapse: collapse;
  width: 100%;
}

.popup-info-table td.label {
  color: var(--grey-000);
  padding: 2px 8px 2px 0;
}

.popup-info-stats {
  font-size: 12px;
  color: var(--medium-100);
}

.popup-divider {
  margin: 8px 0;
}

.certif-badge {
  font-weight: 600;
}

.popup-container {
  min-width: 300px;
  max-width: 400px;
}

.popup-btn-primary {
  width: 100%;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bs-primary);
  color: var(--white);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s;
  box-shadow: 0 2px 4px color-mix(in srgb, var(--bs-primary) 30%, transparent);
  margin-bottom: 8px;
}

.popup-btn-group {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.popup-btn-secondary {
  flex: 1;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bs-info);
  color: var(--white);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.popup-btn-danger {
  flex: 1;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--white);
  color: var(--bs-danger);
  border: 1px solid var(--bs-danger);
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s;
}

/* ============================================
   Clusters Leaflet (markerClusterOptions)
   Harmonise les bulles de cluster sur la palette
   semantique ATIH (cf. mod_carte_mention.R) :
     small  -> success (SMR vert)
     medium -> warning (MCO orange)
     large  -> danger  (HAD rouge)
   ============================================ */

.marker-cluster-small {
  background-color: #B2DBD3 !important;
}

.marker-cluster-small div {
  background-color: #1C7E6D !important;
}

.marker-cluster-medium {
  background-color: #FECE8E !important;
}

.marker-cluster-medium div {
  background-color: #F4B460 !important;
}

.marker-cluster-large {
  background-color: #DF6277 !important;
}

.marker-cluster-large div {
  background-color: #C92B46 !important;
}

.marker-cluster span {
  color: var(--white);
  font-weight: 600;
}

/* ============================================
   Navbar (style ATIH-DEVKIT)
   Reproduit la spec du DevKit (ATIH-DEVKIT.css L866-915)
   sur la DOM emise par bslib::page_navbar() :
     - fond blanc, 80px de haut
     - items en font-weight 600
     - lien actif souligne 4px en rouge HAD
   ============================================ */

.navbar {
  background-color: var(--white) !important;
  min-height: 80px;
  border-bottom: 1px solid var(--medium-200);
  padding: 0 1rem;
}

.navbar .navbar-brand {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 32px 0 0;
  padding: 0;
  color: var(--dark-100);
}

.navbar .navbar-brand .navbar-logo {
  height: 45px;
  width: auto;
}

.navbar .navbar-brand .navbar-title {
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  color: var(--dark-100);
  text-transform: none;
}

.navbar .navbar-nav .nav-link {
  font-size: 15px;
  line-height: 22.5px;
  font-weight: 600;
  color: var(--dark-100);
  padding: 0.75rem 1rem;
  margin: 0 6px;
  border-bottom: 4px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.navbar .navbar-nav .nav-link:hover,
.navbar .navbar-nav .nav-link:focus {
  color: var(--had-000);
  border-bottom-color: var(--had-200);
}

.navbar .navbar-nav .nav-link.active,
.navbar .navbar-nav .nav-link[aria-current="page"] {
  color: var(--dark-100);
  border-bottom-color: var(--had-100);
  background-color: transparent;
}

.navbar .navbar-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--medium-100);
  font-size: 14px;
}

.navbar .navbar-user-info .user-label {
  font-weight: 500;
}

/* ============================================
   Page d'accueil — Hero + Info (2 colonnes)
   ============================================ */

/* Header simple de la page d'accueil : logo DAv centre */
.accueil-header {
  background-color: var(--white);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--medium-200);
}

.accueil-header-logo {
  height: 56px;
  width: auto;
  max-width: 100%;
}

@media (max-width: 768px) {
  .accueil-header-logo {
    height: 40px;
  }
}

.hero-section {
  position: relative;
  min-height: 55vh;
  background-color: var(--had-100);
  background-image: url('bannerhad.png');
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--white) 60%, transparent);
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 800px;
  padding: 2rem;
  color: var(--dark-100);
}

.hero-content h1 {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hero-content .lead {
  opacity: 0.9;
  font-size: 1.1rem;
}

/* Section basse : Features + Audience */
.info-section {
  padding: 2.5rem 3rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* Feature cards */
.feature-card {
  border-left: 3px solid var(--bs-info) !important;
  margin-bottom: 0.75rem;
}

/* Audience panel */
.audience-panel {
  padding-left: 1.5rem;
  border-left: 1px solid var(--medium-200);
}

/* Responsive */
@media (max-width: 768px) {
  .hero-section {
    min-height: 45vh;
  }

  .hero-content h1 {
    font-size: 1.8rem;
  }

  .info-section {
    padding: 2rem 1.5rem;
  }

  .audience-panel {
    padding-left: 0;
    border-left: none;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--medium-200);
  }

  .informations-page {
    padding: 1.5rem 1rem;
  }
}

/* ============================================
   Page Informations
   ============================================ */

.informations-page {
  padding: 2rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Section "Pour aller plus loin" */
.info-section-highlight {
  background-color: var(--light-100);
  border-radius: 0.5rem;
  padding: 2rem;
  margin: 2rem 0;
}

/* Cartes applications compagnons */
.companion-card {
  border-left: 4px solid var(--bs-info) !important;
  transition: box-shadow 0.2s ease;
}

.companion-card:hover {
  box-shadow: 0 4px 12px color-mix(in srgb, var(--bs-info) 15%, transparent);
}

/* ============================================
   Footer (style ATIH-DEVKIT)
   Pas de composant footer dans ATIH-DEVKIT.css : on cree
   un footer simple qui reprend la palette DevKit.
     - fond dark-100, texte/logo blancs
     - layout flex : brand a gauche, liens a droite
     - logo ATIH passe en blanc via filter (Logo_ATIH_mini.svg
       d'origine bicolore rouge/bleu)
   ============================================ */

.atih-footer {
  background-color: var(--dark-100);
  color: var(--white);
  padding: 20px 32px;
  margin-top: 32px;
}

.atih-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.atih-footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.atih-footer-logo {
  height: 24px;
  width: auto;
  /* Logo_ATIH_mini.svg est bicolore (rouge + bleu) -> on le passe en blanc */
  filter: brightness(0) invert(1);
}

.atih-footer-copy {
  font-size: 13px;
  font-weight: 500;
  color: var(--white);
  opacity: 0.85;
}

.atih-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}

.atih-footer-links a {
  color: var(--white);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}

.atih-footer-links a:hover,
.atih-footer-links a:focus {
  color: var(--had-200);
  border-bottom-color: var(--had-200);
}

/* ============================================
   Module "Les plateformes Data ATIH" (navbar)
   Reproduit le module #header-platforms-wrapper de shiny.activite.mco.
   ATIH-DEVKIT.css / feathericon n'etant pas charges ici, on porte le
   strict necessaire, scope sous #header-platforms-wrapper pour ne pas
   impacter le reste de l'app (classes .card-title, .btn-round, ...).
   Toggle du dropdown : voir inst/app/www/app.js.
   ============================================ */

#header-platforms-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

#header-platforms-wrapper .lien_plateformes {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  color: var(--dav-3);
  font-weight: 600;
  text-transform: none;
  cursor: pointer;
  text-decoration: none;
}

#header-platforms-wrapper .lien_plateformes:hover,
#header-platforms-wrapper .lien_plateformes:focus {
  color: var(--dav-4);
}

#header-platforms-wrapper .dropdown_plateforme {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1030;
  display: none;
  flex-direction: column;
  width: max-content;
  max-width: 80vw;
  box-sizing: border-box;
  padding: 20px;
  gap: 24px;
  border: 1px solid var(--bluegrey-100);
  border-radius: 8px;
  background-color: var(--light-100);
  box-shadow: -5px 4px 10px rgba(0, 0, 0, 0.25);
}

#header-platforms-wrapper .dropdown_plateforme.show {
  display: flex !important;
}

#header-platforms-wrapper .row_platforme {
  display: grid;
  grid-template-columns: repeat(2, fit-content(100%));
  justify-content: space-between;
  gap: 24px;
}

#header-platforms-wrapper .card_plateforme {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  width: fit-content;
  padding: 40px;
  border: 1px solid var(--bluegrey-100);
  border-radius: 8px;
  background-color: var(--white);
}

#header-platforms-wrapper .card_plateforme-atih {
  border: none;
  background-color: transparent;
}

#header-platforms-wrapper .card_plateforme img {
  width: 62px;
  height: 32px;
}

#header-platforms-wrapper .card-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--dark-100);
}

#header-platforms-wrapper .card_plateforme p {
  margin: 0;
  max-width: 300px;
  font-weight: 500;
  text-transform: none;
  color: var(--medium-100);
}

#header-platforms-wrapper .text_plateforme {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#header-platforms-wrapper .btn_plateforme {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
}

#header-platforms-wrapper .btn_plateforme p {
  flex: 1;
  max-width: 231px;
  font-size: 14px;
  font-weight: 400;
}

/* Bouton rond a icone (CTA Essentiel / Avance / Expert) */
#header-platforms-wrapper .btn-round {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  color: var(--dark-100);
}

#header-platforms-wrapper .btn-round svg {
  width: 18px;
  height: 18px;
}

#header-platforms-wrapper .essentiel .btn-round { background-color: transparent; border: 1px solid var(--des-3); }
#header-platforms-wrapper .essentiel .btn-round:hover { background-color: var(--des-3); border-color: var(--des-1); }
#header-platforms-wrapper .avance .btn-round { background-color: transparent; border: 1px solid var(--dav-6); }
#header-platforms-wrapper .avance .btn-round:hover { background-color: var(--dav-6); border-color: var(--dav-4); }
#header-platforms-wrapper .expert .btn-round { background-color: transparent; border: 1px solid var(--dex-4); }
#header-platforms-wrapper .expert .btn-round:hover { background-color: var(--dex-4); border-color: var(--dex-2); }

/* Bouton "Retour a Data ATIH" */
#header-platforms-wrapper .btn-tertiary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 2px solid var(--primary-100);
  border-radius: 8px;
  background-color: transparent;
  color: var(--primary-100);
  font-weight: 600;
}

#header-platforms-wrapper .btn-tertiary:hover {
  background-color: var(--primary-100);
  color: var(--white);
}

/* Empile les cartes sur petits ecrans */
@media (max-width: 768px) {
  #header-platforms-wrapper .row_platforme {
    grid-template-columns: 1fr;
  }
  #header-platforms-wrapper .dropdown_plateforme {
    max-width: 92vw;
  }
}