/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primary: #0072BC;
    --color-secondary: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-border: #e5e7eb;
    --color-bg: #f9fafb;
    --color-white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --spacing: 1rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    font-size: 16px;
}

/* ============================================
   HEADER
   ============================================ */
header {
    background: linear-gradient(135deg, var(--color-primary) 0%, #005a94 100%);
    color: var(--color-white);
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-md);
}

header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

header .subtitle {
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 400;
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

main.container {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    background: var(--color-white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.progress-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 60%;
    width: 80%;
    height: 2px;
    background-color: var(--color-border);
    z-index: -1;
}

.progress-step.active:not(:last-child)::after {
    background-color: var(--color-primary);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--color-border);
    color: var(--color-text-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.progress-step.active .step-number {
    background-color: var(--color-primary);
    color: var(--color-white);
    transform: scale(1.1);
}

.progress-step.completed .step-number {
    background-color: var(--color-secondary);
    color: var(--color-white);
}

.step-label {
    font-size: 0.875rem;
    color: var(--color-text-light);
    font-weight: 500;
}

.progress-step.active .step-label {
    color: var(--color-primary);
    font-weight: 600;
}

/* ============================================
   FORM STYLES
   ============================================ */
#primeForm {
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.4s ease-in;
}

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

.form-step h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--color-primary);
    font-weight: 700;
}

.info-text {
    color: var(--color-text-light);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background-color: #eff6ff;
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.95rem;
}

.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background-color: var(--color-white);
}

.form-group input[type="number"]:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 114, 188, 0.1);
}

.help-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

/* Radio Group */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: var(--color-white);
}

.radio-label:hover {
    border-color: var(--color-primary);
    background-color: #f0f9ff;
}

.radio-label input[type="radio"] {
    margin-right: 0.75rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.radio-label input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--color-primary);
}

.radio-label input[type="radio"]:checked {
    transform: scale(1.1);
}

/* Info Box */
.info-box {
    padding: 1rem;
    background-color: #f0f9ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--color-text);
}

.info-box strong {
    color: var(--color-primary);
}

/* ============================================
   NAVIGATION BUTTONS
   ============================================ */
.form-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.btn-primary:hover {
    background-color: #005a94;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--color-white);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
    background-color: var(--color-primary);
    color: var(--color-white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

/* ============================================
   RÉSULTAT
   ============================================ */
.resultat-prime {
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
    animation: slideUp 0.5s ease-out;
}

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

.montant-principal {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    color: var(--color-white);
}

.montant-principal .label {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    opacity: 0.95;
}

.montant-principal .montant {
    display: block;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.montant-principal .periode {
    display: block;
    font-size: 1.1rem;
    opacity: 0.9;
}

.montant-principal.zero {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Detail du calcul */
.detail-calcul {
    margin-bottom: 2rem;
}

.detail-calcul h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--color-primary);
}

.detail-calcul table {
    width: 100%;
    border-collapse: collapse;
}

.detail-calcul table tr {
    border-bottom: 1px solid var(--color-border);
}

.detail-calcul table tr:last-child {
    border-bottom: none;
}

.detail-calcul table td {
    padding: 0.75rem 0;
    font-size: 0.95rem;
}

.detail-calcul table td:first-child {
    color: var(--color-text);
}

.detail-calcul table td:last-child {
    text-align: right;
    font-weight: 600;
}

.detail-calcul .positif {
    color: var(--color-secondary);
}

.detail-calcul .negatif {
    color: var(--color-danger);
}

.detail-calcul .total td {
    padding-top: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
    border-top: 2px solid var(--color-primary);
}

/* Warning Box */
.info-box.warning {
    background-color: #fef3c7;
    border-color: #fbbf24;
    margin-bottom: 1.5rem;
}

.info-box.warning p {
    margin-bottom: 0.75rem;
}

.info-box.warning p:last-of-type {
    margin-bottom: 1rem;
}

.cta-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--color-primary);
    color: var(--color-white);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    transition: all 0.3s ease;
}

.cta-button:hover {
    background-color: #005a94;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

#recalculateBtn {
    width: 100%;
    margin-top: 1rem;
}

/* ============================================
   CONTENT SECTIONS
   ============================================ */
.info-section,
.faq-section,
.sources-section {
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.info-section h2,
.faq-section h2,
.sources-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--color-primary);
    font-weight: 700;
}

.info-section p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.highlight-box {
    background-color: #f0f9ff;
    padding: 1.5rem;
    border-radius: var(--radius);
    border-left: 4px solid var(--color-primary);
    margin-top: 1rem;
}

.highlight-box h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--color-primary);
}

.highlight-box ul {
    list-style: none;
    padding-left: 0;
}

.highlight-box ul li {
    padding-left: 1.5rem;
    position: relative;
    margin-bottom: 0.5rem;
}

.highlight-box ul li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-secondary);
    font-weight: 700;
}

/* FAQ */
.faq-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-item h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--color-text);
    font-weight: 600;
}

.faq-item p {
    color: var(--color-text-light);
    line-height: 1.7;
}

/* Sources */
.sources-section ul {
    list-style: none;
    padding-left: 0;
}

.sources-section ul li {
    margin-bottom: 0.75rem;
}

.sources-section ul li a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.sources-section ul li a:hover {
    color: #005a94;
    text-decoration: underline;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    background-color: var(--color-text);
    color: var(--color-white);
    padding: 2rem 1rem;
    text-align: center;
    margin-top: 3rem;
}

footer p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

footer p.copyright {
    opacity: 0.7;
    font-size: 0.85rem;
    margin-top: 1rem;
}

footer a {
    color: var(--color-white);
    text-decoration: underline;
}

footer a:hover {
    opacity: 0.8;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    header .subtitle {
        font-size: 0.9rem;
    }

    .progress-bar {
        padding: 1rem 0.5rem;
    }

    .step-number {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }

    .step-label {
        font-size: 0.75rem;
    }

    .progress-step:not(:last-child)::after {
        width: 70%;
        left: 65%;
    }

    #primeForm {
        padding: 1.5rem;
    }

    .form-step h2 {
        font-size: 1.25rem;
    }

    .montant-principal .montant {
        font-size: 2.5rem;
    }

    .form-navigation {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .info-section,
    .faq-section,
    .sources-section {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1.5rem 1rem;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .step-label {
        display: none;
    }

    .montant-principal {
        padding: 1.5rem;
    }

    .montant-principal .montant {
        font-size: 2rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    body {
        background-color: white;
    }

    header,
    footer,
    .form-navigation,
    #recalculateBtn {
        display: none;
    }

    .resultat-prime {
        box-shadow: none;
    }
}
