/* fisc-ir.css - Styles modernisés pour simulateur fiscal */

:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #dbeafe;
  --secondary-color: #6b7280;
  --secondary-hover: #4b5563;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --warning-color: #f59e0b;
  --background: #f8fafc;
  --background-light: #f1f5f9;
  --card-background: #ffffff;
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md:
    0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition-fast: 0.15s ease-out;
  --transition-base: 0.2s ease-out;
}

/* ========== BOUTONS ========== */
.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.2);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
  background: var(--secondary-color);
  cursor: not-allowed;
  transform: none;
}

.btn-primary.btn-large {
  padding: 12px 24px;
  font-size: 1.1rem;
  margin-bottom: 30px;
}

.btn-secondary {
  background: white;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: var(--background-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
}

.btn-icon {
  font-size: 1.1em;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

/* ========== FORMULAIRES ========== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.form-label.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.form-input,
.form-textarea {
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  transition: all var(--transition-base);
  background: var(--card-background);
  color: var(--text-primary);
  width: 100%;
  font-family: inherit;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ========== SÉLECTEUR ANNÉE FISCALE ========== */
.year-selector-card {
  background: linear-gradient(135deg, #dbeafe, #bae6fd);
  border: 2px solid var(--primary-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-end;
  gap: 20px;
  box-shadow: var(--shadow-lg);
}

.year-selector-card .form-group {
  flex: 1;
  margin-bottom: 0;
}

.year-selector-card .form-input {
  background: white;
}

/* ========== TOOLBAR ========== */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ========== INFO BADGE ========== */
.info-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #f0fdf4;
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 400;
  font-size: 0.9rem;
  margin-bottom: 20px;
  border: 1px solid #bbf7d0;
}

/* ========== TABLEAUX ========== */
.table-wrapper {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: var(--radius-md);
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: white;
}

.modern-table thead {
  background: linear-gradient(
    to right,
    var(--success-color),
    var(--primary-color)
  );
  color: white;
}

.modern-table th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  color: white;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: transparent;
  z-index: 10;
}

.modern-table td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  vertical-align: middle;
  font-size: 0.95rem;
}

.modern-table tbody tr {
  transition: all var(--transition-fast);
}

.modern-table tbody tr:hover {
  background: var(--background-light);
  box-shadow: inset 3px 0 0 var(--success-color);
}

.col-narrow {
  width: 80px;
  text-align: center;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

/* ========== ACTIONS ========== */
.actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

.actions button {
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: var(--radius-sm);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease;
  box-shadow: none;
}

.actions button:hover {
  transform: none;
  box-shadow: none;
}

.actions button.edit {
  color: var(--warning-color);
}

.actions button.edit:hover {
  background: #fef3c7;
  color: #d97706;
}

.actions button.delete-btn {
  color: var(--danger-color);
}

.actions button.delete-btn:hover {
  background: #fee2e2;
  color: var(--danger-hover);
}

/* ========== FOOTER DE TABLEAU ========== */
.table-footer-card {
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table-footer-card .modern-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: white;
}

.table-footer-card tfoot {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border-top: 2px solid var(--success-color);
}

.table-footer-card tfoot td {
  padding: 12px 15px;
  font-weight: 600;
  border-bottom: none;
  color: var(--text-primary);
  font-size: 0.95rem;
}

/* ========== SECTIONS FORMULAIRE ========== */
.form-section {
  background: var(--card-background);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-light);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 16px;
}

/* ========== ITEMS CONTAINERS (enfants, revenus, etc.) ========== */
.items-container {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item-card {
  background: var(--background-light);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  transition: all var(--transition-base);
}

.item-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

.item-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  flex: 1;
}

.item-content .form-group {
  margin-bottom: 0;
}

.item-actions {
  display: flex;
  gap: 8px;
}

.btn-remove {
  background: linear-gradient(135deg, var(--danger-color), var(--danger-hover));
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  font-weight: 600;
  font-size: 0.9rem;
}

.btn-remove:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-sm {
  padding: 10px 20px;
  font-size: 0.9rem;
}

/* ========== TOTAL BADGES ========== */
.total-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #dbeafe, #bae6fd);
  color: var(--primary-color);
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  font-weight: 700;
  margin-top: 16px;
}

.total-badge strong {
  font-size: 1rem;
}

.total-badge span {
  font-size: 1.2rem;
  font-weight: 700;
}

/* ========== FORM ACTIONS ========== */
.form-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 32px 0;
  padding-top: 24px;
  border-top: 2px solid var(--border-light);
}

/* ========== RÉSULTAT ========== */
.resultat-section {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border: 3px solid var(--primary-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin-top: 32px;
  box-shadow: var(--shadow-lg);
}

.resultat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.resultat-item {
  background: var(--card-background);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all var(--transition-base);
}

.resultat-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.resultat-item.highlight {
  border-color: var(--primary-color);
  border-width: 3px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
}

.resultat-item.success {
  border-color: var(--success-color);
  border-width: 3px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.resultat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.resultat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.resultat-item.highlight .resultat-value {
  color: var(--primary-color);
}

.resultat-item.success .resultat-value {
  color: var(--success-color);
}

/* ========== CHECKBOX ========== */
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary-color);
  border-radius: 4px;
  transition: all var(--transition-base);
}

input[type="checkbox"]:hover {
  transform: scale(1.1);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ========== SELECT ========== */
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='%233b82f6'%3E%3Cpath d='M3 5l3 3 3-3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 40px;
}

/* ========== CLASSE MASQUÉE ========== */
.is-hidden {
  display: none !important;
}

/* ========== MODAL ========== */
#enfantModal.is-active .modal-card-foot,
#revenuModal.is-active .modal-card-foot,
#chargeModal.is-active .modal-card-foot,
#avantageModal.is-active .modal-card-foot {
  flex-shrink: 0 !important;
  margin-top: auto !important;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .year-selector-card {
    flex-direction: column;
    align-items: stretch;
  }

  .resultat-container {
    grid-template-columns: 1fr;
  }

  .modern-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: white;
  }

  .modern-table th,
  .modern-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
    font-size: 0.95rem;
  }

  .actions button {
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border-radius: var(--radius-sm);
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.2s ease;
    box-shadow: none;
  }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}
/* ========== STATISTIQUES - GRILLE CORRIGÉE ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.stat-card {
  background: var(--card-background);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.stat-icon {
  font-size: 2.5rem;
  min-width: 60px;
  text-align: center;
}

.stat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.stat-value.positive {
  color: var(--success-color);
}

.stat-value.negative {
  color: var(--danger-color);
}

/* ========== RESPONSIVE STATISTIQUES ========== */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
  }

  .stat-card {
    padding: 16px;
    gap: 12px;
  }

  .stat-icon {
    font-size: 2rem;
    min-width: 50px;
  }

  .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
  }
}
/* ========== GRILLE DE CARDS DÉTAILLÉES ========== */

.cards-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 24px;
  align-items: start; /* Important pour l'alignement */
}

.resultat-card {
  background: var(--card-background);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  height: 100%; /* Pour aligner les hauteurs */
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
  flex-shrink: 0;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow: hidden; /* Éviter les débordements */
}

/* ========== CARD IMPÔTS TOTAUX ========== */

.total-impots-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.total-impots-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--secondary-color);
  transition: all var(--transition-base);
}

.total-impots-line:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.total-impots-line.total {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-left-color: var(--primary-color);
  border-width: 4px;
  padding: 16px;
  margin-top: 8px;
}

.total-impots-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  white-space: nowrap; /* Éviter le retour à la ligne */
}

.total-impots-value {
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 1rem;
  text-align: right;
  white-space: nowrap; /* Éviter le retour à la ligne */
}

.total-impots-value.highlight {
  color: var(--primary-color);
  font-size: 1.3rem;
  font-weight: 700;
}

.total-impots-note {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--warning-color);
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.total-impots-note i {
  color: var(--warning-color);
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* ========== AVANTAGES FISCAUX ========== */

.avantage-section {
  margin-bottom: 16px;
}

.avantage-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.avantage-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--success-color);
  margin-bottom: 8px;
  transition: all var(--transition-base);
  gap: 12px; /* Espace entre label et montant */
}

.avantage-line:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.avantage-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0; /* Important pour ellipsis */
}

.avantage-montant {
  font-weight: 700;
  color: var(--success-color);
  font-size: 1rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ========== PRÉLÈVEMENTS SOCIAUX ========== */

.prelevement-line {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--warning-color);
  margin-bottom: 8px;
  transition: all var(--transition-base);
}

.prelevement-line:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.prelevement-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.prelevement-label {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.prelevement-taux {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.prelevement-calcul {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}

.prelevement-base {
  color: var(--text-secondary);
  font-size: 0.85rem;
  white-space: nowrap;
}

.prelevement-arrow {
  color: var(--warning-color);
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.prelevement-montant {
  color: var(--warning-color);
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ========== IMPÔT NET (RESTITUTION) ========== */

.resultat-item.restitution {
  border-color: var(--primary-color);
  border-width: 3px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

.resultat-item.restitution .resultat-value {
  color: var(--primary-color);
}

.resultat-item.restitution .resultat-value::before {
  content: "+ ";
  font-weight: 700;
}

/* ========== TEXTE MUTED ========== */

.text-muted {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 20px;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 1024px) {
  .cards-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .resultat-card {
    padding: 16px;
  }

  .card-title {
    font-size: 1rem;
  }

  .total-impots-line,
  .avantage-line {
    padding: 10px 12px;
  }

  .prelevement-calcul {
    flex-wrap: wrap;
  }

  .total-impots-value.highlight {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .cards-detail-grid {
    gap: 16px;
  }

  .prelevement-info {
    flex-direction: column;
    align-items: flex-start;
  }

  .total-impots-label,
  .avantage-label,
  .prelevement-label {
    font-size: 0.85rem;
  }

  .total-impots-value,
  .avantage-montant,
  .prelevement-montant {
    font-size: 0.9rem;
  }
}
/* ========== NAVIGATION PAR ONGLETS ========== */

.tabs-container {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  background: var(--card-background);
  padding: 6px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1;
  min-width: 120px;
  padding: 8px 16px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-btn:hover {
  background: var(--background-light);
  color: var(--text-primary);
}

.tab-btn.active {
  background: linear-gradient(
    to right,
    var(--success-color),
    var(--primary-color)
  );
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.tab-btn.active:hover {
  transform: none;
}

/* Animation de l'onglet actif */
.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--primary-color);
  opacity: 0.8;
}

/* Contenu des onglets */
.tabs-content {
  position: relative;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== RESPONSIVE TABS ========== */

@media (max-width: 768px) {
  .tabs-container {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    background: var(--card-background);
    padding: 6px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    flex-wrap: wrap;
  }

  .tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 8px 16px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  .tab-btn.active::after {
    display: none;
  }
}

@media (max-width: 480px) {
  .tabs-container {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    background: var(--card-background);
    padding: 6px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    flex-wrap: wrap;
  }

  .tabs-container::-webkit-scrollbar {
    height: 4px;
  }

  .tabs-container::-webkit-scrollbar-track {
    background: var(--background-light);
    border-radius: 2px;
  }

  .tabs-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
  }

  .tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 8px 16px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
}
/* ========== SLIDERS POUR MONTANTS ========== */

.form-group-with-slider {
  position: relative;
}

.input-slider-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.montant-input {
  width: 100%;
}

.montant-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    to right,
    var(--primary-light) 0%,
    var(--primary-color) 50%,
    var(--primary-hover) 100%
  );
  outline: none;
  transition: all var(--transition-base);
  cursor: pointer;
}

.montant-slider:hover {
  background: linear-gradient(
    to right,
    var(--primary-color) 0%,
    var(--primary-hover) 50%,
    var(--primary-hover) 100%
  );
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Thumb pour webkit (Chrome, Safari) */
.montant-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--primary-color);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all var(--transition-base);
}

.montant-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  border-width: 4px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.montant-slider::-webkit-slider-thumb:active {
  transform: scale(1.3);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

/* Thumb pour Firefox */
.montant-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--primary-color);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all var(--transition-base);
}

.montant-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  border-width: 4px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.montant-slider::-moz-range-thumb:active {
  transform: scale(1.3);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

/* Track pour Firefox */
.montant-slider::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    to right,
    var(--primary-light) 0%,
    var(--primary-color) 50%,
    var(--primary-hover) 100%
  );
}

/* Labels du slider */
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: -8px;
  padding: 0 2px;
}

/* ========== ANIMATION CALCUL MIS À JOUR ========== */

@keyframes pulseGreen {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.resultat-section.just-updated {
  animation: pulseGreen 0.5s ease-out;
}

.resultat-section.just-updated::before {
  content: "✓ Calcul mis à jour";
  position: absolute;
  top: -30px;
  right: 20px;
  background: linear-gradient(135deg, var(--success-color), #059669);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease-out;
  z-index: 10;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========== INDICATEUR DE CALCUL EN COURS ========== */

.calculating-indicator {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.calculating-indicator::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 3px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========== RESPONSIVE SLIDERS ========== */

@media (max-width: 768px) {
  .montant-slider {
    height: 10px;
  }

  .montant-slider::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }

  .montant-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }

  .slider-labels {
    font-size: 0.7rem;
  }
}

.fiscal-summary-panel {
  position: fixed;
  top: 120px;
  right: 24px;
  width: 320px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border: 2px solid var(--primary-color);
  border-radius: var(--radius-xl);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.12),
    0 4px 8px rgba(0, 0, 0, 0.08);
  z-index: 100;
  transition: all var(--transition-base);
  max-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
}

.fiscal-summary-panel.hidden {
  transform: translateX(360px);
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  color: white;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  flex-shrink: 0;
}

.summary-header h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.toggle-summary {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.toggle-summary:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.summary-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.summary-waiting {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.summary-waiting i {
  font-size: 3rem;
  color: var(--primary-color);
  opacity: 0.3;
  margin-bottom: 16px;
}

.summary-waiting p {
  font-size: 0.9rem;
  font-style: italic;
}

.summary-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--secondary-color);
}

.summary-item.main {
  border-left-color: var(--primary-color);
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

.summary-item.total {
  border-left-color: var(--success-color);
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  padding: 16px;
  margin-top: 8px;
}

.summary-item.info {
  border-left-color: var(--warning-color);
  background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.summary-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.summary-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.summary-value.highlight {
  font-size: 1.3rem;
  color: var(--success-color);
  font-weight: 700;
}

.summary-value.restitution {
  color: var(--primary-color);
}

.summary-value.restitution::before {
  content: "+ ";
}

.summary-divider {
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--border-color),
    transparent
  );
  margin: 8px 0;
}

.btn-scroll-detail {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  transition: all var(--transition-base);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.2);
}

.btn-scroll-detail:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
}

.btn-scroll-detail i {
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(4px);
  }
}

/* Bouton pour réafficher */
.show-summary-btn {
  position: fixed;
  top: 120px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transition: all var(--transition-base);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.show-summary-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

/* ========== RESPONSIVE ========== */

@media (max-width: 1400px) {
  .fiscal-summary-panel {
    width: 280px;
    right: 16px;
  }
}

@media (max-width: 1200px) {
  .fiscal-summary-panel {
    position: static;
    width: 100%;
    margin-bottom: 24px;
    max-height: none;
    right: auto;
  }

  .show-summary-btn {
    display: none;
  }
}

@media (max-width: 768px) {
  .summary-header h3 {
    font-size: 0.9rem;
  }

  .summary-content {
    padding: 16px;
  }

  .summary-item {
    padding: 10px 12px;
  }

  .summary-label {
    font-size: 0.8rem;
  }

  .summary-value {
    font-size: 0.9rem;
  }

  .summary-value.highlight {
    font-size: 1.1rem;
  }
}
/* ========== GRILLE DE CARDS DÉTAILLÉES ========== */

.cards-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 24px;
  align-items: start; /* Important pour l'alignement */
}

.resultat-card {
  background: var(--card-background);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  height: 100%; /* Pour aligner les hauteurs */
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
  flex-shrink: 0;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow: hidden; /* Éviter les débordements */
}

/* ========== CARD IMPÔTS TOTAUX ========== */

.total-impots-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.total-impots-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--secondary-color);
  transition: all var(--transition-base);
}

.total-impots-line:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.total-impots-line.total {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-left-color: var(--primary-color);
  border-width: 4px;
  padding: 16px;
  margin-top: 8px;
}

.total-impots-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  white-space: nowrap; /* Éviter le retour à la ligne */
}

.total-impots-value {
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 1rem;
  text-align: right;
  white-space: nowrap; /* Éviter le retour à la ligne */
}

.total-impots-value.highlight {
  color: var(--primary-color);
  font-size: 1.3rem;
  font-weight: 700;
}

.total-impots-note {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--warning-color);
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.total-impots-note i {
  color: var(--warning-color);
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* ========== AVANTAGES FISCAUX ========== */

.avantage-section {
  margin-bottom: 16px;
}

.avantage-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.avantage-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--success-color);
  margin-bottom: 8px;
  transition: all var(--transition-base);
  gap: 12px; /* Espace entre label et montant */
}

.avantage-line:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.avantage-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0; /* Important pour ellipsis */
}

.avantage-montant {
  font-weight: 700;
  color: var(--success-color);
  font-size: 1rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ========== PRÉLÈVEMENTS SOCIAUX ========== */

.prelevement-line {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--warning-color);
  margin-bottom: 8px;
  transition: all var(--transition-base);
}

.prelevement-line:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.prelevement-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.prelevement-label {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.prelevement-taux {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.prelevement-calcul {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}

.prelevement-base {
  color: var(--text-secondary);
  font-size: 0.85rem;
  white-space: nowrap;
}

.prelevement-arrow {
  color: var(--warning-color);
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.prelevement-montant {
  color: var(--warning-color);
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ========== IMPÔT NET (RESTITUTION) ========== */

.resultat-item.restitution {
  border-color: var(--primary-color);
  border-width: 3px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

.resultat-item.restitution .resultat-value {
  color: var(--primary-color);
}

.resultat-item.restitution .resultat-value::before {
  content: "+ ";
  font-weight: 700;
}

/* ========== TEXTE MUTED ========== */

.text-muted {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 20px;
}

/* ========== SLIDERS MONTANTS ========== */

.montant-input {
  margin-bottom: 8px;
}

.montant-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(
    to right,
    var(--primary-light) 0%,
    var(--primary-color) 100%
  );
  border-radius: 5px;
  outline: none;
  transition: all var(--transition-base);
  cursor: pointer;
}

.montant-slider:hover {
  background: linear-gradient(
    to right,
    var(--primary-color) 0%,
    var(--primary-hover) 100%
  );
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Style du thumb (le curseur) */
.montant-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  border: 3px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all var(--transition-base);
}

.montant-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.montant-slider::-webkit-slider-thumb:active {
  transform: scale(1.1);
}

.montant-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  border: 3px solid white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all var(--transition-base);
}

.montant-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.montant-slider::-moz-range-thumb:active {
  transform: scale(1.1);
}

/* Style de la piste pour Firefox */
.montant-slider::-moz-range-track {
  background: linear-gradient(
    to right,
    var(--primary-light) 0%,
    var(--primary-color) 100%
  );
  border-radius: 5px;
  height: 8px;
}

/* Animation au focus */
.montant-slider:focus {
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ========== RESPONSIVE ========== */

@media (max-width: 1024px) {
  .cards-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .resultat-card {
    padding: 16px;
  }

  .card-title {
    font-size: 1rem;
  }

  .total-impots-line,
  .avantage-line {
    padding: 10px 12px;
  }

  .prelevement-calcul {
    flex-wrap: wrap;
  }

  .total-impots-value.highlight {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .cards-detail-grid {
    gap: 16px;
  }

  .prelevement-info {
    flex-direction: column;
    align-items: flex-start;
  }

  .total-impots-label,
  .avantage-label,
  .prelevement-label {
    font-size: 0.85rem;
  }

  .total-impots-value,
  .avantage-montant,
  .prelevement-montant {
    font-size: 0.9rem;
  }
}
/* ir.css - Styles pour le bouton magique de préchargement */

/* ========== BOUTON MAGIQUE ========== */
.btn-magic {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-magic::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition:
    width 0.6s,
    height 0.6s;
}

.btn-magic:hover::before {
  width: 300px;
  height: 300px;
}

.btn-magic:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-magic .btn-icon {
  animation: sparkle 2s infinite;
  font-size: 1.2em;
}

@keyframes sparkle {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
    filter: brightness(1);
  }
  25% {
    transform: scale(1.2) rotate(-10deg);
    filter: brightness(1.3);
  }
  50% {
    transform: scale(1) rotate(0deg);
    filter: brightness(1);
  }
  75% {
    transform: scale(1.2) rotate(10deg);
    filter: brightness(1.3);
  }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .btn-magic {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
  }
}
/* ========== DÉTAILS RECETTES ET DÉPENSES ========== */

.detail-zone {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 2px solid var(--primary-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-top: 24px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease-out;
  max-height: 0;
  overflow: hidden;
}

.detail-zone.show {
  opacity: 1;
  transform: translateY(0);
  max-height: 2000px;
}

.detail-zone.detail-depenses {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: var(--warning-color);
}

.detail-header {
  border-bottom: 3px solid var(--primary-color);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.detail-depenses .detail-header {
  border-bottom-color: var(--warning-color);
}

.detail-header h4 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.detail-regime-section {
  background: white;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.detail-regime-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  color: white;
}

.detail-depenses .detail-regime-header {
  background: linear-gradient(135deg, var(--warning-color), #f97316);
}

.regime-label {
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.regime-total {
  font-size: 1.3rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 16px;
  border-radius: var(--radius-md);
}

.detail-table-wrapper {
  overflow-x: auto;
  padding: 0;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.detail-table thead th {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--primary-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.detail-depenses .detail-table thead th {
  border-bottom-color: var(--warning-color);
}

.detail-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-table tbody tr {
  transition: all var(--transition-fast);
}

.detail-table tbody tr:hover {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  transform: translateX(4px);
  box-shadow: inset 3px 0 0 var(--primary-color);
}

.detail-depenses .detail-table tbody tr:hover {
  box-shadow: inset 3px 0 0 var(--warning-color);
}

.bien-cell {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.locataire-cell {
  font-weight: 600;
  color: var(--primary-color);
}

.type-cell {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.montant-cell {
  font-weight: 700;
  color: var(--success-color);
  font-size: 1rem;
  white-space: nowrap;
}

/* ========== INFORMATION ABATTEMENT ========== */

.abattement-container {
  display: none;
  margin-top: 12px;
}

.abattement-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-left: 4px solid var(--primary-color);
  padding: 16px;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
  animation: slideIn 0.3s ease-out;
}

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

.abattement-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.abattement-details {
  flex: 1;
}

.abattement-details strong {
  color: var(--primary-color);
  font-size: 0.95rem;
  display: block;
  margin-bottom: 6px;
}

.abattement-calcul {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-family: "Courier New", monospace;
}

.abattement-calcul strong {
  color: var(--success-color);
  font-size: 1rem;
  font-family: inherit;
}

/* ========== ERREUR RÉGIME DUPLIQUÉ ========== */

.item-card.error-duplicate-regime {
  border: 3px solid var(--danger-color);
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  animation: shake 0.5s ease-out;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
  .detail-zone {
    padding: 16px;
  }

  .detail-table {
    font-size: 0.8rem;
  }

  .detail-table thead th,
  .detail-table tbody td {
    padding: 8px 10px;
  }

  .regime-total {
    font-size: 1.1rem;
    padding: 4px 12px;
  }

  .bien-cell {
    max-width: 150px;
  }

  .abattement-info {
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .detail-table-wrapper {
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
  }

  .detail-table {
    min-width: 600px;
  }
}

/* ========== MODAL CHOIX RÉGIME ========== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease-out;
  padding: 20px;
  overflow-y: auto;
}

.modal-content {
  background: white;
  border-radius: var(--radius-xl);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 3px solid var(--primary-color);
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
}

.modal-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-secondary);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition-base);
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
  transform: rotate(90deg);
}

.modal-body {
  padding: 32px;
}

.modal-intro {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  padding: 16px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-left: 4px solid var(--warning-color);
  border-radius: var(--radius-md);
}

.regime-choice-card {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.regime-choice-card h4 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 16px 0;
}

.regime-montants {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  padding: 12px;
  background: white;
  border-radius: var(--radius-md);
  line-height: 1.8;
}

.regime-montants strong {
  color: var(--primary-color);
  font-size: 1.05rem;
}

.regime-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.regime-option {
  display: block;
  cursor: pointer;
  position: relative;
}

.regime-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.regime-option-content {
  background: white;
  border: 3px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-base);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.regime-option input[type="radio"]:checked + .regime-option-content {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
  transform: scale(1.02);
}

.regime-option:hover .regime-option-content {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.regime-option-content strong {
  font-size: 1.1rem;
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
}

.regime-option-content p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.regime-calcul {
  font-weight: 600;
  color: var(--success-color);
  font-size: 1rem !important;
  margin-top: 8px !important;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 24px 32px;
  border-top: 2px solid var(--border-light);
  background: var(--background-light);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
  background: white;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
  .modal-content {
    max-width: 95%;
    margin: 10px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 20px;
  }

  .regime-options {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .modal-header h3 {
    font-size: 1.2rem;
  }

  .regime-choice-card {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .modal-overlay {
    padding: 10px;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn-primary,
  .modal-footer .btn-secondary {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
}
/* ========== DÉTAILS RECETTES ET DÉPENSES - LAYOUT CÔTE À CÔTE ========== */

/* Conteneur pour les 2 blocs de détails */
.form-section {
  position: relative;
}

#detailRecettesZone,
#detailDepensesZone {
  margin-top: 24px;
  flex: 1;
}

/* Créer une grille pour afficher côte à côte */
.form-section:has(#revenusContainer) {
  display: flex;
  flex-direction: column;
}

.detail-zones-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

/* ========== DÉTAILS ZONE - Réaménagement ==========*/

.detail-zone {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 2px solid var(--primary-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  height: fit-content;
}

.detail-zone.detail-depenses {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: var(--warning-color);
}

.detail-zone.show {
  opacity: 1;
  transform: translateY(0);
}

.detail-zone.collapsed .detail-content {
  display: none;
}

.detail-zone.collapsed {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ========== DETAIL HEADER - Avec toggle ==========*/

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  color: white;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  gap: 12px;
}

.detail-zone.detail-depenses .detail-header {
  background: linear-gradient(135deg, var(--warning-color), #f97316);
}

.detail-header-content {
  flex: 1;
  min-width: 0;
}

.detail-header h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== BOUTON TOGGLE ==========*/

.btn-toggle-detail {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.btn-toggle-detail:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.btn-toggle-detail i {
  transition: transform var(--transition-base);
}

.btn-toggle-detail.collapsed i {
  transform: rotate(-90deg);
}

/* ========== DETAIL CONTENT ==========*/

.detail-content {
  padding: 20px;
  overflow-y: auto;
  max-height: 600px;
  transition: all var(--transition-base);
  display: block;
}

.detail-zone.collapsed .detail-content {
  max-height: 0;
  padding: 0 20px;
  overflow: hidden;
}

/* ========== RÉGIME SECTION ==========*/

.detail-regime-section {
  background: white;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.detail-regime-section:last-child {
  margin-bottom: 0;
}

.detail-regime-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border-bottom: 2px solid var(--primary-color);
  gap: 12px;
}

.detail-zone.detail-depenses .detail-regime-header {
  border-bottom-color: var(--warning-color);
}

.regime-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.regime-total {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-color);
  white-space: nowrap;
  flex-shrink: 0;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  padding: 4px 12px;
  border-radius: 4px;
}

.detail-zone.detail-depenses .regime-total {
  color: var(--warning-color);
  background: linear-gradient(135deg, #fcd34d, #fbbf24);
}

/* ========== DETAIL TABLE ==========*/

.detail-table-wrapper {
  overflow-x: auto;
  padding: 0;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.detail-table thead {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  position: sticky;
  top: 0;
  z-index: 5;
}

.detail-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 2px solid var(--primary-color);
  white-space: nowrap;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.2px;
}

.detail-zone.detail-depenses .detail-table th {
  border-bottom-color: var(--warning-color);
}

.detail-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-weight: 500;
  vertical-align: middle;
}

.detail-table tbody tr {
  transition: all var(--transition-fast);
}

.detail-table tbody tr:hover {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  box-shadow: inset 3px 0 0 var(--primary-color);
}

.detail-zone.detail-depenses .detail-table tbody tr:hover {
  box-shadow: inset 3px 0 0 var(--warning-color);
}

.well-cell {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.locataire-cell {
  font-weight: 600;
  color: var(--primary-color);
}

.type-cell {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.montant-cell {
  font-weight: 700;
  color: var(--success-color);
  font-size: 0.95rem;
  white-space: nowrap;
  text-align: right;
}

/* ========== RESPONSIVE - DÉTAILS CÔTE À CÔTE ==========*/

@media (max-width: 1400px) {
  .detail-zones-wrapper {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .detail-header h4 {
    font-size: 0.9rem;
  }

  .detail-content {
    padding: 16px;
    max-height: 400px;
  }

  .detail-table {
    font-size: 0.75rem;
  }

  .detail-table th,
  .detail-table td {
    padding: 8px 10px;
  }

  .regime-total {
    font-size: 0.9rem;
    padding: 3px 10px;
  }

  .well-cell {
    max-width: 100px;
  }
}

@media (max-width: 480px) {
  .detail-header {
    padding: 12px 16px;
  }

  .btn-toggle-detail {
    width: 32px;
    height: 32px;
  }

  .detail-table-wrapper {
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .detail-table {
    min-width: 500px;
  }
}

/* ========== DRAG-DROP PANEL ==========*/

.fiscal-summary-panel {
  --drag-x: 0px;
  --drag-y: 0px;
  position: fixed;
  top: 120px;
  right: 24px;
  width: 320px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border: 2px solid var(--primary-color);
  border-radius: var(--radius-xl);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.12),
    0 4px 8px rgba(0, 0, 0, 0.08);
  z-index: 100;
  transition: all var(--transition-base);
  max-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  transform: translate(var(--drag-x), var(--drag-y));
}

.fiscal-summary-panel.dragging {
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.2),
    0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-hover);
}

.fiscal-summary-panel.being-dragged {
  cursor: grabbing;
}

.draggable-header {
  cursor: grab;
  user-select: none;
}

.draggable-header:active {
  cursor: grabbing;
}

/* ========== RESPONSIVE - DRAG PANEL ==========*/

@media (max-width: 1200px) {
  .fiscal-summary-panel {
    position: static;
    width: 100%;
    margin-bottom: 24px;
    max-height: none;
    transform: none;
    --drag-x: 0px;
    --drag-y: 0px;
  }

  .draggable-header {
    cursor: default;
  }

  .show-summary-btn {
    display: none;
  }
}

@media (max-width: 768px) {
  .fiscal-summary-panel {
    width: 100%;
    right: 0;
    top: auto;
    margin-bottom: 24px;
  }

  .summary-header h3 {
    font-size: 0.9rem;
  }

  .summary-content {
    padding: 16px;
  }

  .summary-item {
    padding: 10px 12px;
  }

  .summary-label {
    font-size: 0.8rem;
  }

  .summary-value {
    font-size: 0.9rem;
  }

  .summary-value.highlight {
    font-size: 1.1rem;
  }
}

/* ========== SUPPRESSION DES STYLES INLINE ==========*/
/* Vérifier que tous les éléments utilisent les classes CSS 
   et PAS de style="" */

/* Vérifier dans le HTML que les transform se font via CSS variables:
   transform: translate(var(--drag-x), var(--drag-y));
*/
/* Pour le montant barré (ancien montant brut) */
.strikethrough-amount {
  text-decoration: line-through;
  color: #9ca3af;
  font-size: 0.9em;
}

/* Pour le label "net imposable" */
.net-label {
  font-size: 0.85em;
  color: #6b7280;
}
/* ========== BADGES PFU ========== */

.badge-pfu {
  display: inline-block;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 8px;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.badge-pfu-small {
  display: inline-block;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-left: 6px;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.2);
}

/* ========== SECTIONS PFU ========== */

.pfu-section {
  background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
  border-left-color: var(--warning-color) !important;
}

.impots-section {
  margin-bottom: 20px;
  padding: 16px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary-color);
}

.impots-section.pfu-section {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-left-color: var(--warning-color);
}

.section-subtitle {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========== REVENUS GRID ========== */

.revenus-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.revenu-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--secondary-color);
  transition: all var(--transition-base);
}

.revenu-line:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.revenu-line.pfu {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-left-color: var(--warning-color);
}

.revenu-line.total {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-left-color: var(--primary-color);
  border-width: 4px;
  padding: 16px;
  margin-top: 8px;
}

.revenu-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.revenu-value {
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 1rem;
  white-space: nowrap;
}

.revenu-value.highlight {
  color: var(--primary-color);
  font-size: 1.3rem;
  font-weight: 700;
}

/* ========== PRÉLÈVEMENTS SECTIONS ========== */

.ps-section {
  margin-bottom: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--secondary-color);
}

.ps-section.pfu-section {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-left-color: var(--warning-color);
}

.prelevement-line.pfu {
  background: linear-gradient(135deg, #fef9e7, #fef3c7);
  border-left-color: #f59e0b;
}

/* ========== IMPÔTS SUBTOTAL ========== */

.total-impots-line.subtotal {
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  border-left-color: var(--primary-color);
  border-width: 3px;
  margin-top: 8px;
  font-weight: 700;
}

.impots-section.pfu-section .total-impots-line.subtotal {
  background: linear-gradient(135deg, #fde68a, #fcd34d);
  border-left-color: var(--warning-color);
}

/* ========== CARD REVENUS ========== */

.resultat-card.revenus-card {
  border-color: var(--primary-color);
  border-width: 2px;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
  .badge-pfu {
    display: block;
    margin: 4px 0 0 0;
    width: fit-content;
  }

  .section-subtitle {
    flex-direction: column;
    align-items: flex-start;
  }

  .revenu-line,
  .prelevement-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
/* ========== GRILLE DE CARDS DÉTAILLÉES ========== */

.cards-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 24px;
  align-items: start;
  position: relative;
  overflow: visible; /* Important pour les tooltips */
}

.resultat-card {
  background: var(--card-background);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  height: 100%; /* Pour aligner les hauteurs */
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all var(--transition-base);
  overflow: visible; /* Important pour les tooltips */
}

.resultat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
  z-index: 10;
}

.resultat-card:hover .card-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title-icon {
  font-size: 1.3rem;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow: hidden; /* Éviter les débordements */
}

/* ========== TOOLTIPS EXPLICATIFS ========== */

.card-tooltip {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 12px;
  background: linear-gradient(135deg, #1e293b, #334155);
  color: white;
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  pointer-events: none;
}

.card-tooltip::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 24px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #1e293b;
}

.tooltip-title {
  font-size: 1rem;
  font-weight: 700;
  color: #60a5fa;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tooltip-content {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #e2e8f0;
}

.tooltip-section {
  margin-bottom: 12px;
}

.tooltip-section:last-child {
  margin-bottom: 0;
}

.tooltip-section-title {
  font-weight: 600;
  color: #94a3b8;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.tooltip-formula {
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  margin: 8px 0;
  border-left: 3px solid #60a5fa;
}

.tooltip-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

.tooltip-list li {
  padding-left: 20px;
  position: relative;
  margin-bottom: 6px;
}

.tooltip-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: #60a5fa;
  font-weight: 700;
}

.tooltip-highlight {
  color: #fbbf24;
  font-weight: 600;
}

/* ========== RFR ULTRA VISIBLE ========== */

.rfr-card {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  border-color: #0ea5e9;
  border-width: 3px;
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.4);
}

.rfr-value {
  font-size: 2.8rem;
  font-weight: 700;
  color: white;
  text-align: center;
  padding: 32px 20px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2),
    rgba(255, 255, 255, 0.1)
  );
  border-radius: var(--radius-lg);
  margin: 12px 0;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 2px 8px rgba(255, 255, 255, 0.3);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: 1px;
  position: relative;
}

.rfr-value::before {
  content: "💰";
  position: absolute;
  top: 10px;
  left: 20px;
  font-size: 2rem;
  opacity: 0.7;
}

.rfr-info {
  font-size: 0.9rem;
  color: white;
  text-align: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  line-height: 1.6;
  font-weight: 600;
}

.rfr-card .revenu-line {
  background: rgba(255, 255, 255, 0.9);
  border-left-color: white;
}

.rfr-card .revenu-line.pfu {
  background: rgba(251, 191, 36, 0.2);
}

.rfr-usage-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0 0;
}

.rfr-usage-list li {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text-primary);
}

.rfr-usage-list li::before {
  content: "✓";
  color: #10b981;
  font-weight: 700;
  font-size: 1.2rem;
}

/* ========== ICONES INFO SUR LES RÉSULTATS ========== */

.result-info-icon {
  display: inline-block;
  margin-left: 8px;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.6;
  transition: all var(--transition-base);
  vertical-align: middle;
}

.result-info-icon:hover {
  opacity: 1;
  transform: scale(1.2);
}

.resultat-item:hover .result-info-icon {
  opacity: 1;
}

/* ========== MODAL TOOLTIP RÉSULTAT ========== */

.result-tooltip-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.result-tooltip-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.result-tooltip-content {
  position: relative;
  background: white;
  border-radius: var(--radius-xl);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-tooltip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 3px solid var(--primary-color);
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
}

.result-tooltip-header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.result-tooltip-close {
  background: none;
  border: none;
  font-size: 2.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition-base);
  line-height: 1;
}

.result-tooltip-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
  transform: rotate(90deg);
}

.result-tooltip-body {
  padding: 32px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.result-tooltip-body p {
  margin: 0 0 16px 0;
}

.result-tooltip-body strong {
  color: var(--text-primary);
  font-weight: 700;
}

.result-tooltip-body ul {
  margin: 12px 0;
  padding-left: 24px;
}

.result-tooltip-body li {
  margin-bottom: 8px;
}

.result-tooltip-body .tooltip-formula {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  margin: 16px 0;
  border-left: 4px solid var(--primary-color);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.8;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
  .rfr-value {
    font-size: 2rem;
    padding: 24px 16px;
  }

  .result-tooltip-content {
    width: 95%;
    max-height: 90vh;
  }

  .result-tooltip-header,
  .result-tooltip-body {
    padding: 20px;
  }

  .result-tooltip-header h3 {
    font-size: 1.2rem;
  }
}

/* ========== AMÉLIORATION DES CARDS RÉSULTAT ========== */

.resultat-item {
  cursor: pointer;
  user-select: none;
}

.resultat-item:hover {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.resultat-item.highlight:hover,
.resultat-item.success:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.rfr-details-grid {
  margin-top: 16px;
}

.tooltip-success {
  color: #10b981 !important;
  font-weight: 600;
}
/* ========== CLASSES MANQUANTES POUR LES TOOLTIPS ========== */

/* Grille des détails RFR (sans style inline) */
.rfr-details-grid {
  margin-top: 16px;
}

/* Messages de succès dans les tooltips */
.tooltip-success {
  color: #10b981;
  font-weight: 600;
  padding: 12px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-radius: var(--radius-md);
  border-left: 4px solid #10b981;
  margin: 12px 0;
}

/* Formule dans les modals tooltip */
.result-tooltip-body .tooltip-formula {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  margin: 16px 0;
  border-left: 4px solid var(--primary-color);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.8;
}

/* Sections dans les tooltips */
.result-tooltip-body .tooltip-section {
  margin-bottom: 20px;
}

.result-tooltip-body .tooltip-section:last-child {
  margin-bottom: 0;
}

.result-tooltip-body .tooltip-section-title {
  font-weight: 700;
  color: var(--primary-color);
  font-size: 0.95rem;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Listes dans les tooltips */
.result-tooltip-body ul {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}

.result-tooltip-body ul li {
  padding: 8px 12px 8px 28px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 6px;
  position: relative;
}

.result-tooltip-body ul li::before {
  content: "→";
  position: absolute;
  left: 8px;
  color: var(--primary-color);
  font-weight: 700;
}

/* Strong dans les tooltips */
.result-tooltip-body strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* Paragraphes dans les tooltips */
.result-tooltip-body p {
  margin: 0 0 16px 0;
  line-height: 1.7;
}

/* ========== AMÉLIORATION DES CARDS AVEC TOOLTIPS ========== */

.resultat-card {
  cursor: help;
}

.resultat-card .card-title {
  cursor: help;
  user-select: none;
}

/* Indicateur visuel qu'il y a une info */
.resultat-card::after {
  content: "ℹ️";
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.2rem;
  opacity: 0;
  transition: all var(--transition-base);
}

.resultat-card:hover::after {
  opacity: 0.6;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
  .result-tooltip-body {
    padding: 20px;
  }

  .result-tooltip-body .tooltip-formula {
    font-size: 0.8rem;
    padding: 12px 16px;
  }
}
/* 
========== CSG DÉDUCTIBLE ========== 
*/

.csg-deductible-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-radius: 6px;
  border-left: 3px solid var(--primary-color);
  margin-top: 4px;
}

.csg-deductible-info.pfu {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-left-color: var(--warning-color);
}

.csg-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.csg-text {
  font-size: 0.85rem;
  color: var(--text-primary);
  flex: 1;
}

.csg-text strong {
  color: var(--primary-color);
  font-weight: 700;
}

.csg-deductible-info.pfu .csg-text strong {
  color: var(--warning-color);
}

.csg-info-tooltip {
  display: inline-block;
  margin-left: 4px;
  cursor: help;
  opacity: 0.7;
  transition: all var(--transition-base);
}

.csg-info-tooltip:hover {
  opacity: 1;
  transform: scale(1.2);
}

/* ========== FRAIS RÉELS ========== */

.frais-reels-group {
  display: none;
  transition: all 0.3s ease-out;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
}

.frais-reels-group.is-visible {
  display: flex;
  opacity: 1;
  max-height: 200px;
}

.frais-reels-input {
  border-color: #93c5fd;
}

.frais-reels-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ========== FRAIS RÉELS INFO CONTAINER ========== */

.frais-reels-info-container {
  display: none;
  grid-column: 1 / -1;
  margin-top: 8px;
}

.frais-reels-info-container.is-visible {
  display: block;
}

.frais-reels-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  animation: slideIn 0.3s ease-out;
}

.frais-reels-info.frais-reels-forfait {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-left: 4px solid var(--success-color);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

.frais-reels-info.frais-reels-active {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-left: 4px solid var(--primary-color);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.frais-reels-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.frais-reels-details {
  flex: 1;
}

.frais-reels-details strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.frais-reels-info.frais-reels-forfait .frais-reels-details strong {
  color: var(--success-color);
}

.frais-reels-info.frais-reels-active .frais-reels-details strong {
  color: var(--primary-color);
}

.frais-reels-calcul {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-family: "Courier New", monospace;
  margin-bottom: 10px;
}

.frais-reels-calcul strong {
  font-family: inherit;
  font-size: 1rem;
}

.frais-reels-info.frais-reels-forfait .frais-reels-calcul strong {
  color: var(--success-color);
}

.frais-reels-info.frais-reels-active .frais-reels-calcul strong {
  color: var(--primary-color);
}

.frais-reels-notice {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.frais-reels-notice p {
  margin: 0 0 6px 0;
}

.frais-reels-notice-sub {
  opacity: 0.8;
  font-size: 0.8rem;
}

.frais-reels-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-base);
}

.frais-reels-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.frais-reels-link i {
  font-size: 0.75rem;
}

/* ========== DÉFICIT FONCIER ========== */

.deficit-foncier-banner {
  margin-top: 16px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 2px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 16px;
  animation: slideIn 0.3s ease-out;
}

.deficit-foncier-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 1rem;
}

.deficit-foncier-header strong {
  color: #92400e;
}

.deficit-foncier-icon {
  font-size: 1.2rem;
}

.deficit-foncier-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.revenu-line.deficit {
  background: rgba(239, 68, 68, 0.08);
  border-radius: 6px;
  padding: 8px 12px;
}

.deficit-value {
  color: var(--danger-color);
  font-weight: 700;
}

.revenu-line.deficit-report {
  background: rgba(245, 158, 11, 0.08);
  border-radius: 6px;
  padding: 8px 12px;
}

.deficit-report-value {
  color: #b45309;
  font-weight: 600;
}

/* ========== RESPONSIVE FRAIS RÉELS ========== */

@media (max-width: 768px) {
  .frais-reels-info {
    flex-direction: column;
    gap: 8px;
  }

  .deficit-foncier-banner {
    padding: 12px;
  }
}

/* ========== PLAFONNEMENT QF ========== */

.plafonnement-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  padding: 3px 8px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
  border: 1px solid #f59e0b;
  animation: slideIn 0.3s ease-out;
}
