/* 
 * 🚀 PWA Styles
 * Progressive Web App specific styles for install prompts, notifications, and offline indicators
 */

/* PWA Install Button - DISABLED */
.pwa-install-btn {
    display: none !important; /* DISABLED: Hide install button */
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    */
}

/* Hide all install-related elements globally */
.pwa-install-btn,
.install-app-btn,
.install-button,
.add-to-home-screen,
.add-to-homescreen,
[class*="install"],
[data-install],
.install-prompt {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Original install button styles (commented out):
.pwa-install-btn {
    height: 38px;
    padding: 0 16px;
    background: rgba(29, 143, 96, 0.1);
    border: 1px solid rgba(29, 143, 96, 0.3);
    border-radius: 19px;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-right: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.pwa-install-btn:hover {
    background: rgba(29, 143, 96, 0.2);
    border-color: rgba(29, 143, 96, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(29, 143, 96, 0.2);
}

.pwa-install-btn svg {
    opacity: 0.8;
}

/* Hide install button on installed PWAs */
body.pwa-installed .pwa-install-btn {
    display: none;
}

/* PWA Update Banner */
.pwa-update-banner {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 15, 40, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(120, 160, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 400px;
    width: calc(100% - 40px);
}

.pwa-update-banner.show {
    top: 100px;
}

.update-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}

.update-icon {
    font-size: 2rem;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.update-text {
    flex: 1;
    color: white;
}

.update-text strong {
    display: block;
    margin-bottom: 4px;
    font-size: 1.1rem;
}

.update-text p {
    margin: 0;
    opacity: 0.8;
    font-size: 0.9rem;
}

.update-actions {
    display: flex;
    gap: 8px;
}

.btn-update {
    background: var(--primary-color);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-update:hover {
    background: var(--light-green);
    transform: translateY(-1px);
}

.btn-dismiss {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-dismiss:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* PWA Success Messages */
.pwa-success-message,
.pwa-sync-message {
    position: fixed;
    top: -80px;
    right: 20px;
    background: rgba(29, 143, 96, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(29, 143, 96, 0.5);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(29, 143, 96, 0.3);
    z-index: 10000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 250px;
    opacity: 0;
    transform: translateY(-20px);
}

.pwa-success-message.show,
.pwa-sync-message.show {
    top: 100px;
    opacity: 1;
    transform: translateY(0);
}

.success-content,
.sync-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    color: white;
}

.success-icon,
.sync-icon {
    font-size: 1.5rem;
}

.success-text,
.sync-text {
    font-weight: 600;
    font-size: 0.95rem;
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(220, 53, 69, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(220, 53, 69, 0.5);
    border-radius: 30px;
    box-shadow: 0 8px 32px rgba(220, 53, 69, 0.3);
    z-index: 10000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.offline-indicator.show {
    top: 100px;
    opacity: 1;
}

.offline-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
}

.offline-icon {
    font-size: 1.2rem;
}

/* Mobile PWA Adjustments */
@media (max-width: 768px) {
    .pwa-update-banner {
        top: -120px;
        width: calc(100% - 20px);
        left: 10px;
        transform: none;
        border-radius: 12px;
    }
    
    .pwa-update-banner.show {
        top: 10px;
    }
    
    .update-content {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 16px;
    }
    
    .update-actions {
        width: 100%;
        justify-content: center;
    }
    
    .btn-update,
    .btn-dismiss {
        flex: 1;
        min-width: 100px;
    }
    
    .pwa-success-message,
    .pwa-sync-message {
        right: 10px;
        left: 10px;
        width: auto;
        min-width: auto;
    }
    
    .pwa-success-message.show,
    .pwa-sync-message.show {
        top: 10px;
    }
    
    .offline-indicator {
        left: 10px;
        right: 10px;
        transform: none;
        border-radius: 12px;
    }
    
    .offline-indicator.show {
        top: 10px;
    }
    
    /* Hide install button on small mobile nav */
    .small-mobile-nav .pwa-install-btn {
        display: none;
    }
}

/* PWA Standalone Mode Adjustments */
body.pwa-installed {
    /* Adjust for PWA status bar */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* iOS PWA Status Bar */
@supports (-webkit-touch-callout: none) {
    body.pwa-installed {
        padding-top: max(env(safe-area-inset-top), 44px);
    }
}

/* Android PWA Adjustments */
body.pwa-installed.android {
    padding-top: max(env(safe-area-inset-top), 24px);
}

/* PWA Splash Screen Styles (for icon generation) */
.pwa-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    color: white;
}

.pwa-splash-icon {
    width: 120px;
    height: 120px;
    background: var(--primary-color);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.pwa-splash-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}

.pwa-splash-subtitle {
    font-size: 1rem;
    opacity: 0.8;
    text-align: center;
    margin-bottom: 40px;
}

.pwa-splash-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Browser Compatibility Notifications */
.browser-compatibility-notice {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 193, 7, 0.95);
    color: #856404;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(255, 193, 7, 0.3);
    z-index: 9999;
    max-width: 300px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
    .browser-compatibility-notice {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Theme System */
.theme-toggle {
    width: 38px;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    overflow: hidden;
}

.theme-toggle .theme-icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
    transform: scale(1.1);
}

/* Theme transitions */
body.theme-transitioning * {
    transition: background-color 0.3s ease,
                color 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease !important;
}

/* Theme change notification */
.theme-change-notification {
    position: fixed;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(29, 143, 96, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(29, 143, 96, 0.5);
    border-radius: 25px;
    box-shadow: 0 8px 32px rgba(29, 143, 96, 0.3);
    z-index: 10000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.theme-change-notification.show {
    top: 100px;
    opacity: 1;
}

.theme-notification-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
}

.theme-notification-icon {
    font-size: 1.2rem;
}

/* Light theme specific overrides */
body.theme-light {
    background: var(--bg-primary);
    color: var(--text-primary);
}

body.theme-light .spa-header {
    background: var(--nav-bg);
    border-bottom-color: var(--border-color);
}


body.theme-light #spa-content {
    background: var(--bg-primary);
}

/* Mobile theme adjustments */
@media (max-width: 768px) {
    .theme-change-notification {
        left: 10px;
        right: 10px;
        transform: none;
        border-radius: 12px;
    }
    
    .theme-change-notification.show {
        top: 10px;
    }
}
