/* PWA специфичные стили */

/* Кнопка установки PWA */
.pwa-install-button {
    display: none;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
    margin-left: auto;
    margin-right: 60px;
    white-space: nowrap;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-install-button:hover {
    background: linear-gradient(135deg, #00e6ff, #00b3e6);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

.pwa-install-button i {
    font-size: 16px;
    flex-shrink: 0;
}

.pwa-install-button span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Адаптация кнопки для мобильных устройств */
@media (max-width: 768px) {
    .pwa-install-button {
        padding: 8px 12px;
        font-size: 12px;
        gap: 6px;
        margin-left: 8px;
        margin-right: 8px;
        min-width: 140px;
        max-width: 150px;
        overflow: visible;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    
    .pwa-install-button i {
        font-size: 12px;
        flex-shrink: 0;
    }
    
    .pwa-install-button span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .header {
        padding-right: 10px !important;
        flex-wrap: nowrap;
    }
}

/* Дополнительные стили для больших экранов */
@media (min-width: 769px) {
    .header {
        padding-right: 80px !important;
    }
    
    .pwa-install-button {
        margin-right: 60px;
    }
}

/* Уведомление об обновлении */
.pwa-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #2d2d2d;
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    max-width: 350px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid #00d4ff;
}

.update-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.update-content i {
    color: #00d4ff;
    font-size: 18px;
    animation: spin 2s linear infinite;
}

.update-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.update-btn, .dismiss-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.update-btn {
    background: #00d4ff;
    color: white;
}

.update-btn:hover {
    background: #00e6ff;
}

.dismiss-btn {
    background: transparent;
    color: #ccc;
    border: 1px solid #555;
}

.dismiss-btn:hover {
    background: #555;
    color: white;
}

/* Сообщение об успешной установке */
.pwa-success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4caf50;
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.3);
    z-index: 10000;
    animation: slideInRight 0.3s ease;
}

.success-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.success-content i {
    font-size: 18px;
}

/* Анимации */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Стили для установленного PWA */
.pwa-installed .header {
    padding-top: env(safe-area-inset-top, 0);
}

.pwa-installed .container {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Адаптация для мобильных устройств в PWA режиме */
@media (display-mode: standalone) {
    body {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
    
    .header {
        padding-top: env(safe-area-inset-top, 20px);
        background: #000000 !important;
        backdrop-filter: blur(10px);
    }
    
    .container {
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }
}

/* Скрытие кнопки установки для уже установленных PWA */
@media (display-mode: standalone) {
    .pwa-install-button {
        display: none !important;
    }
}

/* Стили для iOS Safari */
@supports (-webkit-touch-callout: none) {
    .pwa-installed .header {
        padding-top: max(env(safe-area-inset-top), 20px);
    }
}

/* Стили для Android Chrome */
@media (display-mode: standalone) and (max-width: 768px) {
    .header {
        position: sticky;
        top: 0;
        z-index: 100;
        background: #000000 !important;
    }
}

/* Offline индикатор */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff5722;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 10000;
    display: none;
}

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

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