/**
 * PWA Styles
 * Стили для Progressive Web App функций
 */

/* Кнопка установки PWA */
.pwa-install-button {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    
    display: flex;
    align-items: center;
    gap: 8px;
    
    animation: slideUp 0.3s ease-out, pulse 2s ease-in-out infinite 2s;
    transition: all 0.3s ease;
}

.pwa-install-button:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.pwa-install-button:active {
    transform: translateX(-50%) scale(0.95);
}

/* Анимации */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(102, 126, 234, 0.6);
    }
}

/* Индикатор оффлайн-режима */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff6b6b;
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.visible {
    transform: translateY(0);
}

/* Индикатор загрузки из кэша */
.cache-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(255, 183, 77, 0.95);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 9998;
    display: none;
    animation: fadeIn 0.3s ease;
}

.cache-indicator.visible {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Адаптация для standalone режима */
.standalone-mode {
    /* Добавляем padding сверху для статус-бара */
    padding-top: env(safe-area-inset-top);
}

.standalone-mode .container {
    padding-top: 20px;
}

/* Адаптация для Telegram режима */
.telegram-mode {
    /* Telegram уже добавляет свои отступы */
}

.telegram-mode .pwa-install-button {
    /* Скрываем кнопку установки в Telegram */
    display: none !important;
}

/* Баннер обновления */
.update-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.update-banner.visible {
    transform: translateY(0);
}

.update-banner-content {
    flex: 1;
}

.update-banner-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.update-banner-text {
    font-size: 14px;
    opacity: 0.9;
}

.update-banner-actions {
    display: flex;
    gap: 12px;
}

.update-banner-button {
    padding: 8px 16px;
    border: 1px solid white;
    background: transparent;
    color: white;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.update-banner-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.update-banner-button.primary {
    background: white;
    color: #185a9d;
}

.update-banner-button.primary:hover {
    background: rgba(255, 255, 255, 0.9);
}

/* Splash screen для PWA */
.pwa-splash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.pwa-splash.hidden {
    opacity: 0;
    pointer-events: none;
}

.pwa-splash-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 24px;
    animation: logoFloat 2s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.pwa-splash-title {
    color: white;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.pwa-splash-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
}

.pwa-splash-loader {
    margin-top: 32px;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* PWA Features Banner */
.pwa-features-banner {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 16px;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.pwa-features-banner h3 {
    margin: 0 0 12px 0;
    color: #667eea;
    font-size: 18px;
}

.pwa-features-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pwa-features-list li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #333;
}

.pwa-features-list li::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 768px) {
    .pwa-install-button {
        bottom: 80px; /* Чтобы не перекрывать tab bar */
    }
    
    .update-banner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .update-banner-actions {
        width: 100%;
    }
    
    .update-banner-button {
        flex: 1;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .pwa-features-banner {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
        border-color: rgba(102, 126, 234, 0.3);
    }
    
    .pwa-features-list li {
        color: #e0e0e0;
    }
    
    .cache-indicator {
        background: rgba(255, 183, 77, 0.9);
    }
}

