/**
 * Estilos para manejo de navegadores in-app
 * Incluye modales, avisos y animaciones específicas
 */

/* Animaciones para modales */
@keyframes fadeIn {
    from { 
        opacity: 0; 
    }
    to { 
        opacity: 1; 
    }
}

@keyframes fadeOut {
    from { 
        opacity: 1; 
    }
    to { 
        opacity: 0; 
    }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideDown {
    from { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to { 
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
}

@keyframes pulse {
    0% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.05); 
    }
    100% { 
        transform: scale(1); 
    }
}

/* Clases para overlays y modales */
.in-app-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.in-app-modal-content {
    background: white;
    padding: 24px;
    border-radius: 16px;
    max-width: 360px;
    margin: 16px;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.in-app-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transition: left 0.5s;
}

.in-app-modal-content:hover::before {
    left: 100%;
}

/* Estilos para botones del modal */
.in-app-modal-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.in-app-modal-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.in-app-modal-btn.secondary {
    background: #6c757d;
}

.in-app-modal-btn.secondary:hover {
    background: #545b62;
}

/* Estilos para instrucciones */
.in-app-instructions {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 12px;
    margin: 16px 0;
    text-align: left;
    border-left: 4px solid #007bff;
}

.in-app-instructions-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 13px;
}

.in-app-instructions-steps {
    color: #6c757d;
    font-size: 12px;
    line-height: 1.4;
}

/* Toast notifications específicos */
.in-app-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10001;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: calc(100% - 32px);
    text-align: center;
}

.in-app-toast.success {
    background: #28a745;
}

.in-app-toast.warning {
    background: #ffc107;
    color: #333;
}

.in-app-toast.error {
    background: #dc3545;
}

/* Banner superior para navegadores in-app */
.in-app-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    font-size: 13px;
    text-align: center;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.in-app-banner.show {
    transform: translateY(0);
}

.in-app-banner-close {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ajustes responsive */
@media (max-width: 480px) {
    .in-app-modal-content {
        margin: 8px;
        padding: 20px;
        max-width: calc(100% - 16px);
    }
    
    .in-app-instructions {
        padding: 12px;
    }
    
    .in-app-toast {
        bottom: 16px;
        max-width: calc(100% - 24px);
        font-size: 13px;
        padding: 10px 16px;
    }
    
    .in-app-banner {
        font-size: 12px;
        padding: 10px 16px;
    }
}

/* Estados de carga */
.in-app-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s ease-in-out infinite;
}

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

/* Efectos especiales */
.in-app-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Mejoras para accesibilidad */
.in-app-modal-overlay[aria-hidden="true"] {
    display: none;
}

.in-app-modal-content:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Soporte para dark mode */
@media (prefers-color-scheme: dark) {
    .in-app-modal-content {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .in-app-instructions {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .in-app-instructions-title {
        color: #cbd5e0;
    }
    
    .in-app-instructions-steps {
        color: #a0aec0;
    }
}

/* Soporte para reduced motion */
@media (prefers-reduced-motion: reduce) {
    .in-app-modal-overlay,
    .in-app-modal-content,
    .in-app-toast,
    .in-app-banner {
        animation: none;
        transition: none;
    }
    
    .in-app-modal-content::before {
        display: none;
    }
    
    .in-app-loading {
        animation: none;
        border-top-color: rgba(255, 255, 255, 0.3);
    }
}