/* PWA Specific Styles */

/* Install Banner */
.install-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    color: white;
    padding: 12px 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    animation: slideDown 0.3s ease-out;
}

/* Insecure context notice */
.pwa-insecure-notice {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff9800;
    color: #111;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    z-index: 1000;
    font-size: 13px;
    max-width: 90%;
    text-align: center;
}

.install-banner.hidden {
    display: none;
}

.install-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.install-btn {
    background: white;
    color: #1a73e8;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.install-btn:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.dismiss-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    margin-left: 12px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

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

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #f44336;
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(244, 67, 54, 0.3);
    z-index: 999;
    animation: pulse 2s infinite;
}

.offline-indicator.hidden {
    display: none;
}

.offline-indicator svg {
    animation: spin 2s linear infinite;
}

/* Update Banner */
.update-banner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    z-index: 999;
    animation: slideUp 0.3s ease-out;
}

.update-banner.hidden {
    display: none;
}

.update-btn {
    background: white;
    color: #4CAF50;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.update-btn:hover {
    background: #f1f8e9;
}

/* Offline Mode Styles */
body.offline {
    position: relative;
}

body.offline::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        #f44336,
        #f44336 10px,
        #ff9800 10px,
        #ff9800 20px
    );
    animation: slide 1s linear infinite;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        bottom: 0;
        width: 250px;
        background: white;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        transition: left 0.3s ease;
        z-index: 998;
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 60px 15px 15px;
    }

    /* Add hamburger menu */
    .mobile-menu-toggle {
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 999;
        background: #1a73e8;
        color: white;
        border: none;
        padding: 10px;
        border-radius: 4px;
        cursor: pointer;
    }

    /* Touch-friendly buttons */
    button, .btn, input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Larger touch targets */
    a, button, input, select, textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

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

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

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

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

@keyframes slide {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(20px);
    }
}

/* iOS Specific Fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari */
    .main-content {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .install-banner {
        padding-top: calc(12px + env(safe-area-inset-top));
    }
}

/* Splash Screen Styles */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 10000;
}

.splash-logo {
    width: 128px;
    height: 128px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.splash-text {
    font-size: 24px;
    font-weight: 300;
    margin-bottom: 40px;
}

.splash-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Improved Touch Feedback */
button:active, .btn:active, a:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Pull to Refresh Indicator */
.pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: top 0.3s ease;
    z-index: 999;
}

.pull-to-refresh.active {
    top: 20px;
}

.pull-to-refresh svg {
    animation: spin 1s linear infinite;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #121212;
        --bg-secondary: #1e1e1e;
        --text-primary: #e0e0e0;
        --text-secondary: #a0a0a0;
        --border-color: #333;
    }

    body {
        background: var(--bg-primary);
        color: var(--text-primary);
    }

    .sidebar {
        background: var(--bg-secondary);
        border-right: 1px solid var(--border-color);
    }

    .nav-link {
        color: var(--text-primary);
    }

    .nav-link:hover {
        background: rgba(255,255,255,0.1);
    }
}