/**
 * PWA Styles - BisikletRotam
 * Install banner, update notifications, toasts
 * /tema/css/components/pwa.css
 * v3.0 - Zero cache strategy
 */

/* ============================================================================
   🎨 INSTALL BANNER (Updated for pwa-manager.js)
   ============================================================================ */

#pwa-install-banner {
    position: fixed;
    bottom: 70px;
    left: 1rem;
    right: 1rem;
    background: white;
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUp 0.3s ease;
    transform-origin: bottom;
}

[data-theme="dark"] #pwa-install-banner {
    background: #1e293b;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

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

#pwa-install-banner img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}

#pwa-install-banner .content {
    flex: 1;
}

#pwa-install-banner strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 2px;
    color: #0f172a;
}

[data-theme="dark"] #pwa-install-banner strong {
    color: #f1f5f9;
}

#pwa-install-banner p {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0;
}

[data-theme="dark"] #pwa-install-banner p {
    color: #94a3b8;
}

#pwa-install-banner button {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

#pwa-install-banner .install {
    background: #2563eb;
    color: white;
}

#pwa-install-banner .install:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
}

#pwa-install-banner .dismiss {
    background: #f1f5f9;
    color: #64748b;
    margin-left: 8px;
}

[data-theme="dark"] #pwa-install-banner .dismiss {
    background: #334155;
    color: #94a3b8;
}

#pwa-install-banner .dismiss:hover {
    background: #e2e8f0;
}

[data-theme="dark"] #pwa-install-banner .dismiss:hover {
    background: #475569;
}

/* ============================================================================
   🔄 UPDATE NOTIFICATION (Toast Style)
   ============================================================================ */

.pwa-update-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #2563eb;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    animation: slideUp 0.3s ease;
}

.pwa-update-toast button {
    background: white;
    color: #2563eb;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.pwa-update-toast button:hover {
    transform: scale(1.05);
}

/* ============================================================================
   🍞 TOAST NOTIFICATIONS (Legacy Support)
   ============================================================================ */

.pwa-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: white;
    color: #0f172a;
    padding: 14px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 500;
    z-index: 9997;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.pwa-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

[data-theme="dark"] .pwa-toast {
    background: #1e293b;
    color: #f1f5f9;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.pwa-toast-success {
    border-left: 4px solid #10b981;
}

.pwa-toast-warning {
    border-left: 4px solid #f59e0b;
}

.pwa-toast-error {
    border-left: 4px solid #ef4444;
}

.pwa-toast-info {
    border-left: 4px solid #3b82f6;
}

/* ============================================================================
   🚫 OFFLINE INDICATOR
   ============================================================================ */

.app-offline::before {
    content: '📡 Çevrimdışı - GPS kaydı devam ediyor';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #f59e0b;
    color: #ffffff;
    text-align: center;
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10000;
    animation: slideDown 0.3s ease;
}

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

/* ============================================================================
   📱 FOOTER INSTALL BUTTON
   ============================================================================ */

.footer-app-button {
    margin-top: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.footer-app-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.footer-app-button:active {
    transform: translateY(0);
}

/* ============================================================================
   📱 RESPONSIVE - MOBILE
   ============================================================================ */

@media (max-width: 640px) {
    #pwa-install-banner {
        bottom: 60px;
        left: 0.75rem;
        right: 0.75rem;
        flex-wrap: wrap;
        gap: 10px;
    }

    #pwa-install-banner img {
        width: 40px;
        height: 40px;
    }

    #pwa-install-banner strong {
        font-size: 0.9rem;
    }

    #pwa-install-banner p {
        font-size: 0.75rem;
    }

    #pwa-install-banner button {
        flex: 1;
        min-width: 0;
    }

    .pwa-update-toast {
        left: 1rem;
        right: 1rem;
        transform: translateX(0);
        flex-wrap: wrap;
        justify-content: center;
    }

    .pwa-toast {
        left: 1rem;
        right: 1rem;
        transform: translateX(0) translateY(100px);
    }

    .pwa-toast.show {
        transform: translateX(0) translateY(0);
    }

    .footer-app-button {
        width: 100%;
        padding: 0.8rem;
    }
}

/* ============================================================================
   🎯 STANDALONE MODE (PWA App Mode)
   ============================================================================ */

@media (display-mode: standalone) {
    /* PWA modunda safe area desteği */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .site-footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    #pwa-install-banner,
    .pwa-update-toast,
    .pwa-toast {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    /* iOS notch desteği */
    .app-offline::before {
        padding-top: calc(8px + env(safe-area-inset-top));
    }
}

/* ============================================================================
   🌙 DARK MODE ENHANCEMENTS
   ============================================================================ */

[data-theme="dark"] .pwa-update-toast {
    background: #4c1d95;
}

[data-theme="dark"] .pwa-update-toast button {
    background: #f1f5f9;
    color: #4c1d95;
}

[data-theme="dark"] .footer-app-button {
    background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 100%);
}

/* ============================================================================
   🍏 iOS SPECIFIC FIXES
   ============================================================================ */

.ios-pwa {
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: transparent;
}

.pwa-standalone {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* ============================================================================
   ✨ ANIMATIONS
   ============================================================================ */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.pwa-loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.pwa-spinner {
    animation: rotate 0.8s linear infinite;
}