/**
 * PWA-specific styles for PascoWeather app
 * Enhances the standalone app experience
 */

/* Improve touch performance */
* {
    touch-action: manipulation;
}

/* Override for specific elements that need different touch behavior */
.map-container, .leaflet-container {
    touch-action: auto;
}

/* PWA Installed State */
.pwa-installed {
    /* Add any app-specific global styles */
}

/* Standalone PWA Mode */
.pwa-standalone {
    /* Remove browser-specific elements that don't apply in standalone mode */
}

.pwa-standalone .navbar {
    /* Add app-like padding for status bar on mobile */
    padding-top: env(safe-area-inset-top, 0);
}

/* App Install Banner Specific Styles */
#pwa-install-banner {
    border-radius: 12px;
    backdrop-filter: blur(10px);
    background: rgba(0, 102, 204, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#pwa-install-banner .btn-light {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-weight: 600;
}

#pwa-install-banner .btn-light:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

#pwa-install-banner .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.5);
    color: rgba(255, 255, 255, 0.9);
}

#pwa-install-banner .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.8);
    color: white;
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: none;
}

.offline-indicator.show {
    display: block;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* App-like Navigation */
.pwa-standalone .navbar-nav .nav-link {
    border-radius: 8px;
    margin: 0 2px;
    transition: all 0.2s ease;
}

.pwa-standalone .navbar-nav .nav-link:hover,
.pwa-standalone .navbar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* Enhanced Cards for App */
.pwa-standalone .card {
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pwa-standalone .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* App-style Buttons */
.pwa-standalone .btn {
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pwa-standalone .btn:hover {
    transform: translateY(-1px);
}

/* Weather Icons Animation in App */
.pwa-standalone .weather-icon {
    transition: transform 0.3s ease;
}

.pwa-standalone .weather-icon:hover {
    transform: scale(1.05) rotate(5deg);
}

/* Forecast Cards Enhancement */
.pwa-standalone .forecast-card {
    border-radius: 16px;
    transition: all 0.3s ease;
}

.pwa-standalone .forecast-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* App Header */
.pwa-standalone .navbar-brand {
    font-weight: 700;
    font-size: 1.6rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Safe Area Adjustments for Mobile */
@supports (padding: max(0px)) {
    .pwa-standalone {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .pwa-standalone .navbar {
        padding-top: max(8px, env(safe-area-inset-top));
    }
    
    .pwa-standalone .container {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* App Loading Skeleton */
.app-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* Notification Permission Banner in App */
.pwa-standalone #notificationBanner {
    border-radius: 16px;
    margin: 16px;
    border: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

/* Dark Mode Enhancements for PWA */
[data-theme="dark"] .pwa-standalone .card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

[data-theme="dark"] .pwa-standalone .navbar {
    background: rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: blur(10px);
}

/* App Icon in Navigation */
.navbar-brand .app-icon {
    width: 32px;
    height: 32px;
    margin-right: 8px;
    border-radius: 6px;
}

/* Traffic Map Overlay Fixes */
.leaflet-popup-content-wrapper {
    background: white !important;
    color: #333 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-popup-content {
    margin: 8px !important;
    line-height: 1.4 !important;
}

.leaflet-popup-tip {
    background: white !important;
}

/* Map Legend Enhancements */
.legend {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Dark mode adjustments for map */
[data-theme="dark"] .leaflet-popup-content-wrapper {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
    border: 1px solid #4a5568 !important;
}

[data-theme="dark"] .leaflet-popup-tip {
    background: #2d3748 !important;
}

[data-theme="dark"] .legend {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
    border: 1px solid #4a5568 !important;
}

/* Ensure map controls are visible */
.leaflet-control-zoom a {
    color: #333 !important;
    background: white !important;
}

[data-theme="dark"] .leaflet-control-zoom a {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
    border-color: #4a5568 !important;
}

/* Quick Actions in App */
.pwa-standalone .quick-actions {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.pwa-standalone .quick-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin-bottom: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
}

.pwa-standalone .quick-action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

/* App Status Bar */
.app-status-bar {
    height: 24px;
    background: linear-gradient(135deg, #0066cc, #004499);
    display: none;
}

.pwa-standalone .app-status-bar {
    display: block;
}

/* Pull-to-Refresh Indicator */
.pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: #0066cc;
    color: white;
    padding: 12px 24px;
    border-radius: 0 0 12px 12px;
    transition: top 0.3s ease;
    z-index: 9999;
}

.pull-to-refresh.show {
    top: 0;
}

/* Hide browser-specific elements in standalone mode */
.pwa-standalone .browser-only {
    display: none !important;
}

/* Show app-specific elements only in standalone mode */
.app-only {
    display: none;
}

.pwa-standalone .app-only {
    display: block;
}