/* =============================================================================
 * ADSWF — assets/css/adswf.css
 * Version : 2.33.0
 * Scope   : UNIQUEMENT dans [data-adswf]
 *
 * PLAN
 * 0) Variables & base
 * 1) Forms / buttons / cards
 * 2) Badges (statuts)
 * 3) Bootstrap-Table : search + toolbar (ordre & robustesse thème)
 * 4) Tables : séparateurs horizontaux (global ADSWF)
 * 5) Toolbars custom (dashboard / remplacements)
 * 6) Lisibilité tables (padding / hover / align)
 * 7) Utilitaires / fixes
 * =============================================================================
 */

/* -------------------------------------------------------------------------
 * 0) Variables & base
 * ---------------------------------------------------------------------- */

[data-adswf]{
  --adswf-radius: 0.6rem;
  --adswf-gap: 0.5rem;

  /* Séparateurs */
  --adswf-line: rgba(17, 24, 39, 0.10);          /* lignes horizontales */
  --adswf-line-strong: rgba(17, 24, 39, 0.14);   /* header */
  --adswf-hover: rgba(17, 24, 39, 0.03);         /* hover row */

  /* Badges (contraste) */
  --adswf-badge-success: #16a34a; /* green-600 */
  --adswf-badge-primary: #2563eb; /* blue-600 */
  --adswf-badge-warning: #f59e0b; /* amber-500 */
  --adswf-badge-danger:  #dc2626; /* red-600 */
  --adswf-badge-muted-bg:#e2e8f0; /* slate-200 */
  --adswf-badge-muted-fg:#1f2937; /* gray-800 */
}

/* -------------------------------------------------------------------------
 * 1) Forms / buttons / cards
 * ---------------------------------------------------------------------- */

[data-adswf] .card,
[data-adswf] .modal-content,
[data-adswf] .dropdown-menu{
  border-radius: calc(var(--adswf-radius) + 0.2rem);
}

[data-adswf] .form-control,
[data-adswf] .form-select{
  border-radius: var(--adswf-radius);
}

[data-adswf] .form-control:focus,
[data-adswf] .form-select:focus{
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

[data-adswf] .btn,
[data-adswf] .btn.btn-sm{
  border-radius: var(--adswf-radius);
}

[data-adswf] .btn.btn-sm{
  padding: 0.25rem 0.5rem; /* tap friendly */
}

/* -------------------------------------------------------------------------
 * 2) Badges (statuts)
 * ---------------------------------------------------------------------- */

/* OK */
[data-adswf] .badge.text-bg-success{
  background-color: var(--adswf-badge-success) !important;
  color: #fff !important;
}

/* Planifié */
[data-adswf] .badge.text-bg-primary{
  background-color: var(--adswf-badge-primary) !important;
  color: #fff !important;
}

/* En cours */
[data-adswf] .badge.text-bg-warning{
  background-color: var(--adswf-badge-warning) !important;
  color: #111827 !important;
}

/* Annulé */
[data-adswf] .badge.text-bg-danger{
  background-color: var(--adswf-badge-danger) !important;
  color: #fff !important;
}

/* Non / neutre */
[data-adswf] .badge.text-bg-secondary{
  background-color: var(--adswf-badge-muted-bg) !important;
  color: var(--adswf-badge-muted-fg) !important;
}

/* Lisibilité badge */
[data-adswf] .badge{
  border-radius: var(--adswf-radius);
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 0.35rem 0.55rem;
  line-height: 1;
}

/* -------------------------------------------------------------------------
 * 3) Bootstrap-Table : search + toolbar (ordre & robustesse thème)
 * ---------------------------------------------------------------------- */

/* 3.1 Forcer visibilité de la search (certains thèmes masquent `.search`) */
[data-adswf] .bootstrap-table .fixed-table-toolbar .search,
[data-adswf] #dash-toolbar-buttons .search,
[data-adswf] #rempl-toolbar .search,
[data-adswf] .adswf-btable-search{
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  float: none !important;
  margin: 0 !important;
}

/* Taille input search */
[data-adswf] .bootstrap-table .fixed-table-toolbar .search input,
[data-adswf] #dash-toolbar-buttons .search input,
[data-adswf] #rempl-toolbar .search input,
[data-adswf] .adswf-btable-search input{
  min-width: 240px;
  border-radius: var(--adswf-radius);
}

@media (max-width: 576px){
  [data-adswf] .bootstrap-table .fixed-table-toolbar .search input,
  [data-adswf] #dash-toolbar-buttons .search input,
  [data-adswf] #rempl-toolbar .search input,
  [data-adswf] .adswf-btable-search input{
    min-width: 160px;
    width: 100%;
  }
}

/* 3.2 Layout toolbar (Search → Export → Colonnes) */
[data-adswf] .bootstrap-table .fixed-table-toolbar{
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--adswf-gap);
}

/* zone "bars" à gauche si utilisée */
[data-adswf] .bootstrap-table .fixed-table-toolbar .bs-bars,
[data-adswf] .bootstrap-table .fixed-table-toolbar .bars{
  flex: 1 1 auto;
  order: 1;
  min-width: 120px;
}

/* Search à droite avant les boutons */
[data-adswf] .bootstrap-table .fixed-table-toolbar .search{
  order: 10;
  margin-left: auto !important;
}

/* Boutons (export/colonnes) après search */
[data-adswf] .bootstrap-table .fixed-table-toolbar .columns,
[data-adswf] .bootstrap-table .fixed-table-toolbar .columns-right{
  order: 20;
}

/* éviter que des marges "fantômes" décalent l’ordre */
[data-adswf] .bootstrap-table .fixed-table-toolbar .btn-group,
[data-adswf] .bootstrap-table .fixed-table-toolbar .btn-group-vertical{
  margin: 0 !important;
}

/* dropdown bootstrap-table : cohérent */
[data-adswf] .bootstrap-table .fixed-table-toolbar .dropdown-menu{
  border-radius: calc(var(--adswf-radius) + 0.2rem);
}

/* -------------------------------------------------------------------------
 * 4) Tables : séparateurs horizontaux (global ADSWF)
 *
 * Objectif : toutes les tables ADSWF (bootstrap-table + tables simples)
 * ont des lignes horizontales cohérentes, incluant "Périodes de postes vacants".
 * ---------------------------------------------------------------------- */

/* 4.1 Bootstrap-Table (table interne) */
[data-adswf] .bootstrap-table .fixed-table-container table thead th{
  border-bottom: 2px solid var(--adswf-line-strong) !important;
}

[data-adswf] .bootstrap-table .fixed-table-container table tbody tr > *{
  border-bottom: 1px solid var(--adswf-line) !important;
}

/* Option : pas de ligne après la dernière ligne */
[data-adswf] .bootstrap-table .fixed-table-container table tbody tr:last-child > *{
  border-bottom: 0 !important;
}

/* 4.2 Tables "classiques" Bootstrap `.table` (hors bootstrap-table) */
[data-adswf] table.table thead th{
  border-bottom: 2px solid var(--adswf-line-strong) !important;
}

[data-adswf] table.table tbody tr > *{
  border-bottom: 1px solid var(--adswf-line) !important;
}

[data-adswf] table.table tbody tr:last-child > *{
  border-bottom: 0 !important;
}

/* 4.3 Sécurité : certains rendus injectent `.table` sans thead */
[data-adswf] table.table{
  border-collapse: separate;
  border-spacing: 0;
}

/* -------------------------------------------------------------------------
 * 5) Toolbars custom (dashboard / remplacements)
 * ---------------------------------------------------------------------- */

/* Dashboard toolbar custom */
[data-adswf] #dash-toolbar-buttons{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--adswf-gap);
}

[data-adswf] #dash-toolbar-buttons .search{
  margin-left: auto !important;
  order: 10;
}

[data-adswf] #dash-toolbar-buttons .export,
[data-adswf] #dash-toolbar-buttons .columns,
[data-adswf] #dash-toolbar-buttons .btn-group{
  order: 20;
}

/* Remplacements toolbar custom : summary à gauche, actions à droite */
[data-adswf="remplacements"] #rempl-toolbar{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--adswf-gap);
}

[data-adswf="remplacements"] #rempl-toolbar #rempl-toolbar-summary{
  flex: 1 1 auto;
  order: 1;
  min-width: 160px;
}

[data-adswf="remplacements"] #rempl-toolbar .search{
  margin-left: auto !important;
  order: 10;
}

[data-adswf="remplacements"] #rempl-toolbar .export,
[data-adswf="remplacements"] #rempl-toolbar .columns,
[data-adswf="remplacements"] #rempl-toolbar .btn-group{
  order: 20;
}

/* -------------------------------------------------------------------------
 * 6) Lisibilité tables (padding / hover / align)
 * ---------------------------------------------------------------------- */

[data-adswf] .table > :not(caption) > * > *{
  vertical-align: middle;
}

[data-adswf] .table td,
[data-adswf] .table th{
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

/* Hover discret */
[data-adswf] .table-hover > tbody > tr:hover > *{
  background-color: var(--adswf-hover) !important;
}

/* -------------------------------------------------------------------------
 * 7) Utilitaires / fixes
 * ---------------------------------------------------------------------- */

/* FontAwesome dans boutons (certains thèmes modifient line-height) */
[data-adswf] .btn i.fa,
[data-adswf] .btn i.fas,
[data-adswf] .btn i.far{
  line-height: 1;
}

/* caret (certains thèmes le cachent) */
[data-adswf] .dropdown-toggle .caret{
  display: inline-block;
}

/* -------------------------------------------------------------------------
 * 8) Modales — Actions avancées (archivage / suppression candidat)
 * ---------------------------------------------------------------------- */

[data-adswf] .adswf-advanced-actions{
  border-top: 1px dashed var(--adswf-line);
  padding-top: 0.75rem;
}

[data-adswf] .adswf-advanced-actions .accordion-button{
  background: transparent;
}

[data-adswf] .adswf-advanced-actions code{
  padding: 0.05rem 0.25rem;
  border-radius: 0.25rem;
  background: rgba(15, 23, 42, 0.06);
}


/* -------------------------------------------------------------------------
 * 9) Couverture — Navigation Mois (input type=month + prev/next)
 *
 * Objectif : améliorer la lisibilité du filtre "Mois" (évite le texte tronqué
 *            sur certains thèmes + rend les boutons cohérents).
 * ---------------------------------------------------------------------- */

[data-adswf="couverture"] .adswf-month-nav{
  flex-wrap: nowrap;
}

[data-adswf="couverture"] .adswf-month-nav .adswf-month-nav-btn{
  width: 2.25rem;
  padding: 0; /* maximise l’espace pour le champ mois */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

[data-adswf="couverture"] .adswf-month-nav .adswf-month-nav-btn i{
  font-size: 0.95rem;
  line-height: 1;
}

[data-adswf="couverture"] .adswf-month-nav .adswf-month-nav-input{
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.2px;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}

/* Sur desktop/tablette, garantir une largeur suffisante pour afficher le mois + année */
@media (min-width: 768px){
  [data-adswf="couverture"] .adswf-month-nav .adswf-month-nav-input{
    min-width: 10rem;
  }
}

/* Chrome/Safari : l’icône calendrier peut "manger" l’espace texte */
[data-adswf="couverture"] .adswf-month-nav .adswf-month-nav-input::-webkit-calendar-picker-indicator{
  opacity: 0.6;
  cursor: pointer;
}

/* Sur mobiles, laisser respirer un peu (évite les sauts de ligne) */
@media (max-width: 576px){
  [data-adswf="couverture"] .adswf-month-nav .adswf-month-nav-btn{
    width: 2.5rem;
  }
}


/* Neutraliser certains thèmes qui transforment les outline en boutons "primary" au hover */
[data-adswf="couverture"] .adswf-month-nav .adswf-month-nav-btn:hover{
  background: rgba(15, 23, 42, 0.04);
}

[data-adswf="couverture"] .adswf-month-nav .adswf-month-nav-btn:active{
  background: rgba(15, 23, 42, 0.06);
}

/* 11) WP Admin — Configuration OnCall (full width)
   La page admin possède déjà le conteneur `.wrap` WordPress (largeur pleine).
   On évite toute contrainte de largeur côté UI (utile sur écrans larges).
*/
[data-adswf="config-oncall"] .adswf-admin-config-app,
[data-adswf="config-oncall"] .adswf-config-oncall{
  width: 100%;
  max-width: none !important;
  margin-top: 12px;
}

[data-adswf="config-oncall"] .adswf-config-oncall .card{
  /*
   * IMPORTANT:
   * WordPress (admin) définit aussi une classe `.card` (ex: écran login) avec
   * des contraintes de largeur (max-width + centrage). Sur cette page,
   * nous forçons la largeur pleine pour éviter une "colonne étroite".
   */
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  border: 1px solid #dcdcde;
  box-shadow: none;
}

[data-adswf="config-oncall"] .adswf-config-oncall .card-header{
  background: #f6f7f7;
}

/*
 * WP admin: supprimer tout max-width implicite si un plugin/thème admin ajoute des contraintes.
 */
.wrap.adswf-wrap-wide{
  max-width: none !important;
}

/* -------------------------------------------------------------------------
 * 12) Modales — Close button "inratable" + Statuts UF
 * ---------------------------------------------------------------------- */

/* Close button neutre (noir sur blanc) — utilisé dans plusieurs modales ADSWF */
[data-adswf] .adswf-modal-x{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(0,0,0,.25);
  background: #fff;
  color: #000;
  font-size: 24px;
  line-height: 1;
  opacity: 1;
  cursor: pointer;
}

[data-adswf] .adswf-modal-x:hover{
  background: rgba(0,0,0,.04);
}

[data-adswf] .adswf-modal-x:focus{
  outline: none;
  box-shadow: 0 0 0 .2rem rgba(13,110,253,.25);
}

[data-adswf] .adswf-modal-x--round{
  border-radius: 999px;
}

[data-adswf] .adswf-modal-x--fixed{
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1061;
}

/* v3.7.0 — "modal-md" (Bootstrap n'a pas de taille md dédiée) :
 * on fournit une largeur intermédiaire pour le Manager (moins large que modal-lg). */
[data-adswf] .modal-md{
  max-width: 720px;
}

/* Modal UF (Couverture) : le bouton doit rester visible indépendamment du scroll */
#cov-assign-modal .modal-content{
  position: relative;
}

#cov-assign-modal .modal-header{
  padding-right: 3.25rem;
}

/* Statuts UF : petite puce colorée */
[data-adswf] .adswf-status-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 10px;
  margin-top: .35rem;
}

[data-adswf] .adswf-status-dot--current{
  background: var(--adswf-badge-success);
}

[data-adswf] .adswf-status-dot--future{
  background: var(--adswf-badge-primary);
}

[data-adswf] .adswf-status-dot--past{
  background: #111827; /* near-black */
}

[data-adswf] .adswf-status-dot--unknown{
  background: rgba(17, 24, 39, 0.25);
}
