/* ============================================
   PWA - BOTÓN DE INSTALACIÓN
   ============================================ */

.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #0056b3 0%, #007bff 100%);
    color: #ffffff;
    padding: 15px 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.pwa-install-icon img {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.pwa-install-text {
    flex: 1;
}

.pwa-install-text h4 {
    margin: 0 0 5px;
    font-size: 16px;
    font-weight: 700;
}

.pwa-install-text p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}

.pwa-install-buttons {
    display: flex;
    gap: 10px;
}

.btn-pwa-install {
    padding: 10px 25px;
    background: #dc3545;
    color: #ffffff;
    border: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-pwa-install:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

.btn-pwa-close {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-pwa-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   BOTÓN FLOTANTE INSTALAR (MÓVIL)
   ============================================ */

.pwa-floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
    z-index: 9998;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 8px 30px rgba(220, 53, 69, 0.6);
    }
}

.pwa-floating-btn:hover {
    transform: scale(1.1);
}

.pwa-floating-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: #fff;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pwa-floating-btn:hover .pwa-floating-tooltip {
    opacity: 1;
}

/* ============================================
   MODAL DE INSTRUCCIONES
   ============================================ */

.pwa-install-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pwa-install-modal-content {
    background: #ffffff;
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUpModal 0.3s ease;
}

@keyframes slideUpModal {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pwa-install-modal-header {
    background: linear-gradient(135deg, #0056b3 0%, #007bff 100%);
    color: #ffffff;
    padding: 25px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pwa-install-modal-header h3 {
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pwa-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pwa-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.pwa-install-modal-body {
    padding: 25px;
}

.pwa-device-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.pwa-device-btn {
    flex: 1;
    padding: 12px;
    background: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pwa-device-btn.active {
    background: #0056b3;
    color: #ffffff;
    border-color: #0056b3;
}

.pwa-device-btn:hover:not(.active) {
    background: #e0e0e0;
}

.pwa-step {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #007bff;
}

.pwa-step-number {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #0056b3 0%, #007bff 100%);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.pwa-step-content h4 {
    margin: 0 0 5px;
    font-size: 15px;
    color: #333;
}

.pwa-step-content p {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* ============================================
   OPTIMIZACIONES MÓVILES
   ============================================ */

/* Safe area para iPhone con notch */
@supports (padding: max(0px)) {
    .pwa-install-banner {
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
    
    .pwa-floating-btn {
        bottom: max(30px, env(safe-area-inset-bottom));
        right: max(30px, env(safe-area-inset-right));
    }
}

/* Responsive */
@media (max-width: 768px) {
    .pwa-install-content {
        flex-direction: column;
        text-align: center;
    }
    
    .pwa-install-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .pwa-floating-btn {
        width: 55px;
        height: 55px;
        font-size: 22px;
        bottom: 20px;
        right: 20px;
    }
    
    .pwa-install-modal-content {
        max-height: 85vh;
    }
    
    .pwa-install-modal-header h3 {
        font-size: 18px;
    }
    
    .pwa-step {
        flex-direction: column;
        text-align: center;
    }
    
    .pwa-step-number {
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .pwa-install-banner {
        padding: 12px 15px;
    }
    
    .pwa-install-text h4 {
        font-size: 14px;
    }
    
    .pwa-install-text p {
        font-size: 12px;
    }
    
    .btn-pwa-install {
        padding: 8px 20px;
        font-size: 13px;
    }
    
    .pwa-floating-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .pwa-device-selector {
        flex-direction: column;
    }
}

/* ============================================
   MODO OSCURO
   ============================================ */

@media (prefers-color-scheme: dark) {
    .pwa-install-modal-content {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .pwa-step {
        background: #2a2a2a;
    }
    
    .pwa-step-content h4 {
        color: #ffffff;
    }
    
    .pwa-step-content p {
        color: #cccccc;
    }
    
    .pwa-device-btn {
        background: #2a2a2a;
        color: #ffffff;
    }
    
    .pwa-device-btn:hover:not(.active) {
        background: #3a3a3a;
    }
}

/* ============================================
   ANIMACIONES DE ENTRADA
   ============================================ */

.pwa-install-banner.show {
    animation: slideUp 0.5s ease forwards;
}

.pwa-floating-btn.show {
    animation: bounceIn 0.6s ease forwards;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}



/* ============================================
   NOTIFICACIONES PWA
   ============================================ */

.pwa-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ffffff;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    border-left: 4px solid #007bff;
    max-width: 350px;
}

.pwa-notification.show {
    transform: translateX(0);
}

.pwa-notification.success {
    border-left-color: #28a745;
}

.pwa-notification.warning {
    border-left-color: #ffc107;
}

.pwa-notification.error {
    border-left-color: #dc3545;
}

/* ============================================
   NOTIFICACIÓN DE ACTUALIZACIÓN
   ============================================ */

.pwa-update-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #0056b3 0%, #007bff 100%);
    color: #ffffff;
    padding: 15px 20px;
    z-index: 10002;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.pwa-update-notification.show {
    transform: translateY(0);
}

.pwa-update-content {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.pwa-update-content > i {
    font-size: 24px;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.pwa-update-text {
    flex: 1;
}

.pwa-update-text h4 {
    margin: 0 0 3px;
    font-size: 15px;
    font-weight: 700;
}

.pwa-update-text p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}

.pwa-update-btn {
    padding: 8px 20px;
    background: #ffffff;
    color: #0056b3;
    border: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pwa-update-btn:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

/* ============================================
   MODO STANDALONE (APP INSTALADA)
   ============================================ */

body.pwa-standalone {
    padding-top: env(safe-area-inset-top);
}

body.pwa-standalone .sa-topbar {
    display: none;
}

body.pwa-standalone .pwa-install-banner,
body.pwa-standalone .pwa-floating-btn {
    display: none !important;
}

/* ============================================
   MODO OFFLINE
   ============================================ */

body.offline .entry-thumbnail img {
    opacity: 0.7;
}

body.offline::after {
    content: '📡 Modo Offline';
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: #ffc107;
    color: #333;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    z-index: 9997;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}