/**
 * PWA for WP - CTA Pop-up Styles
 * 
 * Estilos para los pop-ups de Call-to-Action
 * Soporta iOS, Android y Desktop
 * 
 * @version 1.0.0
 */

/* Contenedor principal del pop-up */
.pwaforwp-cta-popup {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    animation: pwaforwp-cta-fadeIn 0.3s ease-in-out;
    padding: 20px;
    box-sizing: border-box;
}

.pwaforwp-cta-popup.active {
    display: flex;
}

/* Card del pop-up */
.pwaforwp-cta-popup__card {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 24px 20px;
    max-width: 100%;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: pwaforwp-cta-slideUp 0.4s ease-out;
}

/* Media queries para desktop */
@media (min-width: 480px) {
    .pwaforwp-cta-popup__card {
        width: 400px;
        max-width: calc(100vw - 40px);
    }
}

/* Icono de la app */
.pwaforwp-cta-popup__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 20px;
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pwaforwp-cta-popup__icon img {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    object-fit: cover;
}

/* Títulos y textos */
.pwaforwp-cta-popup__title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 12px 0;
    text-align: center;
    line-height: 1.3;
}

.pwaforwp-cta-popup__description {
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 24px 0;
    text-align: center;
    opacity: 0.7;
}

/* Contenedor de botones */
.pwaforwp-cta-popup__buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

/* Botón principal (instalar) */
.pwaforwp-cta-popup__button-primary,
.pwaforwp-cta-popup__button-secondary {
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.pwaforwp-cta-popup__button-primary {
    background-color: #3498db;
    color: #FFFFFF;
}

.pwaforwp-cta-popup__button-primary:hover,
.pwaforwp-cta-popup__button-primary:active {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.pwaforwp-cta-popup__button-secondary {
    background-color: transparent;
    color: #3498db;
    border: 1px solid #E0E0E0;
}

.pwaforwp-cta-popup__button-secondary:hover,
.pwaforwp-cta-popup__button-secondary:active {
    background-color: #F5F5F5;
    border-color: #3498db;
}

/* Botón de cerrar (X) */
.pwaforwp-cta-popup__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #999;
    transition: color 0.2s ease;
}

.pwaforwp-cta-popup__close:hover {
    color: #333;
}

/* Sección de instrucciones para iOS */
.pwaforwp-cta-popup__ios-instructions {
    display: none;
    margin-top: 20px;
    padding: 16px;
    background: #F0F4F8;
    border-radius: 8px;
}

.pwaforwp-cta-popup__ios-instructions.active {
    display: block;
}

.pwaforwp-cta-popup__ios-instructions-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.pwaforwp-cta-popup__ios-instructions-steps {
    font-size: 13px;
    line-height: 1.8;
    color: #666;
}

.pwaforwp-cta-popup__ios-instructions-steps ol {
    margin: 0;
    padding-left: 20px;
}

.pwaforwp-cta-popup__ios-instructions-steps li {
    margin-bottom: 8px;
}

.pwaforwp-cta-popup__ios-instructions-steps strong {
    color: #333;
    font-weight: 600;
}

/* Badge de características (opcional) */
.pwaforwp-cta-popup__features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    font-size: 13px;
    color: #666;
}

.pwaforwp-cta-popup__feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwaforwp-cta-popup__feature-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4CAF50;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

/* Notificaciones in-app (para iOS) */
.pwaforwp-ios-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    text-align: center;
    z-index: 999998;
    animation: pwaforwp-slideDown 0.4s ease-out;
}

.pwaforwp-ios-notification__title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.pwaforwp-ios-notification__close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
}

/* Loading state */
.pwaforwp-cta-popup__button-primary.loading,
.pwaforwp-cta-popup__button-secondary.loading {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

.pwaforwp-cta-popup__button-primary.loading::after,
.pwaforwp-cta-popup__button-secondary.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #FFFFFF;
    animation: pwaforwp-spin 0.8s linear infinite;
}

/* Animations */
@keyframes pwaforwp-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pwaforwp-slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pwaforwp-slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pwaforwp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive para tablets */
@media (min-width: 600px) {
    .pwaforwp-cta-popup__card {
        padding: 32px 28px;
        border-radius: 16px;
    }

    .pwaforwp-cta-popup__title {
        font-size: 24px;
    }

    .pwaforwp-cta-popup__description {
        font-size: 15px;
    }
}

/* Soporte para safe area (iOS con notch) */
@supports (padding: max(0px)) {
    .pwaforwp-cta-popup {
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }

    .pwaforwp-ios-notification {
        padding-top: max(16px, env(safe-area-inset-top));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}

/* Tema oscuro (responder a preferencia del usuario) */
@media (prefers-color-scheme: dark) {
    .pwaforwp-cta-popup__card {
        background: #1e1e1e;
        color: #f5f5f5;
    }

    .pwaforwp-cta-popup__title {
        color: #f5f5f5;
    }

    .pwaforwp-cta-popup__description {
        color: #b0b0b0;
    }

    .pwaforwp-cta-popup__ios-instructions {
        background: #2a2a2a;
    }

    .pwaforwp-cta-popup__ios-instructions-title {
        color: #f5f5f5;
    }

    .pwaforwp-cta-popup__ios-instructions-steps {
        color: #b0b0b0;
    }

    .pwaforwp-cta-popup__button-secondary {
        border-color: #4a4a4a;
        color: #3498db;
    }

    .pwaforwp-cta-popup__button-secondary:hover {
        background-color: #2a2a2a;
    }

    .pwaforwp-cta-popup__close {
        color: #999;
    }

    .pwaforwp-cta-popup__close:hover {
        color: #f5f5f5;
    }
}

/* Reducir animaciones para usuarios con preferencia */
@media (prefers-reduced-motion: reduce) {
    .pwaforwp-cta-popup,
    .pwaforwp-cta-popup__card,
    .pwaforwp-ios-notification,
    .pwaforwp-cta-popup__button-primary,
    .pwaforwp-cta-popup__button-secondary {
        animation: none !important;
        transition: none !important;
    }
}
