:root {
    --primary: #004b93;
    --primary-light: #e6f0fa;
    --primary-hover: #003366;
    --text-main: #111827;
    --text-muted: #6b7280;
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --border-light: #e5e7eb;
    --success: #059669;
    --header-bg: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, sans-serif;
}

body {
    background-color: var(--bg-body);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- BOUTON D'INSTALLATION ANDROID (PWA) --- */
#android-install-btn {
    display: none;
    background-color: #1e293b;
    color: white;
    border: none;
    padding: 12px 20px;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    font-size: 0.9rem;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#android-install-btn:hover {
    background-color: #0f172a;
}

/* --- HEADER AMELI --- */
.ameli-header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.main-header {
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 40px;
    justify-content: space-between;
}

.logo-container img {
    height: 110px; 
    width: auto;
    object-fit: contain;
}

.main-nav {
    display: flex;
    gap: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.main-nav span {
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.main-nav span:hover { color: var(--primary); }
.main-nav span::after {
    content: '▼';
    font-size: 0.6rem;
    color: var(--text-muted);
}

.action-bar {
    background-color: var(--primary);
    padding: 10px 30px;
    display: flex;
    gap: 25px;
    overflow-x: auto;
    white-space: nowrap;
}

.action-bar::-webkit-scrollbar { display: none; }

.action-bar a {
    color: white;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.action-bar a span.sub {
    font-size: 0.7rem;
    opacity: 0.8;
    font-weight: 400;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 10px;
}

/* --- CONTENEUR PRINCIPAL --- */
.main-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
}

.card {
    background: var(--bg-card);
    width: 100%;
    max-width: 460px;
    min-height: 620px; 
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    padding: 40px;
    position: relative;
    display: flex;
    flex-direction: column;
}

h2 {
    color: var(--primary);
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 8px;
    margin-top: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.divider {
    height: 3px;
    background-color: var(--primary);
    width: 60px;
    margin: 0 auto 30px auto;
    border-radius: 2px;
    flex-shrink: 0;
}

p {
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 16px;
}

strong { font-weight: 600; }

.link {
    text-decoration: underline;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
}

.info-block {
    background-color: #f9fafb;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.info-block p { margin-bottom: 0; }

.note-box {
    background-color: var(--primary-light);
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    font-size: 0.85rem;
    color: var(--primary);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.note-box svg { flex-shrink: 0; margin-top: 2px; }

.payment-option {
    display: block;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    background: #fff;
    transition: all 0.2s;
    cursor: pointer;
}

.payment-option.active {
    border-color: var(--primary);
    background: #f5f8ff;
    box-shadow: 0 0 0 1px var(--primary);
}

.payment-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #fafafa;
    border-color: var(--border-light);
}

.payment-option input[type="radio"] { position: absolute; opacity: 0; }

.radio-indicator {
    position: absolute;
    top: 24px;
    left: 20px;
    height: 20px;
    width: 20px;
    border: 2px solid #d1d5db;
    background-color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.payment-option.active .radio-indicator {
    border-color: var(--primary);
    background-color: var(--primary);
}

.payment-option.active .radio-indicator::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

.option-content { padding-left: 36px; }
.option-title { display: block; font-weight: 600; font-size: 0.95rem; color: var(--text-main); margin-bottom: 4px; }
.option-subtitle { display: block; font-size: 0.85rem; color: var(--text-muted); }
.badge-indispo {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #b91c1c;
    background: #fee2e2;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.amount-section {
    margin-top: 24px;
    margin-bottom: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.amount-label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 0.9rem; color: var(--text-main); }
.amount-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-main);
    background-color: #f9fafb;
    font-weight: 600;
}

.form-group { margin-bottom: 16px; position: relative; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--text-main); }
.input-wrapper { position: relative; display: flex; align-items: center; }
.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: all 0.3s ease;
    font-family: 'Inter', monospace;
    background-color: #fff;
}
.form-group input.has-icon { padding-right: 75px; }
.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 75, 147, 0.1);
}
.form-group input.valid { border-color: var(--success); background-color: #f0fdf4; }

.card-icon-container {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

.logo-fade-in { animation: fadeInLogo 0.3s ease-out forwards; }
@keyframes fadeInLogo { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

.card-icon-container img {
    height: 18px;
    width: 28px;
    object-fit: contain;
    border-radius: 4px;
    animation: fadeInLogo 0.3s ease-out forwards;
}

.valid-check {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--success);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    background: white;
    padding-left: 4px;
    z-index: 2;
    border-radius: 50%;
}

.form-group input.valid ~ .valid-check { opacity: 1; animation: bounceIn 0.4s ease; }
@keyframes bounceIn {
    0% { transform: translateY(-50%) scale(0.5); }
    60% { transform: translateY(-50%) scale(1.2); }
    100% { transform: translateY(-50%) scale(1); }
}

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.secure-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--success);
    margin-top: auto;
    padding-top: 16px;
    font-weight: 500;
}

.btn-submit {
    width: 100%;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.btn-submit:hover { background-color: var(--primary-hover); }

.btn-back {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    transition: color 0.2s;
    flex-shrink: 0;
}
.btn-back:hover { color: var(--text-main); }

.step {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    flex-direction: column;
    flex: 1;
}
.step.active { display: flex; opacity: 1; }

#loader-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
}
#loader-container.active { display: flex; }

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--primary-light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loader-text { color: var(--primary); font-weight: 600; font-size: 0.95rem; }

/* --- FOOTER AMELI --- */
.ameli-footer {
    background-color: #1e293b; 
    color: #cbd5e1;
    padding: 40px 20px 30px 20px;
    font-size: 0.8rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #334155;
}

.footer-branding {
    display: flex;
    align-items: center;
    gap: 20px;
}

.footer-branding img { height: 55px; width: auto; }

.footer-rs { display: flex; align-items: center; gap: 15px; }
.footer-rs-label { font-weight: 600; font-size: 0.85rem; color: #f1f5f9; }

.footer-rs-list { display: flex; gap: 15px; list-style: none; }
.footer-rs-list img {
    height: 20px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: 0.8;
    transition: opacity 0.2s;
}
.footer-rs-list img:hover { opacity: 1; }

.footer-secondary {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.footer-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #334155;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.footer-btn:hover { background-color: #475569; }
.footer-btn img { height: 24px; width: auto; filter: brightness(0) invert(1); }

.footer-bottom {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.footer-bottom ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.footer-bottom a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.75rem;
    transition: color 0.2s;
}
.footer-bottom a:hover { color: white; }

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 900px) {
    .main-nav { display: none; }
    .action-bar { display: none; }

    .main-header {
        padding: 15px 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0;
    }

    .logo-container img { height: 85px; }

    .mobile-menu-btn { display: block; }
    .mobile-menu-btn svg { width: 32px; height: 32px; }

    .footer-top { flex-direction: column; text-align: center; }
    .footer-branding { flex-direction: column; }
}

@media (max-width: 600px) {
    .main-wrapper { padding: 15px; }
    .card { padding: 24px; min-height: auto; width: 100%; }
    h2 { font-size: 1.3rem; }
    .form-row { flex-direction: column; gap: 0; }
    
    .ameli-footer { padding: 30px 15px 20px 15px; }
    .footer-branding { flex-direction: column; gap: 15px; }
    .footer-secondary { flex-direction: column; gap: 15px; }
    .footer-btn { justify-content: center; width: 100%; }
    .footer-bottom ul { flex-direction: column; gap: 10px; }
    .footer-rs { flex-direction: column; gap: 10px; }
}