/* =========================================
   1. RESET & VARIABLES GLOBALES
   ========================================= */
:root {
    --primary: #10B981; /* Vert Wink */
    --dark: #111827;    /* Noir Profond */
    --gray: #F3F4F6;    /* Gris Clair fond */
    --text: #374151;    /* Gris Texte */
    --danger: #DC2626;  /* Rouge Erreur */
    --link: #3B82F6;    /* Bleu Lien */
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f6;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 20px 20px;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    color: var(--text);
}

/* =========================================
   2. CONTAINERS & STRUCTURE
   ========================================= */
.container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
    margin: 0 auto;
    text-align: center;
}

.auth-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding-top: 20px;
    padding-bottom: 20px;
}

.dashboard-body {
    background: #f3f4f6;
    display: block;
}

.dashboard-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 0 15px;
}

/* =========================================
   3. BRANDING
   ========================================= */
.brand, .brand-small {
    font-weight: 800;
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.brand { margin-bottom: 20px; letter-spacing: -1px; }

.brand-large {
    font-size: 28px;
    font-weight: 900;
    color: var(--dark);
    margin-bottom: 5px;
}

.dot, .dot-large {
    background: var(--primary);
    border-radius: 50%;
    display: inline-block;
}
.dot { width: 10px; height: 10px; }
.dot-large { width: 14px; height: 14px; }

.tagline { font-size: 18px; font-weight: 600; margin: 0; color: var(--text); }
.sub-tagline { font-size: 14px; color: #6B7280; margin: 5px 0 30px 0; }

/* =========================================
   4. CARTE "GLASSMORPHISM"
   ========================================= */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 30px 25px;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.05), 
        0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.6);
    margin-bottom: 20px;
    width: 100%;
    transition: transform 0.3s ease;
}

.auth-card {
    max-width: 380px;
    padding: 35px 25px;
}

/* =========================================
   5. FORMULAIRES
   ========================================= */
.input-group-vertical {
    display: flex;
    flex-direction: column;
    text-align: left;
    margin-bottom: 15px;
    width: 100%;
}

.input-group-vertical label {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #4B5563;
    padding-left: 2px;
}

.input-group-vertical input,
.input-group input,
textarea,
select {
    width: 100%;
    padding: 14px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    background: #F9FAFB;
    font-size: 16px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

.input-group-vertical input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.row { display: flex; gap: 12px; width: 100%; }
.half { flex: 1; width: auto; }

.toggle-type { display: flex; background: #F3F4F6; padding: 4px; border-radius: 10px; }
.type-btn {
    flex: 1; border: none; background: transparent; padding: 10px;
    border-radius: 8px; font-size: 13px; font-weight: 600;
    color: #6B7280; cursor: pointer; transition: all 0.2s;
}
.type-btn.active { background: white; color: var(--dark); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

/* =========================================
   6. BOUTONS
   ========================================= */
.btn-primary {
    background: var(--dark);
    color: white;
    border: none;
    width: 100%;
    padding: 18px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-primary:active { transform: scale(0.97); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }

.btn-small {
    background: var(--dark); color: white; border: none;
    padding: 8px 16px; border-radius: 8px; cursor: pointer;
    font-size: 13px; margin-top: 8px;
}

.btn-whatsapp {
    background: #25D366; color: white; width: 100%; padding: 14px;
    border: none; border-radius: 12px; font-weight: 600; cursor: pointer;
    margin-top: 10px; box-shadow: 0 4px 6px rgba(37, 211, 102, 0.2);
}

.btn-renew {
    background: var(--danger); color: white; border: none;
    padding: 8px 16px; border-radius: 6px; margin-top: 10px;
    font-weight: 600; cursor: pointer;
}

/* =========================================
   7. DASHBOARD
   ========================================= */
.navbar {
    background: white; padding: 15px 20px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); width: 100%;
}

.btn-text { background: none; border: none; color: #6B7280; font-size: 13px; cursor: pointer; text-decoration: underline; }

.profile-card { padding: 25px; }
.profile-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.profile-info h2 { margin: 0; font-size: 18px; color: var(--dark); }

.badge-status {
    font-size: 12px; padding: 4px 8px; border-radius: 12px;
    background: #D1FAE5; color: #065F46; font-weight: 600;
}

.stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; text-align: center; }
.stat-item { background: #f9fafb; padding: 12px; border-radius: 10px; }
.stat-val { display: block; font-size: 18px; font-weight: 800; color: var(--dark); }
.stat-label { font-size: 11px; color: #6B7280; }

.section-title {
    font-size: 12px; font-weight: 700; color: #9CA3AF;
    margin: 25px 0 10px 5px; text-transform: uppercase; letter-spacing: 1px;
}

.tools-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }
.tool-card {
    background: white; padding: 20px 10px; border-radius: 16px;
    text-align: center; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    cursor: pointer; transition: transform 0.2s;
}
.tool-card:active { transform: scale(0.95); }
.tool-card span { font-size: 24px; display: block; margin-bottom: 5px; }
.tool-card p { margin: 0; font-size: 12px; font-weight: 600; color: var(--text); }

/* Switch Toggle */
.switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(24px); }

/* Lien Dashboard */
.input-group { display: flex; gap: 10px; margin-bottom: 10px; }
.input-group input { flex: 1; font-family: monospace; }
.input-group button { background: var(--dark); color: white; border: none; padding: 0 20px; border-radius: 8px; cursor: pointer; }

/* =========================================
   8. CAPTURE & GPS
   ========================================= */
.avatar-wrapper {
    position: relative; width: 90px; height: 90px; margin: 0 auto 15px;
}
#rider-photo {
    width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
    border: 4px solid white; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.badge-verified {
    position: absolute; bottom: 0; right: 0;
    background: #3B82F6; color: white; width: 26px; height: 26px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    border: 2px solid white; font-size: 14px;
}

.tags { margin-top: 10px; display: flex; justify-content: center; gap: 10px; }
.tag { background: var(--gray); padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; }

.message-box {
    background: #ECFDF5; color: #065F46; padding: 20px;
    border-radius: 16px; margin: 25px 0; font-size: 15px; line-height: 1.5;
    text-align: left; border-left: 4px solid var(--primary);
}

.radar-container {
    position: relative; width: 100px; height: 100px; margin: 0 auto 30px;
    display: flex; justify-content: center; align-items: center;
}
.radar {
    width: 16px; height: 16px; background: var(--primary);
    border-radius: 50%; position: relative; z-index: 10;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}
.radar-ping {
    position: absolute; width: 100%; height: 100%; border-radius: 50%;
    border: 2px solid var(--primary); opacity: 0;
    animation: ripple 2s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}
.radar-container::after {
    content: ''; position: absolute; width: 100%; height: 100%;
    border-radius: 50%; background: var(--primary); opacity: 0.1;
    animation: pulse-bg 2s infinite;
}
@keyframes ripple { 0% { transform: scale(0); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes pulse-bg { 0% { transform: scale(0.8); } 50% { transform: scale(1); } 100% { transform: scale(0.8); } }

.progress-bar { width: 100%; height: 8px; background: var(--gray); border-radius: 4px; margin-top: 15px; overflow: hidden; }
#accuracy-bar { height: 100%; background: #4F46E5; transition: width 0.5s ease; border-radius: 4px; }

.spinner {
    border: 3px solid var(--gray); border-top: 3px solid var(--primary);
    border-radius: 50%; width: 40px; height: 40px;
    animation: spin 1s linear infinite; margin: 0 auto 20px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* =========================================
   9. UTILITAIRES & FOOTER
   ========================================= */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.divider { height: 1px; background: #E5E7EB; margin: 25px 0; }
.welcome-msg { font-size: 15px; color: var(--primary); font-weight: 700; margin-bottom: 20px; }

.alert-box {
    background: #FEE2E2; color: #991B1B; padding: 15px;
    border-radius: 12px; margin-bottom: 20px; text-align: center; border: 1px solid #FCA5A5;
}

.error-text { color: var(--danger); font-size: 13px; margin-top: 15px; font-weight: 500; }

.footer-info { display: flex; gap: 25px; margin-top: 30px; opacity: 0.6; }
.feature { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; }

.price-tag { margin-top: 25px; font-size: 11px; color: #9CA3AF; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }

@media (max-width: 400px) {
    .row { flex-direction: column; gap: 0; }
    .half { width: 100%; }
    .card { padding: 25px 20px; }
}

#gps-state h3 {
    transition: opacity 0.2s ease, color 0.3s ease;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 10px;
}

/* PARRAINAGE */
.referral-wrapper { position: relative; width: 100%; }
.referral-icon { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); font-size: 16px; }
.success-text { color: #10B981; font-size: 12px; font-weight: 700; margin-top: 5px; animation: fadeIn 0.4s ease; }
#referral-code { text-transform: uppercase; letter-spacing: 1px; font-weight: 700; color: var(--primary); }

/* =========================================
   10. MODAL PAIEMENT (Pop-up)
   ========================================= */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex; justify-content: center; align-items: center;
    padding: 20px;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.modal:not(.hidden) { opacity: 1; pointer-events: auto; }

.modal-content {
    background: white; width: 100%; max-width: 350px;
    padding: 30px 25px; border-radius: 24px; text-align: center;
    position: relative; 
    transform: translateY(20px); transition: transform 0.3s ease;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.modal:not(.hidden) .modal-content { transform: translateY(0); }

.close-btn {
    position: absolute; top: 15px; right: 20px; font-size: 28px;
    cursor: pointer; color: #9CA3AF; transition: color 0.2s;
}
.close-btn:hover { color: var(--danger); }

.modal-title { font-size: 20px; font-weight: 800; margin: 0; color: var(--dark); }
.modal-desc { font-size: 14px; color: #6B7280; margin: 5px 0 15px 0; }

.price-badge {
    background: #ECFDF5; color: #059669; font-weight: 800; font-size: 24px;
    display: inline-block; padding: 10px 20px; border-radius: 12px; margin-bottom: 20px;
    border: 1px solid #D1FAE5;
}

.operator-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }

.op-card {
    border: 2px solid #E5E7EB; border-radius: 12px; padding: 5px;
    cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; color: #4B5563; height: 50px;
    background: white;
}
.op-card:hover { border-color: var(--primary); background: #F0FDF4; }
.op-card.selected { 
    border-color: var(--primary); 
    background: #DCFCE7; 
    color: var(--dark);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2); 
}
.op-orange { color: #FF7900; }
.op-mtn { color: #FFCC00; text-shadow: 0px 0px 1px #DAA520; }
.op-wave { color: #1DC8FF; }
.op-airtel { color: #FF0000; }
.op-moov { color: #004D8C; }


/* --- NOUVEAUX STYLES AJOUTÉS (Preview & Badges) --- */

.message-preview {
    background: #EFF6FF;
    border: 1px dashed #BFDBFE;
    padding: 15px;
    border-radius: 12px;
    font-size: 14px;
    color: #1E3A8A;
    font-style: italic;
    margin-bottom: 15px;
    text-align: left;
    line-height: 1.5;
}

.action-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-secondary {
    flex: 1;
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    padding: 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover { background: #E5E7EB; }

.operator-grid-logos {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 20px 0;
}

.op-logo-card {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 16px;
    border: 2px solid #E5E7EB;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.op-logo-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.op-logo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.op-logo-card.selected {
    border-color: #10B981;
    background: #ECFDF5;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.check-mark {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #10B981;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    font-weight: bold;
}

/* --- TRUST BADGES --- */
.trust-badges {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #F3F4F6;
}

.badge-item {
    font-size: 11px;
    color: #6B7280;
    background: #F9FAFB;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}