/**
 * Stock Alert Pro - Styles Frontend
 * Styles pour correspondre exactement aux maquettes fournies
 */

/* ===== CONTENEUR PRINCIPAL ===== */
.ct-product-waitlist {
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    padding: 24px !important;
    background: #ffffff !important;
    margin: 24px 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    position: relative !important;
}

/* ===== TITRE PRINCIPAL ===== */
.ct-waitlist-title {
    font-size: 24px !important;
    font-weight: 700 !important;
    margin: 0 0 16px 0 !important;
    color: #111827 !important;
    line-height: 1.3 !important;
    display: block !important;
}

.ct-waitlist-title .product-name {
    color: #111827 !important;
    font-weight: 700 !important;
}

.ct-waitlist-title .stock-status.prochainement {
    color: #059669 !important;
    font-weight: 700 !important;
}

.ct-waitlist-title .stock-status.rupture {
    color: #dc2626 !important;
    font-weight: 700 !important;
}

/* ===== SOUS-TITRE AVEC ICÔNE ===== */
.ct-waitlist-subtitle {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 0 16px 0 !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    color: #dc2626 !important;
}

.ct-waitlist-subtitle::before {
    content: "✉" !important;
    display: inline-block !important;
    width: 24px !important;
    height: 24px !important;
    background: #dc2626 !important;
    color: white !important;
    border-radius: 50% !important;
    text-align: center !important;
    line-height: 24px !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
}

/* Couleur verte pour "Prochainement disponible" */
.ct-product-waitlist.green-theme .ct-waitlist-subtitle {
    color: #059669 !important;
}

.ct-product-waitlist.green-theme .ct-waitlist-subtitle::before {
    background: #059669 !important;
}

/* ===== MESSAGE DESCRIPTIF ===== */
.ct-waitlist-message {
    font-size: 16px !important;
    color: #374151 !important;
    margin-bottom: 24px !important;
    line-height: 1.6 !important;
    font-weight: 400 !important;
}

/* ===== FORMULAIRE ===== */
.ct-waitlist-form-row {
    display: block !important; /* Block pour permettre le passage à la ligne */
    margin-bottom: 16px !important;
}

/* Container pour email + bouton sur la même ligne */
.ct-waitlist-email-button-row {
    display: flex !important;
    gap: 12px !important;
    align-items: stretch !important;
    margin-bottom: 16px !important;
}

/* Champ email - Plus large comme dans la maquette */
.ct-product-waitlist input[type="email"] {
    flex: 2 !important; /* Plus large que le bouton */
    padding: 14px 16px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    background: #ffffff !important;
    color: #111827 !important;
    font-family: inherit !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    min-height: 52px !important;
    box-sizing: border-box !important;
    min-width: 300px !important; /* Largeur minimale */
}

.ct-product-waitlist input[type="email"]:focus {
    outline: none !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.ct-product-waitlist input[type="email"]::placeholder {
    color: #9ca3af !important;
    font-style: italic !important;
}

/* Boutons d'inscription - Plus petit que le champ email */
.ct-product-waitlist button[type="submit"],
.ct-product-waitlist .ct-button {
    flex: 1 !important; /* Plus petit que le champ email */
    padding: 14px 24px !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: all 0.2s ease !important;
    min-height: 52px !important;
    color: white !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    max-width: 200px !important; /* Largeur maximale */
}

/* Bouton VERT pour "Prochainement disponible" */
.ct-product-waitlist.green-theme button[type="submit"],
.ct-product-waitlist.green-theme .ct-button {
    background: #22c55e !important;
}

.ct-product-waitlist.green-theme button[type="submit"]:hover,
.ct-product-waitlist.green-theme .ct-button:hover {
    background: #16a34a !important;
    transform: translateY(-1px) !important;
}

/* Bouton ROUGE pour "Rupture de stock" */
.ct-product-waitlist.red-theme button[type="submit"],
.ct-product-waitlist.red-theme .ct-button,
.ct-product-waitlist button[type="submit"],
.ct-product-waitlist .ct-button {
    background: #dc2626 !important;
}

.ct-product-waitlist.red-theme button[type="submit"]:hover,
.ct-product-waitlist.red-theme .ct-button:hover,
.ct-product-waitlist button[type="submit"]:hover,
.ct-product-waitlist .ct-button:hover {
    background: #b91c1c !important;
    transform: translateY(-1px) !important;
}

/* ===== CHECKBOX NEWSLETTER - VRAIMENT À LA LIGNE ===== */
.ct-newsletter-checkbox {
    display: block !important; /* Block pour être à la ligne */
    width: 100% !important; /* Prendre toute la largeur */
    margin: 16px 0 0 0 !important; /* Marge en haut seulement */
    font-size: 14px !important;
    color: #374151 !important;
    visibility: visible !important;
    opacity: 1 !important;
    clear: both !important; /* Force le passage à la ligne */
    float: none !important; /* Pas de flottement */
    position: relative !important;
}

.ct-newsletter-checkbox input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    margin: 0 8px 0 0 !important; /* Marge à droite seulement */
    cursor: pointer !important;
    accent-color: #3b82f6 !important;
    vertical-align: top !important; /* Alignement en haut */
    float: none !important;
    display: inline-block !important;
}

.ct-newsletter-checkbox label {
    margin: 0 !important;
    cursor: pointer !important;
    user-select: none !important;
    font-weight: 400 !important;
    color: #374151 !important;
    line-height: 1.4 !important;
    display: inline !important;
    vertical-align: top !important; /* Alignement en haut */
    width: auto !important;
    max-width: calc(100% - 26px) !important; /* Largeur max moins la checkbox */
}

/* Forcer le passage à la ligne après le formulaire */
.ct-waitlist-email-button-row + .ct-newsletter-checkbox {
    margin-top: 16px !important;
    clear: both !important;
    display: block !important;
}

/* ===== MESSAGES DE RÉSULTAT ===== */
.newsletter-result {
    margin-top: 12px !important;
    padding: 12px 16px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    display: none !important;
}

.newsletter-result.show {
    display: block !important;
}

.newsletter-result.success {
    background: #f0fdf4 !important;
    color: #166534 !important;
    border: 1px solid #bbf7d0 !important;
}

.newsletter-result.error {
    background: #fef2f2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca !important;
}

/* ===== LOADER CORRECTEMENT POSITIONNÉ ===== */
.ct-product-waitlist.loading {
    opacity: 0.7 !important;
    pointer-events: none !important;
}

.ct-product-waitlist.loading::after {
    content: "" !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 32px !important;
    height: 32px !important;
    border: 3px solid #f3f4f6 !important;
    border-top: 3px solid #3b82f6 !important;
    border-radius: 50% !important;
    animation: spin 1s linear infinite !important;
    z-index: 10 !important;
}

.ct-product-waitlist.loading::before {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border-radius: 12px !important;
    z-index: 9 !important;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .ct-product-waitlist {
        padding: 20px !important;
        margin: 16px 0 !important;
    }
    
    .ct-waitlist-title {
        font-size: 20px !important;
    }
    
    .ct-waitlist-form-row {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .ct-product-waitlist button[type="submit"],
    .ct-product-waitlist .ct-button {
        width: 100% !important;
    }
}

/* ===== ACCESSIBILITÉ ===== */
.ct-product-waitlist input[type="email"]:focus-visible,
.ct-product-waitlist button[type="submit"]:focus-visible,
.ct-product-waitlist .ct-button:focus-visible,
.ct-newsletter-checkbox input[type="checkbox"]:focus-visible {
    outline: 2px solid #3b82f6 !important;
    outline-offset: 2px !important;
}

@media (prefers-reduced-motion: reduce) {
    .ct-product-waitlist *,
    .ct-product-waitlist button[type="submit"],
    .ct-product-waitlist .ct-button {
        transition: none !important;
        animation: none !important;
    }
}

/* ===== FORCER L'AFFICHAGE DE LA CHECKBOX ===== */
.ct-newsletter-checkbox,
.ct-newsletter-checkbox * {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ===== STYLES SPÉCIFIQUES SELON LE STATUT ===== */
/* Thème vert pour "Prochainement disponible" */
.ct-product-waitlist[data-stock-status="prochainement"],
.ct-product-waitlist.green-theme {
    border-left: 4px solid #22c55e !important;
}

/* Thème rouge pour "Rupture de stock" */
.ct-product-waitlist[data-stock-status="rupture"],
.ct-product-waitlist.red-theme {
    border-left: 4px solid #dc2626 !important;
}

