/**
 * Popup Coupon - Estilos
 *
 * Diseño responsivo y elegante adaptado a The One Pro Therapy
 * Mobile-first approach con soporte completo para tablets y desktop
 *
 * @version 1.0.0
 */

/* ================================================
   OVERLAY
   ================================================ */

.popup-coupon-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;

    /* Estado inicial (oculto) */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-coupon-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ================================================
   CONTENEDOR DEL POPUP
   ================================================ */

.popup-coupon-container {
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto; /* Permitir scroll vertical */
    overflow-x: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;

    /* Animación de entrada */
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-coupon-container.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Smooth scroll */
.popup-coupon-container {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Smooth scroll en iOS */
}

/* Scrollbar personalizado (Chrome, Safari, Edge) */
.popup-coupon-container::-webkit-scrollbar {
    width: 8px;
}

.popup-coupon-container::-webkit-scrollbar-track {
    background: #F5F5F5;
}

.popup-coupon-container::-webkit-scrollbar-thumb {
    background: #BF8924;
    border-radius: 4px;
}

.popup-coupon-container::-webkit-scrollbar-thumb:hover {
    background: #A67820;
}

/* Scrollbar para Firefox */
.popup-coupon-container {
    scrollbar-width: thin;
    scrollbar-color: #BF8924 #F5F5F5;
}

/* ================================================
   CONTENIDO WRAPPER (SPLIT LAYOUT)
   ================================================ */

.popup-content-wrapper {
    display: flex;
    flex-direction: column;
    min-height: auto; /* Ajustar automáticamente en móvil */
}

/* Desktop: layout horizontal */
@media (min-width: 768px) {
    .popup-content-wrapper {
        flex-direction: row;
        min-height: 500px;
    }
}

/* ================================================
   BOTÓN DE CERRAR
   ================================================ */

.popup-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    font-size: 18px;
    color: #333;
}

.popup-close-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.popup-close-btn:active {
    transform: scale(0.95);
}

/* ================================================
   LADO DEL FORMULARIO
   ================================================ */

.popup-form-side {
    flex: 1;
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #FDF8E8;
}

@media (min-width: 768px) {
    .popup-form-side {
        padding: 50px 40px;
    }
}

.popup-form-content {
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

/* ================================================
   HEADER (TÍTULO)
   ================================================ */

.popup-header {
    text-align: center;
    margin-bottom: 20px;
}

.popup-title {
    font-family: 'Playfair Display', serif;
    font-size: 48px;
    font-weight: 700;
    color: #261C14;
    margin: 0;
    line-height: 1;
    letter-spacing: 2px;
}

@media (min-width: 768px) {
    .popup-title {
        font-size: 64px;
    }
}

.popup-subtitle {
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #261C14;
    margin: 10px 0 0 0;
    letter-spacing: 1px;
}

@media (min-width: 768px) {
    .popup-subtitle {
        font-size: 20px;
    }
}

.popup-subheading {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin: 5px 0 0 0;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* ================================================
   DESCRIPCIÓN
   ================================================ */

.popup-description {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    color: #555;
    line-height: 1.6;
    text-align: center;
    margin: 0 0 25px 0;
}

@media (min-width: 768px) {
    .popup-description {
        font-size: 14px;
    }
}

/* ================================================
   FORMULARIO
   ================================================ */

.popup-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.popup-form-group {
    display: flex;
    flex-direction: column;
}

.popup-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #E0D5B7;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    color: #333;
    background: white;
    transition: all 0.2s ease;
}

.popup-input:focus {
    outline: none;
    border-color: #BF8924;
    box-shadow: 0 0 0 3px rgba(191, 137, 36, 0.1);
}

.popup-input::placeholder {
    color: #999;
}

/* ================================================
   GÉNERO (CHECKBOXES)
   ================================================ */

.popup-gender-group {
    gap: 10px;
}

.popup-gender-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    color: #555;
    margin-bottom: 8px;
    text-align: center;
}

.popup-checkboxes {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.popup-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: #333;
    user-select: none;
}

.popup-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #BF8924;
}

.popup-checkbox-label:hover {
    color: #BF8924;
}

/* ================================================
   MENSAJES DE ERROR
   ================================================ */

.popup-error-message {
    display: none;
    padding: 12px 16px;
    background: #FEE;
    border: 1px solid #FCC;
    border-radius: 6px;
    color: #C33;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    text-align: center;
}

/* ================================================
   BOTÓN DE ENVÍO
   ================================================ */

.popup-submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #D4A356 0%, #BF8924 100%);
    border: none;
    border-radius: 50px;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(191, 137, 36, 0.3);
    position: relative;
    overflow: hidden;
}

.popup-submit-btn:hover {
    background: linear-gradient(135deg, #BF8924 0%, #A67820 100%);
    box-shadow: 0 6px 20px rgba(191, 137, 36, 0.4);
    transform: translateY(-2px);
}

.popup-submit-btn:active {
    transform: translateY(0);
}

.popup-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Estados del botón */
.popup-btn-text,
.popup-btn-loader {
    transition: opacity 0.2s ease;
}

.popup-btn-loader {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.popup-submit-btn.loading .popup-btn-text {
    opacity: 0;
}

.popup-submit-btn.loading .popup-btn-loader {
    opacity: 1;
}

/* ================================================
   ESTADO DE ÉXITO
   ================================================ */

.popup-success-state {
    display: none;
    text-align: center;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-success-icon {
    font-size: 64px;
    color: #4CAF50;
    margin-bottom: 20px;
}

.popup-success-title {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 700;
    color: #261C14;
    margin: 0 0 15px 0;
}

.popup-success-message {
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    color: #555;
    margin: 0 0 25px 0;
    line-height: 1.6;
}

/* ================================================
   CÓDIGO DE CUPÓN
   ================================================ */

.popup-coupon-code {
    background: white;
    border: 2px dashed #BF8924;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.popup-coupon-label {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.popup-coupon-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

#popup-coupon-code-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #BF8924;
    letter-spacing: 3px;
}

.popup-copy-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #BF8924;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.popup-copy-btn:hover {
    background: #A67820;
    transform: scale(1.1);
}

.popup-copy-btn:active {
    transform: scale(0.95);
}

/* ================================================
   LADO DE LA IMAGEN
   ================================================ */

.popup-image-side {
    flex: 1;
    min-height: 250px;
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .popup-image-side {
        min-height: auto;
    }
}

.popup-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* ================================================
   RESPONSIVE - MOBILE
   ================================================ */

@media (max-width: 640px) {
    .popup-coupon-overlay {
        padding: 15px; /* Espacio alrededor del modal */
        align-items: center; /* Centrado vertical */
    }

    .popup-coupon-container {
        border-radius: 12px; /* Bordes suaves */
        max-height: 85vh; /* No ocupar toda la pantalla */
        margin: 0;
    }

    .popup-content-wrapper {
        display: flex;
        flex-direction: column; /* Vertical en móvil */
    }

    .popup-form-side {
        padding: 25px 20px;
        order: 2; /* Formulario abajo */
    }

    .popup-image-side {
        order: 1; /* Imagen arriba */
        min-height: 180px;
        max-height: 180px;
        flex-shrink: 0; /* No reducir */
    }

    .popup-title {
        font-size: 36px;
    }

    .popup-subtitle {
        font-size: 15px;
    }

    .popup-description {
        font-size: 12px;
        margin-bottom: 20px;
    }

    .popup-input {
        padding: 12px 16px;
        font-size: 14px;
    }

    .popup-submit-btn {
        padding: 14px 20px;
        font-size: 14px;
    }

    .popup-checkboxes {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .popup-coupon-code {
        padding: 15px;
    }

    #popup-coupon-code-text {
        font-size: 22px;
    }

    .popup-close-btn {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 16px;
        z-index: 20; /* Por encima de la imagen */
    }
}

/* Móvil muy pequeño (< 400px) */
@media (max-width: 400px) {
    .popup-coupon-overlay {
        padding: 10px; /* Menos padding en pantallas muy pequeñas */
    }

    .popup-coupon-container {
        max-height: 90vh; /* Un poco más de espacio */
    }

    .popup-form-side {
        padding: 20px 15px;
    }

    .popup-title {
        font-size: 32px;
    }

    .popup-subtitle {
        font-size: 14px;
    }

    .popup-image-side {
        min-height: 160px; /* Un poco más grande que antes */
        max-height: 160px;
    }

    .popup-header {
        margin-bottom: 15px;
    }

    .popup-description {
        margin-bottom: 15px;
    }

    .popup-form {
        gap: 12px;
    }
}

/* ================================================
   ACCESIBILIDAD
   ================================================ */

.popup-close-btn:focus-visible,
.popup-submit-btn:focus-visible,
.popup-copy-btn:focus-visible {
    outline: 2px solid #BF8924;
    outline-offset: 2px;
}

.popup-input:focus-visible {
    outline: none;
    border-color: #BF8924;
    box-shadow: 0 0 0 3px rgba(191, 137, 36, 0.2);
}

/* Reducir animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
    .popup-coupon-overlay,
    .popup-coupon-container,
    .popup-close-btn,
    .popup-submit-btn,
    .popup-copy-btn,
    .popup-input {
        transition: none;
        animation: none;
    }
}

/* ================================================
   MODO OSCURO (OPCIONAL)
   ================================================ */

@media (prefers-color-scheme: dark) {
    .popup-form-side {
        background: #2D2416;
    }

    .popup-title,
    .popup-subtitle {
        color: #F5F5F5;
    }

    .popup-subheading,
    .popup-description,
    .popup-gender-label {
        color: #CCC;
    }

    .popup-input {
        background: #3A2E1C;
        border-color: #5A4E3C;
        color: #F5F5F5;
    }

    .popup-input::placeholder {
        color: #888;
    }

    .popup-checkbox-label {
        color: #DDD;
    }

    .popup-coupon-code {
        background: #3A2E1C;
        border-color: #D4A356;
    }

    .popup-success-title {
        color: #F5F5F5;
    }

    .popup-success-message {
        color: #CCC;
    }
}

/* ================================================
   PRINT (OCULTAR EN IMPRESIÓN)
   ================================================ */

@media print {
    .popup-coupon-overlay {
        display: none !important;
    }
}
