/* ========================================
   ECO-AFRIQUE - STYLES RESPONSIFS
   Version mobile-first
   ======================================== */

:root {
    --primary: #2e7d32;
    --primary-dark: #1b5e20;
    --primary-light: #4caf50;
    --secondary: #ffd700;
    --danger: #dc3545;
    --warning: #ff9800;
    --info: #2196f3;
    --success: #4caf50;
    --dark: #333;
    --gray: #666;
    --light: #f5f5f5;
    --white: #ffffff;
    --border: #e0e0e0;
    --shadow: 0 2px 10px rgba(0,0,0,0.05);
    --shadow-hover: 0 5px 20px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
}

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

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f0f2f5;
    color: var(--dark);
    line-height: 1.5;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   CONTAINERS - Centrés et flexibles
   ======================================== */
.container,
.main-content .container,
.dashboard-container,
.page-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    overflow-x: hidden;
}

/* Pour les très petits écrans */
@media (max-width: 480px) {
    .container,
    .main-content .container,
    .dashboard-container,
    .page-container {
        padding: 0 12px;
    }
}

/* ========================================
   HEADER & NAVIGATION
   ======================================== */
.header {
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.logo a {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}

.logo i {
    margin-right: 8px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    transition: color 0.3s;
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--primary);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
}

/* Responsive Header */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        padding: 12px 16px;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0;
        margin-top: 15px;
    }
    
    .nav-links.show {
        display: flex;
    }
    
    .nav-links li {
        border-top: 1px solid var(--border);
        width: 100%;
        text-align: center;
    }
    
    .nav-links a {
        display: block;
        padding: 12px;
        white-space: normal;
    }
}

/* ========================================
   CARDS - Parfaitement centrées
   ======================================== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    width: 100%;
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--light);
}

.card-header h2,
.card-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--dark);
}

.card-body {
    padding: 20px;
}

/* Cartes de statistiques */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
    width: 100%;
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: #e8f5e9;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon i {
    font-size: 24px;
    color: var(--primary);
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--dark);
    word-break: break-word;
}

/* ========================================
   GRILLES RESPONSIVES
   ======================================== */
.stats-grid,
.vip-packs-grid,
.commission-cards,
.actions-grid,
.features-grid,
.packs-grid,
.downline-grid {
    display: grid;
    gap: 20px;
    width: 100%;
}

/* Desktop */
@media (min-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .vip-packs-grid { grid-template-columns: repeat(3, 1fr); }
    .commission-cards { grid-template-columns: repeat(3, 1fr); }
    .actions-grid { grid-template-columns: repeat(4, 1fr); }
    .features-grid { grid-template-columns: repeat(4, 1fr); }
    .packs-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Tablettes */
@media (min-width: 768px) and (max-width: 1023px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .vip-packs-grid { grid-template-columns: repeat(2, 1fr); }
    .commission-cards { grid-template-columns: repeat(2, 1fr); }
    .actions-grid { grid-template-columns: repeat(2, 1fr); }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .packs-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Mobiles */
@media (max-width: 767px) {
    .stats-grid,
    .vip-packs-grid,
    .commission-cards,
    .actions-grid,
    .features-grid,
    .packs-grid,
    .downline-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
}

/* ========================================
   FORMULAIRES
   ======================================== */
.form-group {
    margin-bottom: 20px;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: all 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46,125,50,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* ========================================
   BOUTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

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

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

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

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .btn {
        padding: 10px 20px;
        white-space: normal;
    }
}

/* ========================================
   ALERTES
   ======================================== */
.alert {
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.close-btn {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.5;
    padding: 0 5px;
}

@media (max-width: 768px) {
    .alert {
        padding: 12px;
        font-size: 0.85rem;
    }
}

/* ========================================
   TABLEAUX
   ======================================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--light);
    font-weight: 600;
}

@media (max-width: 768px) {
    .data-table th,
    .data-table td {
        padding: 10px;
        font-size: 0.85rem;
    }
}

/* ========================================
   AUTHENTIFICATION (Connexion/Inscription)
   ======================================== */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 450px;
    padding: 30px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 20px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
    .auth-card {
        padding: 20px;
        margin: 10px;
    }
}

/* ========================================
   PAGE D'ACCUEIL (Hero, Features, etc.)
   ======================================== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 60px 20px;
    text-align: center;
    width: 100%;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 50px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .hero {
        padding: 40px 16px;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .hero-stats {
        gap: 20px;
    }
}

/* Features */
.features {
    padding: 60px 0;
    background: var(--light);
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
    color: var(--primary);
}

.feature-card {
    text-align: center;
    padding: 30px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-card i {
    font-size: 40px;
    color: var(--primary);
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .features {
        padding: 40px 0;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 30px;
    }
    
    .feature-card {
        padding: 20px;
    }
}

/* Packs VIP */
.vip-pack-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
    width: 100%;
}

.vip-pack-card:hover {
    transform: translateY(-5px);
}

.pack-header {
    background: var(--light);
    padding: 20px;
    text-align: center;
}

.pack-price {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary);
}

.pack-body {
    padding: 20px;
}

.pack-body ul {
    list-style: none;
    margin-bottom: 20px;
}

.pack-body li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.pack-body li i {
    color: var(--primary);
    width: 25px;
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    background: var(--dark);
    color: var(--white);
    padding: 40px 0 20px;
    margin-top: 50px;
    width: 100%;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-col h4 {
    margin-bottom: 15px;
    color: var(--primary-light);
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 8px;
}

.footer-col a {
    color: #adb5bd;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-col a:hover {
    color: var(--white);
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.social-links a {
    color: var(--white);
    font-size: 1.2rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .footer {
        margin-top: 30px;
        padding: 30px 0 15px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 20px;
    }
    
    .social-links {
        justify-content: center;
    }
}

/* ========================================
   UTILITAIRES
   ======================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mt-4 { margin-top: 20px; }
.mt-5 { margin-top: 30px; }

.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 20px; }
.mb-5 { margin-bottom: 30px; }

.p-1 { padding: 5px; }
.p-2 { padding: 10px; }
.p-3 { padding: 15px; }
.p-4 { padding: 20px; }
.p-5 { padding: 30px; }

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.gap-1 { gap: 5px; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 15px; }
.gap-4 { gap: 20px; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* ========================================
   BADGES & STATUS
   ======================================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-success {
    background: #e8f5e9;
    color: var(--success);
}

.badge-warning {
    background: #fff3e0;
    color: var(--warning);
}

.badge-danger {
    background: #ffebee;
    color: var(--danger);
}

.badge-info {
    background: #e3f2fd;
    color: var(--info);
}

/* ========================================
   DOWNLINE (Arbre de parrainage)
   ======================================== */
.downline-level {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.level-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.level-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
}

.level-badge.niveau-1 { background: #fff3e0; color: #ef6c00; }
.level-badge.niveau-2 { background: #e3f2fd; color: #1565c0; }
.level-badge.niveau-3 { background: #f3e5f5; color: #7b1fa2; }

.downline-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--light);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    width: 100%;
}

@media (max-width: 768px) {
    .downline-card {
        flex-direction: column;
        text-align: center;
    }
}

/* ========================================
   RÉINITIALISATION MOT DE PASSE
   ======================================== */
.forgot-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.password-strength {
    margin-top: 8px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.strength-meter {
    height: 100%;
    width: 0%;
    transition: width 0.3s;
}

.strength-weak { background: var(--danger); width: 33.33%; }
.strength-medium { background: var(--warning); width: 66.66%; }
.strength-strong { background: var(--success); width: 100%; }

.password-match {
    margin-top: 5px;
    font-size: 0.8rem;
}

.match-success { color: var(--success); }
.match-error { color: var(--danger); }

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

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* ========================================
   CORRECTIONS SPÉCIFIQUES ANDROID
   ======================================== */
@media (max-width: 480px) {
    /* Éviter les débordements */
    input, select, textarea, button {
        font-size: 16px !important;
    }
    
    /* Centrage parfait */
    .text-center-mobile {
        text-align: center;
    }
    
    /* Ajustement des cartes */
    .stat-card {
        flex-direction: row;
        text-align: left;
    }
    
    /* Liens qui dépassent */
    a, .break-word {
        word-break: break-word;
        overflow-wrap: break-word;
    }
}

/* ========================================
   STYLES DU MENU MODAL
   ======================================== */

/* Animation du menu */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.menu-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.menu-modal.active {
    display: flex;
    animation: modalFadeIn 0.3s ease-out;
}

.menu-modal-content {
    background: white;
    border-radius: 32px;
    max-width: 340px;
    width: 90%;
    padding: 30px 24px;
    text-align: center;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.menu-modal.active .menu-modal-content {
    animation: modalSlideUp 0.4s ease-out;
}

.menu-modal-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 36px;
    height: 36px;
    background: #f44336;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.menu-modal-close:hover {
    background: #d32f2f;
    transform: scale(1.05) rotate(90deg);
}

.menu-modal-logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: #2e7d32;
    margin-bottom: 20px;
}

.menu-modal-logo i {
    font-size: 3rem;
    margin-bottom: 8px;
}

.menu-modal-user {
    background: #f0f2f5;
    padding: 15px;
    border-radius: 20px;
    margin-bottom: 25px;
}

.menu-modal-user-name {
    font-weight: 700;
    color: #333;
    font-size: 1rem;
}

.menu-modal-user-name i {
    margin-right: 8px;
    color: #2e7d32;
}

.menu-modal-user-email {
    font-size: 0.75rem;
    color: #666;
    margin-top: 4px;
    word-break: break-word;
}

.menu-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.menu-modal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 16px;
    background: #f8f9fa;
    border: none;
    border-radius: 16px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    width: 100%;
}

.menu-modal-btn i {
    width: 24px;
    font-size: 1.2rem;
}

.menu-modal-btn:hover {
    background: #2e7d32;
    color: white;
    transform: translateY(-2px);
}

.menu-modal-btn.primary {
    background: #2e7d32;
    color: white;
}

.menu-modal-btn.primary:hover {
    background: #1b5e20;
    transform: translateY(-2px);
}

.menu-modal-btn.danger {
    color: #dc3545;
}

.menu-modal-btn.danger:hover {
    background: #dc3545;
    color: white;
}

.menu-modal-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 0;
}

/* Avatar utilisateur */
.user-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Responsive */
@media (max-width: 480px) {
    .menu-modal-content {
        max-width: 300px;
        padding: 25px 20px;
    }
    
    .menu-modal-btn {
        padding: 12px 14px;
        font-size: 0.85rem;
    }
    
    .menu-modal-logo {
        font-size: 1.5rem;
    }
    
    .menu-modal-logo i {
        font-size: 2.5rem;
    }
}