/* ============================================================================
   Page "Gérer ma cotisation"
   Aligné avec le langage visuel de l'espace membres : fond cream, accents or
   et navy, sections claires séparées par de l'air.
   ============================================================================ */

/* --- Carte exercice en cours --- */
.cotis-current-card {
  background: #ffffff;
  border: 1px solid var(--cream-dark, #e8e2d3);
  border-radius: 6px;
  padding: 2rem 2.2rem;
  box-shadow: 0 2px 8px rgba(1, 21, 45, 0.04);
}

.cotis-current-card.is-paid    { border-left: 4px solid var(--green-500); }
.cotis-current-card.is-pending { border-left: 4px solid var(--gold-500, var(--gold-500)); }
.cotis-current-card.is-late    { border-left: 4px solid #c95450; }
.cotis-current-card.is-exempt  { border-left: 4px solid #5b8aa6; }

.cotis-current-loading {
  color: var(--muted, #6b6b6b);
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem 0;
}

.cotis-current-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.cotis-current-year {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--ink, #01152d);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.cotis-current-period {
  font-size: 0.88rem;
  color: var(--muted, #6b6b6b);
  margin-top: 0.3rem;
}

.cotis-current-badge {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 2px;
  white-space: nowrap;
}

.cotis-current-badge.is-paid    { background: rgba(76, 145, 80, 0.14); color: #2f6c33; }
.cotis-current-badge.is-pending { background: rgba(192, 142, 44, 0.14); color: #8d6520; }
.cotis-current-badge.is-late    { background: rgba(201, 84, 80, 0.14); color: #8c2c28; }
.cotis-current-badge.is-exempt  { background: rgba(91, 138, 166, 0.14); color: #335875; }

.cotis-current-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--cream, #f5efe3);
}

.cotis-current-grid dt {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #6b6b6b);
  margin-bottom: 0.3rem;
}

.cotis-current-grid dd {
  font-size: 1rem;
  color: var(--ink, #01152d);
  margin: 0;
}

.cotis-current-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

/* --- Bannière "Modalités" (lien d'appel à la modale) --- */
.cotis-modalities-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding: 1.2rem 1.5rem;
  background: linear-gradient(135deg, var(--navy-900, #01152d) 0%, var(--navy-950, #010e21) 100%);
  border-radius: 6px;
  color: var(--cream, #f5efe3);
  position: relative;
  overflow: hidden;
}

.cotis-modalities-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gold-500, var(--gold-500));
}

.cotis-modalities-banner-text {
  flex: 1;
  min-width: 200px;
}

.cotis-modalities-banner-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--cream, #f5efe3);
}

.cotis-modalities-banner-sub {
  font-size: 0.85rem;
  color: rgba(245, 239, 227, 0.7);
  line-height: 1.5;
}

.cotis-modalities-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  background: var(--gold-500, var(--gold-500));
  color: var(--navy-950, #01152d);
  border: none;
  border-radius: 3px;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
}

.cotis-modalities-link:hover,
.cotis-modalities-link:focus-visible {
  background: var(--gold-400, #c9a25b);
  transform: translateX(2px);
  outline: none;
}

.cotis-modalities-link svg {
  transition: transform 0.18s ease;
}

.cotis-modalities-link:hover svg {
  transform: translateX(2px);
}

/* --- Modale "Modalités de paiement" --- */
.cotis-modalities-modal {
  /* Hérite de .member-modal-content déjà stylée dans le site */
}

.cotis-modalities-section {
  background: var(--cream, #f5efe3);
  border-radius: 4px;
  padding: 1.2rem 1.4rem;
}

.cotis-modalities-section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-500, var(--gold-500));
  margin-bottom: 0.9rem;
}

.cotis-modalities-list {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(140px, auto) 1fr;
  gap: 0.5rem 1.2rem;
}

.cotis-modalities-list dt {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted, #6b6b6b);
  align-self: center;
}

.cotis-modalities-list dd {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink, #01152d);
  line-height: 1.5;
  word-break: break-word;
}

.cotis-modalities-list code {
  font-family: 'Courier New', monospace;
  font-size: 0.92rem;
  letter-spacing: 0.5px;
  background: #ffffff;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  border: 1px solid var(--cream-dark, #e8e2d3);
  display: inline-block;
}

.cotis-modalities-note {
  margin: 1.5rem 0 0;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.9rem 1.1rem;
  background: rgba(192, 142, 44, 0.08);
  border-left: 3px solid var(--gold-500, var(--gold-500));
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink, #01152d);
}

@media (max-width: 540px) {
  .cotis-modalities-banner {
    padding: 1rem 1.1rem;
  }
  .cotis-modalities-list {
    grid-template-columns: 1fr;
    gap: 0.2rem 0;
  }
  .cotis-modalities-list dt {
    margin-top: 0.6rem;
  }
  .cotis-modalities-list dt:first-child {
    margin-top: 0;
  }
}

/* --- Historique --- */
.cotis-history-empty {
  text-align: center;
  color: var(--muted, #6b6b6b);
  font-size: 0.9rem;
  padding: 2rem 0;
}

.cotis-history-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid var(--cream-dark, #e8e2d3);
  border-radius: 4px;
  overflow: hidden;
}

.cotis-history-table th,
.cotis-history-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.92rem;
}

.cotis-history-table th {
  background: var(--cream, #f5efe3);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #6b6b6b);
}

.cotis-history-table tbody tr {
  border-top: 1px solid var(--cream, #f5efe3);
}

.cotis-history-table tbody tr:first-child {
  border-top: none;
}

.cotis-history-status {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px;
}

.cotis-history-status.is-paid    { background: rgba(76, 145, 80, 0.14); color: #2f6c33; }
.cotis-history-status.is-pending { background: rgba(192, 142, 44, 0.14); color: #8d6520; }
.cotis-history-status.is-late    { background: rgba(201, 84, 80, 0.14); color: #8c2c28; }
.cotis-history-status.is-exempt  { background: rgba(91, 138, 166, 0.14); color: #335875; }
.cotis-history-status.is-cancelled { background: #f0f0f0; color: #888; }

/* --- Responsive --- */
@media (max-width: 640px) {
  .cotis-current-card { padding: 1.5rem 1.2rem; }
  .cotis-current-year { font-size: 1.6rem; }
  .cotis-history-table th,
  .cotis-history-table td { padding: 0.6rem 0.7rem; font-size: 0.85rem; }

  /* Le tableau a 6 colonnes et reste illisible serré. Sur mobile, on
     active un scroll horizontal sur le wrapper #cotisationHistory et on
     impose une largeur minimale à la table pour qu'elle déborde et
     déclenche le scroll au lieu de s'écraser. */
  .cotis-history {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Indicateur visuel discret : ombre à droite quand il y a du contenu
       scrollable. Évite que l'utilisateur ne devine pas qu'il peut scroller. */
    background:
      linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)),
      linear-gradient(to right, rgba(1, 21, 45, 0), rgba(1, 21, 45, 0.06) 70%) 100% 0,
      radial-gradient(farthest-side at 0 50%, rgba(1, 21, 45, 0.12), rgba(1, 21, 45, 0)),
      radial-gradient(farthest-side at 100% 50%, rgba(1, 21, 45, 0.12), rgba(1, 21, 45, 0)) 100% 0;
    background-repeat: no-repeat;
    background-size: 24px 100%, 24px 100%, 8px 100%, 8px 100%;
    background-attachment: local, local, scroll, scroll;
  }
  .cotis-history-table {
    min-width: 600px;
  }
}

/* --- Bouton "Télécharger le reçu" (tableau historique) --- */
.cotis-history-receipt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  /* Largeur minimale pour que le passage en mode "spinner seul" ne fasse
     pas sauter la cellule du tableau. La valeur est calée sur la largeur
     du bouton "Reçu" rendu (icône + texte). */
  min-width: 90px;
  background: var(--navy-950, #01152d);
  color: var(--cream, #f5efe3);
  border: 1px solid var(--navy-950, #01152d);
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  white-space: nowrap;
  font-family: inherit;
}

/* Pendant la génération, le bouton garde son fond sombre mais le hover
   est désactivé (sinon il bascule en or alors qu'on est dans un état
   d'attente). */
.cotis-history-receipt-btn.is-loading {
  cursor: wait;
  background: var(--navy-950, #01152d);
  border-color: var(--navy-950, #01152d);
  color: var(--cream, #f5efe3);
}

.cotis-history-receipt-btn.is-loading:hover {
  background: var(--navy-950, #01152d);
  border-color: var(--navy-950, #01152d);
  color: var(--cream, #f5efe3);
}

.cotis-history-receipt-btn:hover:not(:disabled),
.cotis-history-receipt-btn:focus-visible {
  background: var(--gold-500, var(--gold-500));
  border-color: var(--gold-500, var(--gold-500));
  color: var(--navy-950, #01152d);
  outline: none;
}

.cotis-history-receipt-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cotis-history-receipt-btn svg {
  flex-shrink: 0;
}

.cotis-history-receipt-na {
  color: var(--muted, #6b6b6b);
  font-size: 0.85rem;
}

/* Spinner discret pendant la génération du PDF.
   Utilise `currentColor` pour s'adapter automatiquement à n'importe quel
   contexte (bouton navy côté membre, bouton admin sur fond clair, etc.) */
.cotis-receipt-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: cotis-receipt-spin 0.7s linear infinite;
  opacity: 0.85;
}

@keyframes cotis-receipt-spin {
  to { transform: rotate(360deg); }
}

/* Cache le texte visuellement tout en le laissant accessible aux
   lecteurs d'écran. Indispensable pour annoncer l'état de chargement. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
