/* ============================================
   POPUP PROFESIONAL MODERNO - AutoFrenos
   Diseño rectangular con imagen personalizable
   ============================================ */

/* OVERLAY OSCURO PROFESIONAL */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* CONTENEDOR PRINCIPAL - RECTANGULAR MODERNO */
.popup-content {
    background: #ffffff;
    border-radius: 24px;
    max-width: 1000px; /* Más ancho para mejor visualización */
    width: 92%;
    max-height: 90vh;
    /* Usar la misma tipografía que el sitio para todo el popup */
    font-family: 'Segoe UI', 'Segoe UI Symbol' !important;
    color: var(--text-primary, #0b1220);
    overflow: hidden;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 0, 0, 0.1);
    transform: scale(0.9) translateY(20px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.popup-overlay.show .popup-content {
    transform: scale(1) translateY(0);
}

/* BOTÓN CERRAR ELEGANTE */
.popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.popup-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
    border-color: rgba(255, 255, 255, 0.3);
}

.popup-close svg {
    stroke-width: 2.5;
}

/* LAYOUT CON/SIN IMAGEN */
.popup-layout {
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    max-height: 85vh;
    overflow: hidden;
}

.popup-content.with-image .popup-layout {
    grid-template-columns: 45% 55%; /* Balance entre imagen y contenido */
}

.popup-content.no-image .popup-layout {
    grid-template-columns: 1fr; /* Sin imagen, contenido ocupa todo */
    max-width: 600px; /* Limitar ancho cuando no hay imagen */
    margin: 0 auto;
}

/* SECCIÓN DE IMAGEN */
.popup-image-section {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: stretch;
    justify-content: center;
    min-height: 500px;
    padding: 0; /* Sin padding para que la imagen ocupe todo */
}

.popup-promo-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cambio de contain a cover para llenar todo el espacio */
    object-position: center;
    display: block;
    border-radius: 0; /* Sin bordes redondeados en la imagen */
    box-shadow: none; /* Sin sombra */
}

/* SECCIÓN DE CONTENIDO */
.popup-content-section {
    padding: 32px 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px; /* Reducir gap para mejor aprovechamiento */
    overflow-y: auto;
    height: auto; /* Auto para ajustarse al contenido */
}

/* HEADER DE TEXTO */
.popup-header-text {
    text-align: center;
}

.popup-title {
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 12px 0;
    line-height: 1.2;
    font-family: inherit; /* Asegurar que usa la tipografía global del popup */
}

.popup-subtitle {
    font-size: 16px;
    color: #64748b;
    margin: 0;
    font-weight: 500;
}

/* CONTADOR MODERNO */
.countdown-timer {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.countdown-label {
    font-size: 13px;
    font-weight: 800;
    color: #92400e;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}

.countdown-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.countdown-segment {
    background: white;
    border-radius: 12px;
    padding: 12px 16px;
    min-width: 70px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.countdown-number {
    font-size: 36px;
    font-weight: 900;
    color: #dc2626;
    line-height: 1;
    font-family: 'Segoe UI', 'Segoe UI Symbol' !important;
}

.countdown-unit {
    font-size: 11px;
    color: #78350f;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 4px;
}

.countdown-separator {
    font-size: 32px;
    font-weight: 900;
    color: #92400e;
}

/* MENSAJE DE URGENCIA */
.urgency-message {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-left: 4px solid #dc2626;
    border-radius: 12px;
    padding: 16px 20px;
    font-size: 15px;
    color: #991b1b;
    font-weight: 600;
    line-height: 1.5;
}

/* SECCIONES DE CONTENIDO */
.section-title {
    font-size: 28px; /* Aumentado para que coincida visualmente con el título superior */
    font-weight: 900;
    color: var(--primary-900, #1e293b);
    margin: 0 0 18px 0;
    display: block;
    text-align: center; /* Centrar el título inferior */
    font-family: inherit; /* Usar la misma tipografía que el popup */
    letter-spacing: 0.2px;
}

/* DESCUENTOS GRID */
.dynamic-discounts {
    margin-bottom: 16px; /* Reducir margen */
}

/* Grid para descuento único - CENTRADO */
.discounts-grid-single {
    display: flex;
    justify-content: center;
    align-items: center;
}

.discounts-grid-single .discount-card {
    max-width: 320px;
    width: 100%;
}

/* Grid para múltiples descuentos */
.discounts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* Grid de 3 descuentos - 2 arriba, 1 centrado abajo */
.discounts-grid:has(.discount-card:nth-child(3):last-child) {
    grid-template-columns: repeat(2, 1fr);
}

.discounts-grid .discount-card:nth-child(3):last-child {
    grid-column: 1 / -1;
    max-width: 320px;
    margin: 0 auto;
}

/* Grid de 5+ descuentos - 3 columnas en desktop */
@media (min-width: 900px) {
    .discounts-grid:has(.discount-card:nth-child(5)) {
        grid-template-columns: repeat(3, 1fr);
    }
}

.discount-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #bae6fd;
    border-radius: 12px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.discount-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
}

.discount-badge {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    font-size: 28px;
    font-weight: 900;
    padding: 10px 18px;
    border-radius: 10px;
    display: inline-block;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    min-width: 80px;
}

.discount-info {
    margin-top: 8px;
}

.discount-description {
    font-size: 15px;
    color: #1e40af;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

/* BOTONES DE ACCIÓN */
.popup-actions {
    margin-top: 24px;
}

.btn-primary-popup {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}

.btn-primary-popup:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.4);
}

/* FOOTER CHECKBOX */
.popup-footer-checkbox {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.dont-show-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #64748b;
    cursor: pointer;
    user-select: none;
}

.dont-show-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.dont-show-checkbox:hover span {
    color: #334155;
}

/* SCROLLBAR PERSONALIZADO */
.popup-content-section::-webkit-scrollbar {
    width: 6px;
}

.popup-content-section::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.popup-content-section::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.popup-content-section::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================
   CONTADOR MINIMALISTA (MINIMIZADO)
   ============================================ */
.minimized-timer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 60px;
    padding: 14px 24px;
    box-shadow: 
        0 8px 32px rgba(59, 130, 246, 0.4),
        0 0 0 1px rgba(59, 130, 246, 0.2);
    cursor: pointer;
    z-index: 99998;
    opacity: 0;
    transform: translateY(100px) scale(0.8);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.minimized-timer.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.minimized-timer:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 12px 40px rgba(59, 130, 246, 0.5),
        0 0 0 1px rgba(59, 130, 246, 0.3);
}

.mini-timer-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.mini-timer-icon {
    font-size: 22px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.mini-timer-display {
    font-family: 'Segoe UI', 'Segoe UI Symbol' !important;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .popup-content {
        width: 95%;
        max-height: 95vh;
        border-radius: 20px;
    }

    .popup-content.with-image .popup-layout {
        grid-template-columns: 1fr;
        height: auto;
        max-height: 95vh;
    }

    .popup-image-section {
        height: 280px; /* Más alto en móvil */
        min-height: 280px;
    }
    
    .popup-promo-image {
        width: 100%;
        height: 100%;
        object-fit: cover; /* Mantener cover en móvil */
    }

    .popup-content-section {
        padding: 24px 20px 20px;
        gap: 16px;
    }

    .popup-title {
        font-size: 24px;
    }

    .popup-subtitle {
        font-size: 14px;
    }

    .countdown-number {
        font-size: 28px;
    }

    .countdown-segment {
        min-width: 60px;
        padding: 10px 14px;
    }

    .discounts-grid,
    .discounts-grid-single {
        grid-template-columns: 1fr; /* 1 columna en móvil */
    }
    
    .discounts-grid-single .discount-card {
        max-width: 100%;
    }

    .minimized-timer {
        bottom: 16px;
        right: 16px;
        padding: 12px 20px;
    }

    .mini-timer-icon {
        font-size: 20px;
    }

    .mini-timer-display {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .popup-title {
        font-size: 22px;
    }

    .countdown-display {
        gap: 6px;
    }

    .countdown-number {
        font-size: 24px;
    }

    .btn-primary-popup {
        font-size: 15px;
        padding: 14px 24px;
    }
}
