/* Compléments à periode.css : année + boutons mois + patchs mobile + calendrier */

/* ========================================
   Bouton Retour Portail amélioré
   ======================================== */
.btn-back-portal {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.btn-back-portal:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
  text-decoration: none;
  color: white;
}

.btn-back-portal:active {
  transform: translateY(0);
}

.btn-back-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.btn-back-text {
  line-height: 1;
}

.toolbar--year{
  flex-wrap: wrap;
}

.year-label{ color: var(--muted); font-size: 13px; font-weight: 800; }
.year-select{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  min-width: 120px;
  font-weight: 800;
}

.monthbar{
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 14px;
}

.month-grid{
  display:grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.month-btn{
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 10px 10px;
  cursor: pointer;
  text-align: left;
  border: 1px solid rgba(15,23,42,.12);
  transition: transform .08s ease, filter .2s ease;
  display:flex;
  flex-direction: column;
  gap: 6px;
  background: #fff;
}

.month-btn:hover{ transform: translateY(-1px); filter: brightness(0.98); }

.month-btn:focus{
  outline: 3px solid rgba(37,99,235,.35);
  outline-offset: 2px;
}

.month-btn .m-label{
  font-weight: 900;
  text-transform: lowercase;
  font-size: 13px;
}

.month-btn .m-km{
  font-size: 12px;
  color: rgba(15,23,42,.75);
}

.month-btn.brouillon{ background: var(--brouillon); }
.month-btn.soumis   { background: var(--soumis); }
.month-btn.valide   { background: var(--valide); }
.month-btn.refuse   { background: var(--refuse); }

.month-btn.is-active{
  box-shadow: 0 0 0 3px rgba(37,99,235,.25);
  border-color: rgba(37,99,235,.35);
}

@media (max-width: 900px){
  .month-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.toolbar--month{
  padding-top: 0;
}

#lockHint{
  font-weight: 800;
}

/* =========================================================
   MODALS: patch mobile (scroll interne + boutons accessibles)
   ========================================================= */

.modal{
  max-height: 92vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* header fixe */
.modal-head{
  flex: 0 0 auto;
}

/* corps scrollable */
.modal-body{
  padding: 18px 20px 14px;
  overflow: auto;
  flex: 1;
}

/* =========================================================
   CALENDRIER: rendre les encodages visibles + couleur statut
   ========================================================= */

/* Accent par défaut + mapping statut -> couleur */
:root{ --cal-accent: var(--brouillon); }
:root[data-period-status="brouillon"]{ --cal-accent: var(--brouillon); }
:root[data-period-status="soumis"]{    --cal-accent: var(--soumis); }
:root[data-period-status="valide"]{    --cal-accent: var(--valide); }
:root[data-period-status="refuse"]{    --cal-accent: var(--refuse); }

/* Jour avec encodage : contour interne discret mais net */
.day-cell.has-moves{
  box-shadow: inset 0 0 0 2px rgba(15,23,42,.10);
}

/* Numéro du jour devient une "pastille" teintée */
.day-cell.has-moves .day-num{
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--cal-accent);
  border: 1px solid rgba(15,23,42,.12);
  font-weight: 900;
}

/* Lignes km : plus visibles (fond + gras) */
.day-cell .move-line{
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(15,23,42,.10);
  font-weight: 800;
}

.day-cell.has-moves .move-line{
  background: var(--cal-accent);
  border-color: rgba(15,23,42,.14);
}

/* Hover pour comprendre que c'est cliquable */
.day-cell.has-moves .move-line:hover{
  filter: brightness(.98);
  transform: translateY(-1px);
}


.agent-card--click{
  cursor: pointer;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.92);
}

.agent-card--click:hover{
  filter: brightness(.99);
}

.user-list{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.10);
  background: #fff;
  cursor: pointer;
}

.user-item:hover{ filter: brightness(.99); transform: translateY(-1px); }

.user-main{
  display:flex;
  flex-direction:column;
  gap: 3px;
}

.user-name{ font-weight: 950; }
.user-sub{ color: rgba(15,23,42,.70); font-weight: 800; font-size: 12px; }

.user-pill{
  font-weight: 950;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(59,130,246,.08);
}
/* --- Patch: footer des modales (évite l'effet "fond qui ne couvre pas" sous les boutons) --- */

/* --- Modal layout: header fixed, body scroll, footer fixed (no overlap) --- */
.modal{
  display:flex;
  flex-direction:column;
}
.modal-body{
  flex:1;
  overflow:auto;
}
.modal-actions{
  flex-shrink:0;
  display:flex;
  justify-content:flex-end;
  gap:10px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(0,0,0,0.08);
  background: #fff;
}
/* ========================================
   AJOUTS CSS POUR LA VALIDATION
   À ajouter dans css/unifie.css
   ======================================== */

/* Boutons d'action */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn:active {
  transform: translateY(0);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-icon {
  font-size: 1.125rem;
  line-height: 1;
}

.btn-text {
  line-height: 1;
}

/* Variantes de boutons */
.action-btn--primary {
  background: #3b82f6;
  color: white;
}

.action-btn--primary:hover:not(:disabled) {
  background: #2563eb;
}

.action-btn--success {
  background: #10b981;
  color: white;
}

.action-btn--success:hover:not(:disabled) {
  background: #059669;
}

.action-btn--warning {
  background: #f59e0b;
  color: white;
}

.action-btn--warning:hover:not(:disabled) {
  background: #d97706;
}

.action-btn--danger {
  background: #ef4444;
  color: white;
}

.action-btn--danger:hover:not(:disabled) {
  background: #dc2626;
}

/* Message période verrouillée */
.periode-locked {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: #fef3c7;
  color: #92400e;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.9375rem;
}

.locked-icon {
  font-size: 1.125rem;
}

/* ========================================
   STATUTS DE PÉRIODE (Pills)
   ======================================== */
.periode-pill {
  position: relative;
}

/* Badge de statut */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Couleurs des statuts (selon la légende) */
.periode-pill.brouillon,
.status-badge.brouillon,
.month-btn.brouillon {
  background-color: #fef3c7 !important; /* Jaune pastel */
  color: #92400e;
}

.periode-pill.soumis,
.status-badge.soumis,
.month-btn.soumis {
  background-color: #dbeafe !important; /* Bleu pastel */
  color: #1e3a8a;
}

.periode-pill.valide,
.status-badge.valide,
.month-btn.valide {
  background-color: #d1fae5 !important; /* Vert pastel */
  color: #065f46;
}

.periode-pill.refuse,
.status-badge.refuse,
.month-btn.refuse {
  background-color: #fee2e2 !important; /* Rouge pastel */
  color: #991b1b;
}

/* Boutons de mois avec statuts */
.month-btn {
  position: relative;
  transition: all 0.2s;
}

.month-btn.is-active {
  ring: 2px solid currentColor;
  transform: scale(1.02);
  font-weight: 600;
}

/* ========================================
   MODALE DE SOUMISSION
   ======================================== */
.submit-summary {
  margin: 1.5rem 0;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 8px;
}

.submit-summary h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
}

.summary-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
}

.summary-list dt {
  font-weight: 500;
  color: #6b7280;
}

.summary-list dd {
  margin: 0;
  font-weight: 600;
  color: #111827;
}

.submit-question {
  margin: 1.5rem 0 0 0;
  font-weight: 500;
  color: #374151;
}

/* Alertes */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.alert--info {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1e40af;
}

.alert--warning {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.alert--success {
  background: #d1fae5;
  border: 1px solid #86efac;
  color: #065f46;
}

.alert--danger {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.alert p {
  margin: 0;
}

.alert strong {
  font-weight: 600;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .summary-list {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .summary-list dt {
    font-size: 0.875rem;
  }

  .summary-list dd {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
  }
}

/* ========================================
   LÉGENDE DES STATUTS
   ======================================== */
.status-legend {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: #f9fafb;
  border-radius: 8px;
  font-size: 0.875rem;
  margin: 1rem 0;
}

.status-legend__title {
  font-weight: 600;
  color: #374151;
  margin-right: 0.5rem;
}

.status-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.status-legend__color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.status-legend__color--brouillon {
  background: #fbbf24;
}

.status-legend__color--soumis {
  background: #60a5fa;
}

.status-legend__color--valide {
  background: #34d399;
}

.status-legend__color--refuse {
  background: #f87171;
}

.status-legend__label {
  color: #6b7280;
}

/* ========================================
   COMMENTAIRES DE VALIDATION
   ======================================== */
.validation-comment {
  margin: 1rem 0;
  padding: 1rem;
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: 4px;
}

.validation-comment__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.validation-comment__title {
  font-weight: 600;
  color: #92400e;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.validation-comment__date {
  font-size: 0.8125rem;
  color: #78350f;
}

.validation-comment__text {
  margin: 0;
  color: #78350f;
  line-height: 1.5;
}

/* Variante pour refus */
.validation-comment--refused {
  background: #fee2e2;
  border-left-color: #ef4444;
}

.validation-comment--refused .validation-comment__title,
.validation-comment--refused .validation-comment__date,
.validation-comment--refused .validation-comment__text {
  color: #991b1b;
}

/* Variante pour validation */
.validation-comment--validated {
  background: #d1fae5;
  border-left-color: #10b981;
}

.validation-comment--validated .validation-comment__title,
.validation-comment--validated .validation-comment__date,
.validation-comment--validated .validation-comment__text {
  color: #065f46;
}

/* ========================================
   Nouvelle disposition des boutons dans details-head
   ======================================== */
.details-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 8px;
}

.details-head-left {
  flex: 1;
}

.details-head-right {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Responsive : empiler sur mobile */
@media (max-width: 768px) {
  .details-head {
    flex-direction: column;
    align-items: stretch;
  }

  .details-head-right {
    width: 100%;
    justify-content: center;
  }

  .action-btn {
    flex: 1;
    justify-content: center;
    min-width: 120px;
  }
}

/* ========================================
   Modale admin - Warning et Info
   ======================================== */

/* Warning pas de données admin */
.admin-warning {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: #fef3c7;
  border: 2px solid #f59e0b;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.warning-icon {
  font-size: 2rem;
  flex-shrink: 0;
  line-height: 1;
}

.warning-content {
  flex: 1;
}

.warning-title {
  font-weight: 600;
  color: #92400e;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.warning-text {
  color: #78350f;
  margin-bottom: 1rem;
  line-height: 1.5;
  font-size: 0.9375rem;
}

.admin-warning .btn {
  margin-top: 0.5rem;
}

.admin-warning .btn-icon {
  font-size: 1.125rem;
}

/* Info données héritées */
.admin-info {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #dbeafe;
  border-left: 4px solid #3b82f6;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.info-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
}

.info-text {
  color: #1e40af;
  font-size: 0.9375rem;
  line-height: 1.4;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-warning {
    flex-direction: column;
  }

  .warning-icon {
    font-size: 1.5rem;
  }
}

/* ============================================
   🆕 CORRECTION BOUTON VALIDATION - Fond et texte visibles
   ============================================ */

/* Conteneur pour bouton validation + agent card */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 🆕 Bouton Validation - VERSION CORRIGÉE (fond vert, texte blanc visible) */
.btn-validation {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);  /* 🔧 Fond vert au lieu de transparent */
  border: none;  /* 🔧 Pas de bordure transparente */
  border-radius: 10px;
  color: white;
  text-decoration: none;
  transition: all 0.2s ease;
  min-width: 90px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-validation:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);  /* 🔧 Fond vert plus foncé au hover */
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  text-decoration: none;
  color: white;
}

.btn-validation:active {
  transform: translateY(0);
}

.btn-validation__icon {
  font-size: 24px;
  line-height: 1;
}

.btn-validation__text {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  letter-spacing: 0.3px;
  opacity: 1;  /* 🔧 Opacité à 1 pour être sûr que c'est visible */
}

/* Mobile */
@media (max-width: 768px) {
  .header-actions {
    gap: 8px;
  }
  
  .btn-validation {
    min-width: 80px;
    padding: 8px 14px;
  }
  
  .btn-validation__icon {
    font-size: 22px;
  }
  
  .btn-validation__text {
    font-size: 10px;
  }
}

/* ============================================
   🆕 CSS MOTIF DE REFUS
   À ajouter à la fin de unifie.css
   ============================================ */

/* Alerte de refus en haut de page */
.refusal-alert {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-left: 4px solid #dc2626;
  padding: 20px;
  margin: 0 auto;
  max-width: 1200px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
  position: relative;
  animation: slideDown 0.3s ease;
}

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

.refusal-alert__icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}

.refusal-alert__content {
  flex: 1;
  min-width: 0;
}

.refusal-alert__title {
  font-size: 18px;
  font-weight: 700;
  color: #991b1b;
  margin-bottom: 8px;
}

.refusal-alert__message {
  color: #7f1d1d;
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.refusal-alert__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-alert {
  padding: 10px 20px;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-alert:hover {
  background: #b91c1c;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.refusal-alert__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(127, 29, 29, 0.1);
  border-radius: 6px;
  cursor: pointer;
  font-size: 20px;
  color: #991b1b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.refusal-alert__close:hover {
  background: rgba(127, 29, 29, 0.2);
}

/* Infobulle sur badge statut */
.status-badge.has-tooltip {
  cursor: help;
  position: relative;
}

.status-badge .tooltip-icon {
  font-size: 14px;
  opacity: 0.8;
  margin-left: 4px;
}

.status-badge.has-tooltip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Boîte de refus dans modale admin */
.admin-refusal-box {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border: 2px solid #ef4444;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}

.admin-refusal-box__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-refusal-box__icon {
  font-size: 24px;
  line-height: 1;
}

.admin-refusal-box__title {
  font-size: 16px;
  font-weight: 700;
  color: #991b1b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-refusal-box__message {
  color: #7f1d1d;
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: rgba(255, 255, 255, 0.5);
  padding: 12px;
  border-radius: 8px;
}

.admin-refusal-box__date {
  color: #991b1b;
  font-size: 13px;
  font-weight: 600;
  font-style: italic;
}

/* Badge refusé plus visible */
.periode-pill.refuse,
.status-badge.refuse {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border: 2px solid #ef4444 !important;
  font-weight: 800;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .refusal-alert {
    flex-direction: column;
    padding: 16px;
  }

  .refusal-alert__icon {
    font-size: 28px;
  }

  .refusal-alert__title {
    font-size: 16px;
  }

  .refusal-alert__message {
    font-size: 14px;
  }

  .refusal-alert__close {
    top: 12px;
    right: 12px;
  }

  .btn-alert {
    width: 100%;
    text-align: center;
  }
}