/**
 * Thème « Portail » — forêt & vert : tons bois/mousse, vert en accent module.
 * Basé sur le guide DSF avec couleur module verte.
 */

:root {
  /* Vert Portail (actions, liens, identité module) */
  --sf-forest: #10b981;
  --sf-forest-dark: #059669;
  --sf-moss: #047857;
  --sf-leaf: #6ee7b7;

  /* Surfaces forêt */
  --sf-canopy: #0d2818;
  --sf-moss-green: #1a5c42;
  --sf-leaf-green: #2d6a4f;
  --sf-sky-tint: #eef4e8;
  --sf-cream: #f7f9f3;
  --sf-parchment: #dde8d4;
  --sf-bark: #3d4a3f;
  --sf-accent: #f59e0b;
  --sf-wood: #8b6914;

  --dsf-glow: 0 8px 28px rgba(16, 185, 129, 0.12);
  --dsf-glow-hover: 0 14px 36px rgba(16, 185, 129, 0.16);
  --dsf-radius-xl: 0.9rem;

  --bs-primary: var(--sf-forest);
  --bs-primary-rgb: 16, 185, 129;
  --bs-link-color: #059669;
  --bs-link-hover-color: var(--sf-forest-dark);
  --bs-body-bg: var(--sf-cream);
  --bs-body-color: #2a332c;
  --bs-border-radius: 0.55rem;
  --bs-card-border-radius: 0.75rem;

  /* Tableaux & DataTables */
  --dsf-tbl-primary-rgb: 16, 185, 129;
  --dsf-tbl-header-bg: #065f46;
  --dsf-tbl-header-color: #dcfce7;
  --dsf-tbl-row-even-bg: #ffffff;
  --dsf-tbl-row-odd-bg: #ecfdf5;
  --dsf-tbl-row-odd-inset: #ecfdf5;
  --dsf-tbl-hover-bg: rgba(16, 185, 129, 0.38);
  --dsf-tbl-hover-solid: rgba(16, 185, 129, 0.45);
  --dsf-tbl-border: rgba(16, 185, 129, 0.22);
  --dsf-tbl-border-light: rgba(16, 185, 129, 0.12);
  --dsf-tbl-sort-active: var(--sf-moss-green);
  --dsf-tbl-control-border: rgba(16, 185, 129, 0.2);
  --dt-row-selected: 16, 185, 129;
}

/* -------------------------------------------------------------------------- */
/* Base layout                                                                */
/* -------------------------------------------------------------------------- */

.app-sante-forets-portail {
  font-family: "Outfit", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.55;
  min-height: 100vh;
  color: var(--bs-body-color);
  background-color: var(--sf-cream);
  background-image:
    radial-gradient(ellipse 80% 55% at 100% 0%, rgba(16, 185, 129, 0.12), transparent 50%),
    radial-gradient(ellipse 70% 50% at 0% 100%, rgba(45, 106, 79, 0.07), transparent 48%),
    url("../img/portail/bg-grid.svg");
  background-repeat: no-repeat, no-repeat, repeat;
  background-size: auto, auto, 56px 56px;
  background-attachment: fixed, fixed, fixed;
}

.app-sante-forets-portail main#content {
  position: relative;
}

.app-sante-forets-portail main#content > .container-fluid {
  padding-top: 0.35rem;
  padding-bottom: 2.5rem;
}

/* Bandeau — forêt vers vert + silhouette forestière                */
.sf-app-header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    115deg,
    #0d2818 0%,
    #143d32 30%,
    #1a5c42 58%,
    #059669 82%,
    #10b981 100%
  );
  box-shadow: 0 6px 24px rgba(20, 61, 50, 0.35);
}

.sf-app-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(13, 40, 24, 0.72) 0%, rgba(13, 40, 24, 0.35) 48%, transparent 78%),
    url("../img/portail/header-forest.svg") right bottom / auto 100% no-repeat;
  pointer-events: none;
}

.sf-app-header::after {
  content: "";
  position: absolute;
  top: -30%;
  right: 8%;
  z-index: 0;
  width: min(45vw, 360px);
  height: 160%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.18) 0%, transparent 62%);
  pointer-events: none;
}

.sf-app-header .navbar {
  position: relative;
  z-index: 2;
}

.sf-app-header .navbar-brand,
.sf-app-header .navbar-brand:hover,
.sf-app-header .navbar-brand:focus,
.sf-app-header .navbar-brand span {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  background: none !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.sf-app-header .navbar-brand small {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78) !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.78) !important;
  margin-top: 0.12rem;
}

.sf-header-brand-icon {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.55rem;
  flex-shrink: 0;
  background-color: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 4px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(4px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22v-6'/%3E%3Cpath d='M12 16c-3 0-5.5-2.2-5.5-5.5C6.5 8 8.5 6 12 4c3.5 2 5.5 4 5.5 6.5C17.5 13.8 15 16 12 16z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 1.1rem 1.1rem;
}

.sf-header-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-width: 0;
}

.sf-header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 0.75rem;
}

.sf-header-portail {
  flex-shrink: 0;
}

.sf-header-user {
  max-width: min(100%, 18rem);
  line-height: 1.25;
  color: #fff !important;
  text-align: right;
}

.sf-header-user-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.72) !important;
}

.sf-header-user-name {
  font-weight: 600;
  max-width: 100%;
  vertical-align: bottom;
  color: #fff !important;
}

/* Barre d'actions page d'accueil — sous le bandeau, alignée à droite */
.dsf-page-actions-bar {
  background: linear-gradient(180deg, rgba(221, 232, 212, 0.55), rgba(247, 249, 243, 0.4));
  border-bottom: 1px solid rgba(45, 106, 79, 0.12);
}

.dsf-page-actions-bar .container-fluid {
  min-height: 2.75rem;
}

.sf-app-header .btn-outline-light {
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.8) !important;
  background: rgba(255, 255, 255, 0.12);
  text-shadow: none;
}

.sf-app-header .btn-outline-light:hover,
.sf-app-header .btn-outline-light:focus {
  color: #143d32 !important;
  background: #fff !important;
  border-color: #fff !important;
}

.sf-app-header .btn-light {
  color: #065f46 !important;
  background: #fff !important;
  border-color: #fff !important;
}

.sf-app-header .btn-light:hover {
  background: #f0fdf4 !important;
  color: #065f46 !important;
}

.max-width-user {
  max-width: 14rem;
}

@media (max-width: 767.98px) {
  .sf-header-left {
    width: 100%;
  }

  .sf-header-right {
    width: 100%;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
  }

  .sf-header-user {
    width: 100%;
    max-width: none;
    order: 10;
    padding-top: 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .max-width-user {
    max-width: none;
  }
}

.sf-print-header {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(45, 106, 79, 0.14);
}

/* Titres — forêt vers vert sur les intros                                */
.app-sante-forets-portail h1,
.app-sante-forets-portail .h3 {
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #1a4034;
  line-height: 1.2;
}

.dsf-page-intro > h1,
.dsf-page-intro > .h3,
.app-sante-forets-portail main h1.dsf-page-intro,
.app-sante-forets-portail main .renseigne-campagne-titre.dsf-page-intro {
  background: linear-gradient(120deg, #1a5c42 0%, #2d6a4f 40%, #10b981 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.dsf-page-intro {
  position: relative;
  padding-bottom: 0.85rem;
  margin-bottom: 1.35rem;
  border-bottom: none;
}

/* Titre à gauche, actions en haut à droite (accueil, campagne…) */
.dsf-page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding-bottom: 0.85rem;
  margin-bottom: 1.35rem;
}

.dsf-page-toolbar .dsf-page-intro {
  flex: 1 1 12rem;
  min-width: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.dsf-page-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

@media (max-width: 575.98px) {
  .dsf-page-toolbar-actions {
    width: 100%;
  }
}

.dsf-page-intro::after,
.app-sante-forets-portail main h1.dsf-page-intro::after,
.app-sante-forets-portail main .renseigne-campagne-titre.dsf-page-intro::after {
  content: "";
  display: block;
  height: 3px;
  width: min(100%, 10rem);
  margin-top: 0.65rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #2d6a4f, #10b981, #6ee7b7, #10b981, #2d6a4f);
  background-size: 200% 100%;
  animation: dsf-accent-flow 5s ease-in-out infinite;
}

@keyframes dsf-accent-flow {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.app-sante-forets-portail .card-title {
  font-weight: 600;
  color: #1a4034;
  padding-bottom: 0.35rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid rgba(45, 106, 79, 0.18);
}

/* Cartes — papier chaud, lueur verte au survol                                   */
.app-sante-forets-portail .card {
  position: relative;
  border: 1px solid rgba(45, 106, 79, 0.16);
  border-radius: var(--dsf-radius-xl);
  box-shadow: var(--dsf-glow);
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(6px);
  overflow: hidden;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.app-sante-forets-portail .card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sf-moss-green), var(--sf-accent), var(--sf-forest));
  opacity: 0.92;
}

.app-sante-forets-portail .card-body {
  padding: 1.25rem 1.35rem 1.35rem;
}

/* Sur les fiches en édition, on laisse dépasser les panneaux d'autocomplete. */
.app-sante-forets-portail .fiche-form-section,
.app-sante-forets-portail .fiche-form-section .card-body {
  overflow: visible;
}

/* Carte filtre : bande latérale masquée (le tableau a déjà son entête dédié). */
.app-sante-forets-portail .filtre-fiches-card::before {
  display: none;
}

/* -------------------------------------------------------------------------- */
/* Boutons & barre d'actions liste                                            */
/* -------------------------------------------------------------------------- */

.app-sante-forets-portail .btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 55%, #047857 100%);
  border: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.app-sante-forets-portail .btn-primary:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 55%, #059669 100%);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.app-sante-forets-portail .btn-success {
  background: linear-gradient(135deg, #047857, #059669);
  border: none;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.28);
}

.app-sante-forets-portail .btn-outline-secondary {
  border-color: rgba(16, 185, 129, 0.35);
  color: #1a4034;
  background: rgba(255, 253, 248, 0.88);
  backdrop-filter: blur(4px);
}

.app-sante-forets-portail .btn-outline-secondary:hover {
  background: rgba(16, 185, 129, 0.14);
  border-color: var(--sf-moss-green);
  color: #1a4034;
}

/* -------------------------------------------------------------------------- */
/* Alertes                                                                    */
/* -------------------------------------------------------------------------- */

.app-sante-forets-portail .alert {
  border: none;
  border-left: 4px solid;
}

.app-sante-forets-portail .alert-success {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.app-sante-forets-portail .alert-danger {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.07);
}

.app-sante-forets-portail .alert-warning {
  border-left-color: var(--sf-accent);
  background: rgba(245, 158, 11, 0.09);
}

.app-sante-forets-portail .alert-info {
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
}

/* Petites aides visuelles                                                    */
.app-sante-forets-portail .text-muted {
  color: #5a6578 !important;
}

/* -------------------------------------------------------------------------- */
/* En-têtes tableaux DataTables — vert forêt foncé, texte clair                  */
/* -------------------------------------------------------------------------- */

.app-sante-forets-portail table.dataTable thead th,
.app-sante-forets-portail table.dataTable thead td {
  background: linear-gradient(180deg, #1f6b4f 0%, #143d32 100%);
  color: #dcfce7;
  border-bottom: 2px solid #0d2818;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}

.app-sante-forets-portail table.dataTable thead th.dt-orderable-asc:hover,
.app-sante-forets-portail table.dataTable thead th.dt-orderable-desc:hover,
.app-sante-forets-portail table.dataTable thead td.dt-orderable-asc:hover,
.app-sante-forets-portail table.dataTable thead td.dt-orderable-desc:hover {
  background: linear-gradient(180deg, #26855e 0%, #1a5c42 100%);
  color: #fff;
}

.app-sante-forets-portail table.dataTable thead .dt-column-order {
  color: rgba(220, 252, 231, 0.9);
}

/* Pied de page */
.dsf-site-footer {
  margin-top: 1.5rem;
  border-top: 1px solid rgba(45, 106, 79, 0.14);
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.7), rgba(221, 232, 212, 0.85));
}

.dsf-site-footer-text {
  font-size: 0.8125rem;
  color: var(--sf-bark);
  text-align: center;
}

/* -------------------------------------------------------------------------- */
/* Badges et statuts (métier - ne pas modifier les couleurs)                 */
/* -------------------------------------------------------------------------- */

/* E — En préparation */
.activite-portail-statut-e {
  background: #bfdbfe;
  color: #1e3a8a;
  border-color: #2563eb;
}

/* P — Préparée / en cours de saisie */
.activite-portail-statut-p {
  background: #fcd34d;
  color: #713f12;
  border-color: #d97706;
}

/* V — Validée */
.activite-portail-statut-v {
  background: #86efac;
  color: #14532d;
  border-color: #16a34a;
}

.activite-portail-statut {
  display: inline-block;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  border: 1.5px solid transparent;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

@media (prefers-reduced-motion: reduce) {
  .dsf-page-intro::after,
  .app-sante-forets-portail main h1.dsf-page-intro::after,
  .app-sante-forets-portail main .renseigne-campagne-titre.dsf-page-intro::after {
    animation: none;
  }

  .app-sante-forets-portail .card,
  .app-sante-forets-portail .btn-primary {
    transition: none;
  }

  .app-sante-forets-portail .btn-primary:hover {
    transform: none;
  }
}
