html,
body {
  /* height: 100%; */
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  color: grey;
  background-color: #fff;
}

/* Wrapper général */
.app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* HEADER NORMAL (pas fixe) */
.site-header {
  position: relative;
  width: 100%;
}

/* FOOTER NORMAL (pas fixe) */
.site-footer {
  background: #F6FAFA;
  border-top: 1px solid #ddd;
  padding: 0.75rem 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  margin-top: auto;
}

/* CONTENU PRINCIPAL */
.site-main {
  flex: 1;
}

/* Contenu central (ce qui contient @RenderBody) */
.app-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

/* Footer global fixé en bas */
.app-footer {
  flex-shrink: 0;
  background: #F6FAFA;
  border-top: 1px solid #ddd;
  padding: 1rem 1.5rem;
  text-align: center;
}



@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 15px;
}

/* Header et Navigation */
.navbar {
  background-color: #343a40;
  padding: 1rem 0;
  margin-bottom: 2rem;
}

.navbar-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;

}

.navbar-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.navbar-logo a {
  display: flex;
  align-items: center;
}

.logo-img {
  max-height: 100px;
  width: auto;
  object-fit: contain;
}

.navbar-brand {
  color: #fff;
  font-size: 1.25rem;
  font-weight: bold;
  text-decoration: none;
}

.navbar-brand:hover {
  color: #f8f9fa;
}

.navbar-nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1rem;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.nav-item {
  display: inline-block;
}

.nav-link {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  padding: 0.5rem 1rem;
  display: block;
  white-space: nowrap;
}

.nav-link:hover {
  color: #fff;
}


.logout-btn {
  background: none;
  border: none;
  color: grey;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.logout-btn:hover {
  color: lightgrey;
}

.logout-btn svg {
  width: 24px;
  height: 24px;
}

.pb-3 {
  padding-bottom: 1rem;
}

/* Titres */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 500;
  line-height: 1.2;
}

h1 {
  font-size: 2.5rem;
}

.display-4 {
  font-size: 3.5rem;
  font-weight: 300;
  line-height: 1.2;
}

/* Texte */
.text-center {
  text-align: center;
}

.text-danger {
  color: #dc3545;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

/* Zone header du dashboard */
.dashboard-fixed-header {
  margin-top: 15px;
  padding-bottom: 1rem;
}

/* Welcome section sticky pour garder les CTA visibles */
.welcome-section {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #ffffff;
  padding: 1rem 0;
  margin-bottom: 1rem;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

/* Bloc d'information client dans le header */
.client-info-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #e0e0e0;
}

.client-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f0f0f0;
}

.client-logo {
  max-height: 75px;
  object-fit: contain;
}

.client-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
  margin: 0;
}

/* Masquer le nom du client sur petits écrans */
@media (max-width: 636px) {
  .client-name {
    display: none;
  }
}

.client-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.client-detail-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #666;
  font-size: 0.95rem;
}

.client-detail-item i {
  color: #667eea;
  font-size: 1.1rem;
}

.cgv-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.cgv-link:hover {
  color: #764ba2;
  text-decoration: underline;
}

/* Code */
code {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 87.5%;
  color: #e83e8c;
  background-color: #f8f9fa;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
}

strong {
  font-weight: bolder;
}

/* Ligne du haut : logo + texte + logout */
.welcome-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

/* Zone gauche : logo + texte */
.welcome-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Responsive : passage en colonne pour écrans < 800px */
@media (max-width: 800px) {
  .welcome-section {
    display: flex;
    flex-direction: column;
  }

  .welcome-top {
    flex-direction: column;
    align-items: stretch;
  }

  .welcome-left {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .welcome-actions {
    justify-content: center;
  }

  .navbar-logout {
    align-self: center;
  }
}

/* Empile le "Bienvenue" et le numéro de dossier */
.welcome-text {
  display: flex;
  flex-direction: column;
}

.welcome-text h3 {
  font-size: 1.8rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
}

.welcome-text p {
  margin: 0;
  opacity: 0.95;
}

/* Ligne du bas : boutons d'action */
.welcome-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Nettoyage du form logout */
.navbar-logout form {
  margin: 0;
  background: transparent;
}

.btn-pay-invoices {
  background-color: white;
  color: #667eea;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-pay-invoices:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  color: #764ba2;
}



/* Overlay plein écran */
.cp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* Modal */
.cp-modal {
  position: relative;
  width: 800px;
  height: 700px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: cp-scale-in 0.25s ease-out;
}

/* Iframe */
.cp-iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* Bouton fermer */
.cp-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
}

.cp-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* Responsive mobile */
@media (max-width: 768px) {
  .cp-close {
    top: 8px;
    right: 8px;
  }

  .cp-modal {
    position: relative;
    width: 400px;
    height: 700px;
  }
}

/* Animation */
@keyframes cp-scale-in {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========================================
   STYLES POUR LA PAGE DE PAIEMENT
   ======================================== */

.payment-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.payment-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2rem;
  border-radius: 12px 12px 0 0;
  margin-bottom: 0;
}

.payment-header h2 {
  margin: 0 0 1rem 0;
  font-size: 1.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.total-amount-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.15);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin-top: 1rem;
}

.total-amount-display .label {
  font-size: 1.1rem;
  font-weight: 500;
}

.total-amount-display .amount {
  font-size: 2rem;
  font-weight: 700;
}

.payment-form-section {
  background: #F8F9FA;
  padding: 2rem 0;
  border: 1px solid #e0e0e0;
  border-top: none;
}

/* Styles pour les groupes de formulaire */
.form-group {
  margin-bottom: 1.5rem;
  padding: 0 2rem;
}

.form-label {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.form-label.required::after {
  content: " *";
  color: #dc3545;
}

.form-label i {
  color: #667eea;
  margin-right: 0.5rem;
}

/* Styles pour les selects */
.form-select {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  background-color: white;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 12px;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
}

.form-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-select:hover {
  border-color: #667eea;
}

/* Styles pour les inputs */
.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control:hover {
  border-color: #667eea;
}

.form-control[readonly] {
  background-color: #f8f9fa;
  cursor: not-allowed;
}

.form-text {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #6c757d;
}

.payment-option {
  margin-bottom: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  transition: all 0.3s ease;
  overflow: hidden;
}

.payment-option:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.payment-option input[type="radio"] {
  display: none;
}

.payment-option input[type="radio"]:checked+label {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-left: 4px solid #667eea;
}

.payment-option label {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  gap: 1.25rem;
  margin: 0;
  transition: all 0.3s ease;
}

.payment-option label:hover {
  background: rgba(102, 126, 234, 0.05);
}

.option-icon {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  font-size: 1.5rem;
}

.option-content {
  flex: 1;
}

.option-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.25rem;
}

.option-description {
  font-size: 0.9rem;
  color: #666;
}

.option-amount {
  flex-shrink: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #667eea;
}

.installment-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid #f0f0f0;
}

.installment-option {
  background: #f8f9ff;
}

.fees-info {
  color: #999;
  font-size: 0.85rem;
  font-style: italic;
}

.free-amount-input,
.post-dated-input,
.installment-date-input {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed #ddd;
}

.installment-date-input {
  background: #f8f9ff;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  border: 1px solid #e0e0e0;
}

.installment-date-input label {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.installment-date-input label i {
  color: #667eea;
  margin-right: 0.5rem;
}

.free-amount-input input,
.post-dated-input input,
.installment-date-input input {
  width: 100%;
  max-width: 300px;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.free-amount-input input:focus,
.post-dated-input input:focus,
.installment-date-input input:focus {
  outline: none;
  border-color: #667eea;
}

.installment-date-input .form-text {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #6c757d;
}

/* Styles pour le récapitulatif */
.payment-summary {
  background: #f8f9ff;
  padding: 1.5rem;
  border-radius: 8px;
  margin: 1.5rem 2rem;
  border: 1px solid #e0e0e0;
}

.payment-summary h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.payment-summary h4 i {
  color: #667eea;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e9ecef;
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-total {
  font-weight: 700;
  font-size: 1.2rem;
  color: #667eea;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 2px solid #667eea !important;
}

.actions {
  background: #F8F9FA;
  padding: 2rem;
  border: 1px solid #e0e0e0;
  border-top: none;
  border-radius: 0 0 12px 12px;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.actions .btn {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-2px);
}

.alert {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-warning {
  background: #fff3cd;
  border: 1px solid #ffc107;
  color: #856404;
}

.alert i {
  font-size: 1.5rem;
}

/* Alerte de paiement récent */
.recent-payment-warning {
  background: linear-gradient(135deg, #fff3cd 0%, #ffe8a1 100%);
  border: 2px solid #ffc107;
  padding: 1.5rem;
  margin: 0 0 1.5rem 0;
  border-radius: 0;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
  animation: pulse-warning 2s ease-in-out;
}

.recent-payment-warning i {
  font-size: 2rem;
  color: #ff9800;
  flex-shrink: 0;
}

.recent-payment-warning .warning-content {
  flex: 1;
}

.recent-payment-warning .warning-content strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: #664d03;
}

.recent-payment-warning .warning-content p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #856404;
}

@keyframes pulse-warning {

  0%,
  100% {
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
  }

  50% {
    box-shadow: 0 4px 20px rgba(255, 193, 7, 0.4);
  }
}

@media (max-width: 768px) {
  .recent-payment-warning {
    padding: 1rem;
  }

  .recent-payment-warning i {
    font-size: 1.5rem;
  }

  .recent-payment-warning .warning-content strong {
    font-size: 1rem;
  }

  .recent-payment-warning .warning-content p {
    font-size: 0.9rem;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .payment-header {
    padding: 1.5rem;
  }

  .payment-header h2 {
    font-size: 1.5rem;
  }

  .total-amount-display {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .payment-form-section {
    padding: 1.5rem 0;
  }

  .form-group {
    padding: 0 1rem;
  }

  .payment-summary {
    margin: 1.5rem 1rem;
  }

  .payment-option label {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
  }

  .option-amount {
    font-size: 1.3rem;
  }

  .payment-actions {
    flex-direction: column;
    padding: 1.5rem;
  }

  .payment-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ========================================
   STYLES POUR LES ACCORDÉONS DE PAIEMENT
   ======================================== */

.payment-category {
  margin-bottom: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.payment-category:hover {
  border-color: #667eea;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: #f8f9fa;
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
  font-weight: 600;
  font-size: 1.1rem;
  color: #333;
}

.category-header:hover {
  background: #e9ecef;
}

.category-header.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.category-header i:first-child {
  font-size: 1.5rem;
}

.category-header span {
  flex: 1;
}

.chevron-icon {
  transition: transform 0.3s ease;
  font-size: 1.2rem;
}

.category-header.active .chevron-icon {
  transform: rotate(180deg);
}

.category-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: white;
}

.category-content.show {
  max-height: 2000px;
}

.category-content .payment-option {
  margin: 0;
  border: none;
  border-bottom: 1px solid #f0f0f0;
  border-radius: 0;
}

.category-content .payment-option:last-child {
  border-bottom: none;
}

.category-content .payment-option:hover {
  border-color: #f0f0f0;
  box-shadow: none;
  background: #f8f9ff;
}

.category-content .payment-option input[type="radio"]:checked+label {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
  border-left: 4px solid #667eea;
}

/* ========================================
   AMÉLIORATION STICKY TOP POUR PAIEMENT
   ======================================== */

/* Section sticky avec fond opaque pour éviter la transparence */
.sticky-top {
  background-color: #ffffff;
  z-index: 1020;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding-top: 1rem;
  padding-bottom: 1rem;
}

/* Informations du débiteur dans la section sticky */
.debtor-info {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.debtor-info h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.debtor-info p {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.95;
}

/* ========================================
   STYLES POUR LA MESSAGERIE
   ======================================== */

/* Style pour la liste des fichiers */
.file-list-item {
  border-left: 4px solid #667eea;
  transition: all 0.3s ease;
}

.file-list-item:hover {
  background-color: #f8f9fa;
  border-left-color: #764ba2;
}

/* Style pour les boutons de suppression de fichiers */
.btn-delete-file {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border: none;
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
  cursor: pointer;
}

.btn-delete-file:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

/* Animation pour les badges */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.badge {
  animation: fadeIn 0.3s ease;
}

.attachments-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.attachments-header .form-label {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.attachments-formats {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: #6c757d;
}

#fileList .list-group-item {
  margin-bottom: 0.25rem;
}
