/**
 * 🧩 COMPONENTS.CSS - Composants CSS réutilisables de Valorizo
 * 
 * 📝 Description : Styles pour les composants partagés : boutons, cartes, modales, badges, navigation, etc.
 *                  Utilisé dans toute l'application pour garantir la cohérence visuelle.
 * 
 * 🔗 Dépend de : variables.css
 */

/* ═══════════════════════════════════════════════════════════════════════
   NAVIGATION & HEADER
   ═══════════════════════════════════════════════════════════════════════ */

.header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-normal);
}

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

.nav-link.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.auth-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════
   MENU MOBILE
   ═══════════════════════════════════════════════════════════════════════ */

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.mobile-menu-toggle:hover {
    background-color: var(--secondary-color);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.mobile-menu-overlay.active {
    display: flex;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 10000;
    overflow-y: auto;
}

/* Support pour les deux approches : .mobile-menu.active OU .mobile-menu-overlay.active .mobile-menu */
.mobile-menu.active,
.mobile-menu-overlay.active .mobile-menu {
    right: 0;
}

.mobile-menu-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-close:hover {
    color: var(--primary-color);
}

.mobile-menu-nav {
    padding: 20px 0;
}

.mobile-menu-nav a {
    display: block;
    padding: 15px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.mobile-menu-nav a:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

.mobile-menu-nav a.active {
    color: var(--primary-color);
    background-color: #f5f3ff;
}

.mobile-menu-auth {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-menu-auth .btn {
    width: 100%;
    justify-content: center;
}

/* Media query pour afficher le menu burger sur mobile */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block !important;
    }
    
    .nav-menu {
        display: none !important;
    }
    
    .auth-buttons {
        display: none !important;
    }
    
    /* Sélecteur de langue mobile dans le header */
    #mobile-header-lang {
        display: flex !important;
        align-items: center;
        margin-right: 8px;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    #mobile-header-lang .mobile-lang-btn {
        display: flex !important;
    }
    
    .nav-container {
        padding: 0 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   BADGES & LABELS
   ═══════════════════════════════════════════════════════════════════════ */

.plan-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-badge.pro,
.plan-badge.essential {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.plan-badge.free,
.plan-badge.discovery {
    background: #e5e7eb;
    color: #6b7280;
}

.plan-badge.pay-per-use {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════
   BOUTONS
   ═══════════════════════════════════════════════════════════════════════ */

.btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover {
    background: #e2e8f0;
}

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

.btn-danger:hover {
    background: #dc2626;
}

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

.btn-success:hover {
    background: #059669;
}

.btn-icon {
    border: none;
    background: #f5f3ff;
    color: #6d28d9;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background var(--transition-normal);
}

.btn-icon:hover {
    background: #ede9fe;
}

.btn-suggestion {
    background: var(--warning-color);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-suggestion:hover {
    background: #d97706;
    transform: scale(1.1);
}

.btn-suggestion:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

/* ═══════════════════════════════════════════════════════════════════════
   CARTES & CONTENEURS
   ═══════════════════════════════════════════════════════════════════════ */

.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* ═══════════════════════════════════════════════════════════════════════
   TOOLTIPS
   ═══════════════════════════════════════════════════════════════════════ */

.suggestion-tooltip {
    position: absolute;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-top: var(--spacing-sm);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    max-width: 560px;
    width: auto;
    z-index: 1000;
    font-size: 14px;
    line-height: 1.5;
    max-height: 70vh;
    overflow: auto;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.suggestion-tooltip::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
}

.tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.tooltip-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--primary-color);
}

.tooltip-dot {
    width: 8px;
    height: 8px;
    background: #7c3aed;
    border-radius: 9999px;
    display: inline-block;
}

.tooltip-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════
   MODALES
   ═══════════════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color var(--transition-normal);
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════════
   FORMULAIRES
   ═══════════════════════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: border-color var(--transition-normal);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════
   MESSAGES & ALERTES
   ═══════════════════════════════════════════════════════════════════════ */

.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* ═══════════════════════════════════════════════════════════════════════
   LOADING & SPINNERS
   ═══════════════════════════════════════════════════════════════════════ */

.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

/* ═══════════════════════════════════════════════════════════════════════
   PROTECTION MOBILE - DÉBORDEMENTS
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Protection globale contre les débordements horizontaux */
    body {
        overflow-x: hidden !important;
    }

    /* Protection des conteneurs principaux */
    .container,
    .main-content,
    .content-wrapper {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }

    /* Protection des cartes et badges */
    .card,
    .badge,
    .alert {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
    }

    /* Protection des boutons */
    .btn {
        white-space: normal !important;
        word-wrap: break-word !important;
    }

    /* Protection des modales */
    .modal-content {
        max-width: 95% !important;
        margin: 10px auto !important;
        overflow-x: hidden !important;
    }
}

