/**
 * Styles pour le système de popups publicitaires
 * Compatible avec le nouveau système simplifié
 */

/* Overlay principal */
.popup-ad-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-ad-overlay.show {
    opacity: 1;
}

/* Conteneur du popup */
.popup-ad-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 550px;
    min-width: 320px;
    width: 95vw;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease;
}

.popup-ad-overlay.show .popup-ad-container {
    transform: scale(1) translateY(0);
}

/* Header du popup */
.popup-ad-header {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.popup-close-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.popup-close-btn:hover {
    background: rgba(255, 255, 255, 1);
}

/* Contenu du popup */
.popup-ad-content {
    position: relative;
    width: 100%;
    height: auto;
}

.popup-ad-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px 16px 0 0;
}

.popup-ad-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.popup-ad-link:hover {
    text-decoration: none;
}

/* Section newsletter */
.popup-newsletter-section {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.popup-newsletter-section h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.popup-newsletter-section p {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

/* Formulaire newsletter */
.popup-newsletter-form {
    margin-top: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Messages de succès/erreur */
.newsletter-success,
.newsletter-error {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
}

.newsletter-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.newsletter-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.text-success {
    color: #155724;
}

.text-danger {
    color: #721c24;
}

/* Responsive design */
@media (max-width: 768px) {
    .popup-ad-container {
        width: 95vw;
        max-width: 95vw;
        margin: 2.5vh 2.5vw;
        border-radius: 12px;
    }

    .popup-ad-image {
        border-radius: 12px 12px 0 0;
    }

    .popup-newsletter-section {
        padding: 15px;
    }

    .popup-newsletter-section h3 {
        font-size: 16px;
    }

    .form-control {
        padding: 10px 12px;
        font-size: 16px; /* Évite le zoom sur iOS */
    }

    .btn {
        padding: 10px 20px;
        font-size: 16px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .popup-ad-container {
        width: 98vw;
        margin: 1vh 1vw;
    }

    .popup-newsletter-section {
        padding: 12px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
}

/* États de chargement */
.popup-ad-overlay.loading {
    pointer-events: none;
}

.popup-ad-overlay.loading .popup-ad-container {
    opacity: 0.7;
}

/* Accessibilité */
.popup-ad-overlay:focus {
    outline: none;
}

.popup-close-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Support pour les navigateurs plus anciens */
@supports not (backdrop-filter: blur(10px)) {
    .popup-ad-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
}

/* Support pour backdrop-filter (navigateurs modernes) */
@supports (backdrop-filter: blur(10px)) {
    .popup-ad-overlay {
        backdrop-filter: blur(10px);
        background: rgba(0, 0, 0, 0.6);
    }
}
