/* ================================================
   TANGIBLE POPUP STYLES - Harmonisé avec le thème
   ================================================ */

/* Base popup overlay avec glassmorphism */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7); /* navy-900 avec transparence */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.popup-overlay.active {
    display: flex;
    opacity: 1;
}

/* Contenu popup avec design premium */
.popup-content {
    width: 100%;
    max-width: 500px;
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 25px 50px -12px rgba(15, 23, 42, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transform: scale(0.9) translateY(30px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode adaptation */
.dark .popup-overlay {
    background: rgba(0, 0, 0, 0.8);
}

.dark .popup-content {
    background: rgba(30, 41, 59, 0.95); /* navy-800 */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

/* Animation d'entrée fluide */
.popup-overlay.active .popup-content {
    transform: scale(1) translateY(0);
}

/* Animation keyframes premium */
@keyframes popupEnter {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(40px) rotateX(10deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.02) translateY(-5px) rotateX(0deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0) rotateX(0deg);
    }
}

@keyframes popupExit {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
}

/* Animation classes */
.animate-popup-enter {
    animation: popupEnter 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-popup-exit {
    animation: popupExit 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Inner content avec padding optimal */
.popup-inner {
    padding: 2.5rem;
    position: relative;
    z-index: 1;
}

/* Gradient de fond subtle pour les headers */
.popup-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(135deg, 
        rgba(14, 165, 233, 0.1) 0%, 
        rgba(99, 102, 241, 0.05) 50%, 
        transparent 100%);
    z-index: 0;
}

.dark .popup-content::before {
    background: linear-gradient(135deg, 
        rgba(14, 165, 233, 0.15) 0%, 
        rgba(99, 102, 241, 0.08) 50%, 
        transparent 100%);
}

/* Styles pour les titres avec gradient */
.popup-content h3 {
    background: linear-gradient(135deg, #1e293b, #475569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 2;
}

.dark .popup-content h3 {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Badge "Étape X sur Y" amélioré */
.popup-content .relative.text-sm.font-medium {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(99, 102, 241, 0.1));
    border: 1px solid rgba(14, 165, 233, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 2;
}

.dark .popup-content .relative.text-sm.font-medium {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(99, 102, 241, 0.15));
    border: 1px solid rgba(14, 165, 233, 0.3);
}

/* Forms et inputs avec le style Tangible */
.popup-content .form-select,
.popup-content input[type="email"],
.popup-content input[type="text"],
.popup-content textarea {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(203, 213, 225, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.dark .popup-content .form-select,
.dark .popup-content input[type="email"],
.dark .popup-content input[type="text"],
.dark .popup-content textarea {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(71, 85, 105, 0.5);
    color: #f8fafc;
}

.popup-content .form-select:focus,
.popup-content input:focus,
.popup-content textarea:focus {
    outline: none;
    border-color: rgba(14, 165, 233, 0.6);
    box-shadow: 
        0 0 0 3px rgba(14, 165, 233, 0.1),
        0 4px 12px rgba(14, 165, 233, 0.15);
    transform: translateY(-1px);
}

/* Checkboxes style Tangible */
.popup-content .form-checkbox {
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid rgba(203, 213, 225, 0.8);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
}

.dark .popup-content .form-checkbox {
    border: 2px solid rgba(71, 85, 105, 0.8);
    background: rgba(30, 41, 59, 0.9);
}

.popup-content .form-checkbox:checked {
    background: linear-gradient(135deg, #0ea5e9, #3b82f6);
    border-color: transparent;
    transform: scale(1.05);
}

.popup-content .form-checkbox:hover {
    border-color: rgba(14, 165, 233, 0.6);
    transform: scale(1.05);
}

/* Checkbox container hover effect */
.popup-content .flex.items-start:hover {
    background: rgba(14, 165, 233, 0.05);
    border-radius: 12px;
    transform: translateX(4px);
    transition: all 0.3s ease;
}

.dark .popup-content .flex.items-start:hover {
    background: rgba(14, 165, 233, 0.1);
}

/* Boutons avec style premium */
.popup-content button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    z-index: 2;
}

/* Bouton principal */
.popup-content button[type="submit"] {
    background: linear-gradient(135deg, #1e293b, #334155);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 4px 12px rgba(30, 41, 59, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.dark .popup-content button[type="submit"] {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    color: #1e293b;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.popup-content button[type="submit"]:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 8px 20px rgba(30, 41, 59, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Bouton secondaire (Sauter) */
.popup-content .btn-sm:not([type="submit"]) {
    background: rgba(156, 163, 175, 0.2);
    border: 1px solid rgba(156, 163, 175, 0.3);
    backdrop-filter: blur(10px);
}

.dark .popup-content .btn-sm:not([type="submit"]) {
    background: rgba(71, 85, 105, 0.3);
    border: 1px solid rgba(71, 85, 105, 0.5);
}

.popup-content .btn-sm:not([type="submit"]):hover {
    background: rgba(156, 163, 175, 0.3);
    transform: translateY(-1px);
}

/* Select dropdown avec icône custom */
.popup-content .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 3rem;
}

.dark .popup-content .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* Messages d'erreur stylisés */
.popup-content .error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 0.5rem;
    color: #dc2626;
    backdrop-filter: blur(10px);
}

.dark .popup-content .error-message {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Empêcher le scroll */
body.popup-open {
    overflow: hidden;
    padding-right: 0px; /* Éviter le jump de scrollbar */
}


/* Animation de fermeture améliorée */
.popup-overlay.closing {
    opacity: 0;
    backdrop-filter: blur(0px);
    transition: all 0.3s ease-out;
}

.popup-overlay.closing .popup-content {
    transform: scale(0.95) translateY(20px);
    opacity: 0;
}

/* Effet de particules pour le fond (optionnel) */
.popup-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(14, 165, 233, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.dark .popup-content::after {
    background: 
        radial-gradient(circle at 20% 20%, rgba(14, 165, 233, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 50%);
}

/* Ajustements pour les bordures décoratives existantes */
.popup-content .absolute.-inset-3 {
    opacity: 0.6;
    filter: blur(1px);
}

/* Style amélioré pour les étapes */
.popup-content .relative.inline-flex.items-center.justify-center.gap-4 {
    margin-bottom: 2rem;
}

/* Amélioration des transitions globales */
.popup-content * {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ================================================
   PROSPECTS POPUP MOBILE FIXES - Corrections spécifiques
   ================================================ */

/* Corrections pour mobile - Surcharge les styles Tailwind problématiques */
@media (max-width: 768px) {
    
    /* Overlay principal - Réduction du padding et centrage */
    .popup-overlay {
        padding: 0.5rem !important;
        background: rgba(0, 0, 0, 0.9) !important; /* Plus opaque sur mobile */
        backdrop-filter: blur(8px) !important;
    }
    
    /* Contenu popup - Taille adaptée mobile */
    .popup-content {
        max-width: calc(100vw - 1rem) !important;
        width: calc(100vw - 1rem) !important;
        max-height: calc(100vh - 2rem) !important;
        margin: 0 !important;
        border-radius: 16px !important;
        overflow-y: auto !important;
        /* Surcharge du background pour éviter les problèmes de contraste */
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(20px) !important;
    }
    
    .dark .popup-content {
        background: rgba(30, 41, 59, 0.98) !important;
        color: #f8fafc !important;
    }
    
    /* Padding interne réduit sur mobile */
    .popup-inner {
        padding: 1.5rem 1rem !important;
    }
    
    /* Suppression des bordures décoratives complexes sur mobile */
    .popup-content .absolute.-inset-3 {
        display: none !important;
    }
    
    /* Suppression des pseudo-éléments qui causent des problèmes */
    .popup-content .relative.inline-flex.items-center.justify-center.gap-4:before,
    .popup-content .relative.inline-flex.items-center.justify-center.gap-4:after {
        display: none !important;
    }
    
    /* Headers - Tailles réduites */
    .popup-content h3 {
        font-size: 1.25rem !important; /* text-xl -> text-lg */
        line-height: 1.75rem !important;
        margin-bottom: 1rem !important;
        /* Assurer une couleur visible */
        color: #1f2937 !important;
    }
    
    .dark .popup-content h3 {
        color: #f9fafb !important;
    }
    
    /* Badge "Étape X sur Y" - Simplifié sur mobile */
    .popup-content .relative.text-sm.font-medium {
        padding: 0.5rem 1rem !important;
        margin-bottom: 1rem !important;
        border-radius: 8px !important;
        background: rgba(99, 102, 241, 0.1) !important;
        border: 1px solid rgba(99, 102, 241, 0.2) !important;
        display: inline-block !important;
    }
    
    .dark .popup-content .relative.text-sm.font-medium {
        background: rgba(99, 102, 241, 0.2) !important;
        border: 1px solid rgba(99, 102, 241, 0.3) !important;
        color: #cbd5e1 !important;
    }
    
    /* Forms - Inputs plus accessibles sur mobile */
    .popup-content .form-select,
    .popup-content input[type="email"],
    .popup-content input[type="text"],
    .popup-content textarea {
        width: 100% !important;
        padding: 0.875rem 1rem !important; /* py-3.5 px-4 */
        font-size: 1rem !important;
        border-radius: 12px !important;
        border: 2px solid rgba(203, 213, 225, 0.5) !important;
        background-color: rgba(255, 255, 255, 0.95) !important;
        margin-bottom: 0.75rem !important;
        /* Focus amélioré pour mobile */
        transition: all 0.2s ease !important;
    }
    
    .dark .popup-content .form-select,
    .dark .popup-content input[type="email"],
    .dark .popup-content input[type="text"],
    .dark .popup-content textarea {
        background-color: rgba(51, 65, 85, 0.9) !important;
        border-color: rgba(71, 85, 105, 0.5) !important;
        color: #f8fafc !important;
    }
    
    .popup-content .form-select:focus,
    .popup-content input:focus,
    .popup-content textarea:focus {
        border-color: #6366f1 !important;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
        outline: none !important;
    }
    
    /* Select dropdown - Icône visible sur mobile */
    .popup-content .form-select {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3e%3c/path%3e%3c/svg%3e") !important;
        background-position: right 1rem center !important;
        background-repeat: no-repeat !important;
        background-size: 1.25rem !important;
        padding-right: 3rem !important;
        appearance: none !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
    }
    
    .dark .popup-content .form-select {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23d1d5db'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3e%3c/path%3e%3c/svg%3e") !important;
    }
    
    /* Checkboxes - Taille augmentée pour mobile */
    .popup-content .form-checkbox {
        width: 1.25rem !important;
        height: 1.25rem !important;
        min-width: 1.25rem !important;
        margin-right: 0.75rem !important;
        border-width: 2px !important;
        cursor: pointer !important;
    }
    
    /* Labels et textes - Meilleure lisibilité */
    .popup-content label {
        font-size: 0.875rem !important;
        line-height: 1.25rem !important;
        color: #374151 !important;
        cursor: pointer !important;
    }
    
    .dark .popup-content label {
        color: #d1d5db !important;
    }
    
    /* Textarea spécifique */
    .popup-content textarea {
        min-height: 100px !important;
        resize: vertical !important;
        font-family: inherit !important;
    }
    
    /* Container avec icône pour les inputs */
    .popup-content .relative:has(input) {
        position: relative !important;
    }
    
    .popup-content .relative:has(input) .absolute {
        position: absolute !important;
        left: 1rem !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        color: #6b7280 !important;
        pointer-events: none !important;
    }
    
    .dark .popup-content .relative:has(input) .absolute {
        color: #9ca3af !important;
    }
    
    /* Input avec icône - padding ajusté */
    .popup-content .relative:has(.absolute) input {
        padding-left: 2.75rem !important;
    }
    
    /* Boutons - Design adapté mobile */
    .popup-content .flex.justify-between {
        flex-direction: column !important;
        gap: 0.75rem !important;
        margin-top: 1.5rem !important;
        padding-top: 1rem !important;
        border-top: 1px solid rgba(229, 231, 235, 0.5) !important;
    }
    
    .dark .popup-content .flex.justify-between {
        border-top-color: rgba(75, 85, 99, 0.5) !important;
    }
    
    .popup-content button {
        width: 100% !important;
        padding: 0.875rem 1.5rem !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        border-radius: 12px !important;
        transition: all 0.2s ease !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
        min-height: 44px !important; /* Touch target minimum */
    }
    
    /* Bouton principal */
    .popup-content button[type="submit"] {
        background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
        color: white !important;
        border: none !important;
        box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3) !important;
        order: 1 !important; /* Afficher en premier sur mobile */
    }
    
    .popup-content button[type="submit"]:hover,
    .popup-content button[type="submit"]:active {
        background: linear-gradient(135deg, #4338ca, #4f46e5) !important;
        box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4) !important;
        transform: translateY(-1px) !important;
    }
    
    /* Bouton secondaire */
    .popup-content .btn-sm:not([type="submit"]) {
        background: rgba(156, 163, 175, 0.2) !important;
        color: #6b7280 !important;
        border: 1px solid rgba(156, 163, 175, 0.3) !important;
        order: 2 !important;
    }
    
    .dark .popup-content .btn-sm:not([type="submit"]) {
        background: rgba(75, 85, 99, 0.3) !important;
        color: #d1d5db !important;
        border-color: rgba(75, 85, 99, 0.5) !important;
    }
    
    .popup-content .btn-sm:not([type="submit"]):hover,
    .popup-content .btn-sm:not([type="submit"]):active {
        background: rgba(156, 163, 175, 0.3) !important;
        transform: translateY(-1px) !important;
    }
    
    /* Messages d'erreur - Style mobile */
    .popup-content .error-message {
        font-size: 0.875rem !important;
        padding: 0.75rem !important;
        border-radius: 8px !important;
        margin-top: 0.5rem !important;
        background: rgba(248, 113, 113, 0.1) !important;
        border: 1px solid rgba(248, 113, 113, 0.2) !important;
        color: #dc2626 !important;
    }
    
    .dark .popup-content .error-message {
        background: rgba(248, 113, 113, 0.2) !important;
        border-color: rgba(248, 113, 113, 0.3) !important;
        color: #fca5a5 !important;
    }
    
    /* Grilles et listes - Stack sur mobile */
    .popup-content .grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    /* Checkbox containers - Meilleur espacement mobile */
    .popup-content .flex.items-start {
        padding: 0.75rem !important;
        border-radius: 8px !important;
        margin-bottom: 0.5rem !important;
        background: rgba(249, 250, 251, 0.5) !important;
        border: 1px solid rgba(229, 231, 235, 0.3) !important;
        transition: all 0.2s ease !important;
    }
    
    .dark .popup-content .flex.items-start {
        background: rgba(51, 65, 85, 0.3) !important;
        border-color: rgba(75, 85, 99, 0.3) !important;
    }
    
    .popup-content .flex.items-start:hover {
        background: rgba(239, 246, 255, 0.8) !important;
        border-color: rgba(99, 102, 241, 0.3) !important;
        transform: none !important; /* Pas de transform sur mobile */
    }
    
    .dark .popup-content .flex.items-start:hover {
        background: rgba(51, 65, 85, 0.5) !important;
        border-color: rgba(99, 102, 241, 0.4) !important;
    }
    
    /* Textes dans les checkboxes */
    .popup-content .flex.items-start .text-sm {
        font-size: 0.875rem !important;
        line-height: 1.375rem !important;
        color: #374151 !important;
    }
    
    .dark .popup-content .flex.items-start .text-sm {
        color: #d1d5db !important;
    }
    
    /* Correction pour les spans dans les boutons */
    .popup-content button span {
        display: inline !important;
        margin-left: 0.25rem !important;
    }
    
    /* Masquer les éléments décoratifs complexes */
    .popup-content .absolute.inset-0,
    .popup-content .absolute.-inset-3,
    .popup-content .absolute.inset-y-0 {
        display: none !important;
    }
    
    /* S'assurer que le popup est scrollable si nécessaire */
    .popup-overlay {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Animation simplifiée sur mobile */
    .popup-content {
        transform: scale(0.95) translateY(20px) !important;
    }
    
    .popup-overlay.active .popup-content {
        transform: scale(1) translateY(0) !important;
    }
}

/* Corrections additionnelles pour très petits écrans */
@media (max-width: 480px) {
    .popup-content {
        border-radius: 12px !important;
    }
    
    .popup-inner {
        padding: 1.25rem 0.75rem !important;
    }
    
    .popup-content h3 {
        font-size: 1.125rem !important; /* Plus petit sur très petits écrans */
        text-align: center !important;
    }
    
    .popup-content button {
        font-size: 0.875rem !important;
        padding: 0.75rem 1rem !important;
    }
}

/* Correction pour les problèmes de z-index sur mobile */
@media (max-width: 768px) {
    .popup-overlay {
        z-index: 9999 !important;
    }
    
    .popup-content {
        z-index: 10000 !important;
        position: relative !important;
    }
    
    .popup-inner {
        z-index: 10001 !important;
        position: relative !important;
    }
    
    /* S'assurer que tout le contenu est visible */
    .popup-content * {
        position: relative !important;
        z-index: auto !important;
    }
}