/* PWA Mobile Features CSS - Enhanced Mobile Experience */

/* Touch feedback */
.touch-active {
    transform: scale(0.98);
    opacity: 0.8;
    transition: transform 0.1s ease, opacity 0.1s ease;
}

/* Mobile device specific styles */
.mobile-device {
    overflow-x: hidden;
}

/* Safe area support for notched devices */
.has-safe-area {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Orientation styles */
.landscape {
    --header-height: 50px;
}

.portrait {
    --header-height: 60px;
}

/* Network status indicators */
.network-status {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    text-transform: uppercase;
}

.network-status.online {
    background-color: #22c55e;
    color: white;
}

.network-status.offline {
    background-color: #ef4444;
    color: white;
}

/* Connection-based optimizations */
.connection-slow-2g,
.connection-2g {
    --animation-duration: 0.1s;
}

.connection-3g {
    --animation-duration: 0.2s;
}

.connection-4g {
    --animation-duration: 0.3s;
}

/* Data saving mode */
.data-saving-mode {
    --image-quality: 0.7;
}

.data-saving-mode img {
    filter: contrast(0.9) brightness(0.95);
}

/* Battery status */
.low-battery {
    --theme-primary: #fbbf24;
    --animation-duration: 0.1s;
}

.low-battery .hero-section {
    background: linear-gradient(135deg, #451a03, #78350f);
}

.battery-charging::before {
    content: "⚡";
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 10000;
    font-size: 1.2em;
    animation: pulse 2s infinite;
}

/* Pull to refresh indicator */
.pull-to-refresh-indicator {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    opacity: 0;
}

.pull-to-refresh-indicator .pull-icon {
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.pull-to-refresh-indicator .pull-text {
    font-size: 0.9em;
    font-weight: 500;
}

/* Section indicators for swipe navigation */
.pwa-section-indicators {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.pwa-section-indicators .indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.pwa-section-indicators .indicator.active {
    background: #9333ea;
    transform: scale(1.2);
}

.pwa-section-indicators .indicator:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

/* Install banner enhancements */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #9333ea, #7c3aed);
    color: white;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.pwa-install-banner:not(.hidden) {
    transform: translateY(0);
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    gap: 15px;
}

.pwa-banner-icon {
    font-size: 1.5em;
}

.pwa-banner-text {
    flex: 1;
}

.pwa-banner-text h4 {
    margin: 0 0 4px 0;
    font-size: 1em;
    font-weight: 600;
}

.pwa-banner-text p {
    margin: 0;
    font-size: 0.85em;
    opacity: 0.9;
}

.pwa-banner-actions {
    display: flex;
    gap: 10px;
}

.btn-install,
.btn-update {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-install:hover,
.btn-update:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn-close,
.btn-dismiss {
    background: transparent;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    font-size: 1.2em;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.btn-close:hover,
.btn-dismiss:hover {
    opacity: 1;
}

/* Notification banner */
.pwa-notification-banner {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 10000;
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

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

/* Update prompt */
.pwa-update-prompt {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 10000;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

.pwa-update-content {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    gap: 15px;
}

.pwa-update-icon {
    font-size: 1.5em;
    animation: spin 2s linear infinite;
}

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

.pwa-update-text {
    flex: 1;
}

.pwa-update-text h4 {
    margin: 0 0 4px 0;
    font-size: 1em;
    font-weight: 600;
}

.pwa-update-text p {
    margin: 0;
    font-size: 0.85em;
    opacity: 0.9;
}

.pwa-update-actions {
    display: flex;
    gap: 10px;
}

/* Mobile navigation enhancements */
@media (max-width: 768px) {
    /* Hide section indicators on very small screens */
    .pwa-section-indicators {
        display: none;
    }
    
    /* Adjust banner spacing */
    .pwa-install-banner,
    .pwa-notification-banner,
    .pwa-update-prompt {
        left: 10px;
        right: 10px;
    }
    
    /* Optimize touch targets */
    .btn-install,
    .btn-update,
    .btn-enable {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Improve text readability */
    .pwa-banner-text h4,
    .pwa-update-text h4 {
        font-size: 0.95em;
    }
    
    .pwa-banner-text p,
    .pwa-update-text p {
        font-size: 0.8em;
    }
}

/* Standalone mode adjustments */
.pwa-standalone {
    /* Adjust for status bar in standalone mode */
    --status-bar-height: 24px;
}

.pwa-standalone .main-header {
    padding-top: var(--status-bar-height);
}

/* Enhanced touch interactions */
.interactive:active,
.btn:active,
button:active {
    transform: scale(0.98);
}

/* Swipe hint animations */
.swipe-hint {
    position: relative;
    overflow: hidden;
}

.swipe-hint::after {
    content: "← Swipe →";
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    opacity: 0;
    animation: swipeHint 3s ease-in-out infinite;
}

@keyframes swipeHint {
    0%, 80%, 100% { opacity: 0; }
    10%, 70% { opacity: 1; }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .touch-active {
        transform: none;
        transition: none;
    }
    
    .pull-to-refresh-indicator,
    .pwa-section-indicators .indicator,
    .btn-install,
    .btn-update {
        transition: none;
    }
    
    .swipe-hint::after {
        animation: none;
        opacity: 0.7;
    }
    
    @keyframes spin {
        from { transform: rotate(0deg); }
        to { transform: rotate(0deg); }
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pwa-install-banner,
    .pwa-notification-banner,
    .pwa-update-prompt {
        border: 2px solid white;
    }
    
    .network-status.online {
        background-color: #000;
        color: #0f0;
        border: 1px solid #0f0;
    }
    
    .network-status.offline {
        background-color: #000;
        color: #f00;
        border: 1px solid #f00;
    }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .pull-to-refresh-indicator {
        background: rgba(255, 255, 255, 0.9);
        color: black;
    }
    
    .pwa-section-indicators {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .pwa-section-indicators .indicator {
        background: rgba(255, 255, 255, 0.6);
    }
}