* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow-x: hidden;
}

/* Header */

.header {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 0 0 25px 25px;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    to { left: 100%; }
}

.header h1 {
    color: #667eea;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.header p {
    color: #666;
    font-size: 1.1rem;
}

/* Container & layout */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}

.notification-banner {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 1.2rem 1.5rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    animation: slideIn 0.5s ease-out;
}

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

.notification-banner h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification-banner p {
    font-size: 1rem;
    opacity: 0.95;
}

/* Grille principale : formulaire + résumé */

.layout-grid {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(260px, 1.1fr);
    gap: 2rem;
    align-items: flex-start;
}

.form-column {
    min-width: 0;
}

/* Formulaire pleine largeur */
.form-column-full {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* Récap final en bas */
.summary-final {
    margin: 2rem 0 1rem;
    padding: 0;
}

/* COLONNE RÉCAP - SCROLL NORMAL (PAS STICKY) */
.summary-column {
    position: static;
    height: auto;
}

.summary-card-final {
    background: linear-gradient(135deg, #f8f9ff, #fffbf0);
    border-radius: 20px;
    padding: 1.8rem;
    box-shadow: 0 12px 45px rgba(0,0,0,0.15);
    border: 2px solid #e8f0fe;
    text-align: center;
}

.summary-card-final h3 {
    color: #667eea;
    margin-bottom: 1.2rem;
    font-size: 1.25rem;
    font-weight: bold;
}

.summary-card h3 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    text-align: center;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e8f0fe;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.7rem 1rem;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    background: rgba(255,255,255,0.8);
    border: 1px solid #e8f0fe;
    transition: all 0.25s ease;
    font-size: 1.05rem;
}

/* VERT CLAIR pour BIENS */
.summary-row.biens {
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    border-color: #c8e6c9;
    color: #2e7d32;
}

.summary-row.biens:hover {
    background: linear-gradient(135deg, #c8e6c9, #dcedc8);
    box-shadow: 0 6px 20px rgba(76,175,80,0.2);
}

/* ROUGE CLAIR pour DETTES */
.summary-row.dettes {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-color: #ef9a9a;
    color: #c62828;
}

.summary-row.dettes:hover {
    background: linear-gradient(135deg, #ef9a9a, #ffcdd2);
    box-shadow: 0 6px 20px rgba(244,67,54,0.2);
}

/* NISAB neutre */
.summary-row.nisab {
    background: linear-gradient(135deg, #f8f9ff, #fffbf0);
    border-color: #e8f0fe;
    font-weight: 600;
}

.summary-row.nisab:hover {
    background: rgba(102,126,234,0.1);
}


.summary-row:hover {
    background: rgba(102,126,234,0.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102,126,234,0.15);
}

.summary-row:last-child {
    font-weight: 600;
    color: #1b5e20;
    background: rgba(76,175,80,0.1);
}

.two-columns-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.column-left,
.column-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Sections formulaire */

.section-card {
    background: white;
    border-radius: 16px; /* Plus petit */
    padding: 1.5rem; /* Réduit de 2rem */
    margin-bottom: 1.2rem; /* Réduit de 2rem */
    box-shadow: 0 8px 30px rgba(0,0,0,0.12); /* Plus léger */
    flex: 1;
}

.section-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.section-title {
    color: #667eea;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: bold;
}

.input-group-detailed {
    position: relative;
    min-height: 75px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.input-group-detailed label {
    display: block;
    margin-bottom: 0.2rem;
    font-weight: 600;
    color: #667eea;
    font-size: 1rem;
    min-height: 22px;
}

.input-group-detailed small {
    position: absolute;
    bottom: 28px;
    left: 0;
    font-size: 0.8rem;
    color: #777;
    max-width: calc(100% - 10px);
}

.input-group-detailed input {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px solid #e8f0fe;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #fafbff;
    margin-top: 6px;
    position: relative;
    z-index: 2;
}

.input-group-detailed input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
    background: white;
    transform: translateY(-1px);
}

.crypto-note {
    font-size: 0.8rem;
    color: #764ba2;
    margin-top: 0.3rem;
    font-style: italic;
    position: absolute;
    bottom: 28px;
    left: 0;
}

.crypto-note {
    font-size: 0.8rem;
    color: #764ba2;
    margin-top: 0.3rem;
    font-style: italic;
}

/* Boutons */

.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 2rem 0;
}

.calculate-btn,
.donate-btn,
.pdf-btn {
    border: none;
    border-radius: 50px;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    transition: all 0.25s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calculate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.donate-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.pdf-btn {
    background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
    color: white;
}

.calculate-btn:hover,
.donate-btn:hover,
.pdf-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
}

/* Résultat final */

.result-card {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 10px 40px rgba(76,175,80,0.2);
    animation: slideIn 0.5s ease-out;
}

.result-card.zakat-due {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    box-shadow: 0 10px 40px rgba(255,193,7,0.3);
}

.result-line {
    display: flex;
    justify-content: space-between;
    margin: 0.6rem 0;
    font-size: 1.05rem;
}

.result-value {
    font-weight: bold;
    color: #1b5e20;
}

.zakat-final {
    font-size: 1.4rem;
    color: #d32f2f;
    margin-top: 1.2rem;
}

/* Note mufti */

.muhti-note,
.mufti-note {
    font-size: 0.85rem;
    color: #444;
    margin-top: 1rem;
    background: rgba(255,255,255,0.9);
    padding: 0.8rem 1rem;
    border-radius: 10px;
}

/* Footer */

.footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    text-align: center;
    color: #666;
}

/* Responsive */
.layout-grid {
    display: block;
    grid-template-columns: 1fr minmax(280px, 350px);
    gap: 2rem;
    align-items: start;
}

/* Responsive : 1 colonne mobile */
@media (max-width: 992px) {
    .two-columns-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .column-left,
    .column-right {
        gap: 1.2rem;
    }
}

/* Desktop large : espacement optimisé */
@media (min-width: 1200px) {
    .two-columns-layout {
        gap: 2.5rem;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    .header p {
        font-size: 1rem;
    }
    .section-card {
        padding: 1.2rem;
        margin-bottom: 1rem;
    }
}


/* Bulles d'aide - FIX CHEVAUCHEMENT */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    margin-bottom: 1rem; /* Espace sous titre */
}

.help-bubble {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: normal;
    cursor: help;
    flex-shrink: 0; /* Empêche rétrécissement */
    position: relative;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
    border: 2px solid rgba(255,255,255,0.8);
    z-index: 10;
}

.help-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
    z-index: 1000;
}

/* Tooltip repositionné - HAUT + MARGES */
.help-bubble::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -10px; /* AU-DESSUS du titre */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.95);
    color: white;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: normal;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    margin-top: -10px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    z-index: 1001;
    max-width: 280px;
    width: max-content;
    min-width: 180px;
    text-align: left;
    line-height: 1.35;
}

.help-bubble::before {
    content: '';
    position: absolute;
    top: 100%; /* Flèche EN BAS vers haut */
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: rgba(0,0,0,0.95); /* Flèche pointe vers le bas */
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    margin-top: 0;
    z-index: 1002;
}

.help-bubble:hover::after,
.help-bubble:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Éviter chevauchement input */
.input-grid-detailed {
    margin-top: 1rem; /* Espace supplémentaire */
    position: relative;
    z-index: 1;
}

/* Mobile : tooltip à droite */
@media (max-width: 768px) {
    .help-bubble::after {
        top: auto;
        bottom: 100%;
        left: auto;
        right: -10px;
        transform: none;
        margin-right: 10px;
        max-width: 220px;
    }
    
    .help-bubble::before {
        top: 50%;
        right: 100%;
        left: auto;
        transform: translateY(-50%);
        border-right-color: rgba(0,0,0,0.95);
        border-bottom-color: transparent;
    }
}

/* ===== Amélioration lisibilité mobile ===== */
@media (max-width: 768px) {
  body {
    font-size: 18px;          /* base plus grande */
    line-height: 1.45;
  }

  .section-title { font-size: 1.4rem; }

  .input-group-detailed label { font-size: 1rem; }
  .input-group-detailed small { font-size: 0.9rem; }

  .input-group-detailed input {
    font-size: 1.05rem;
    padding: 0.9rem 1rem;
  }

  .summary-row { font-size: 1.1rem; }

  .calculate-btn,
  .donate-btn,
  .pdf-btn {
    font-size: 1.05rem;
    padding: 1rem 1.2rem;
    width: 100%;             /* boutons full width mobile */
    justify-content: center;
  }

  .actions-row { gap: 0.75rem; }
}