/**
 * PWA Required Gate Styles
 * Стили для ПОЛНОЭКРАННОГО БЛОКИРУЮЩЕГО интерфейса установки PWA
 */

/* Полноэкранный блокирующий gate */
.pwa-install-gate {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow-y: auto;
    padding: 20px;
}

.pwa-install-gate.visible {
    opacity: 1;
    visibility: visible;
}

.pwa-install-gate.hiding {
    opacity: 0;
}

/* Контент gate */
.pwa-gate-content {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    transform: translateY(30px);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 20px 0;
}

.pwa-install-gate.visible .pwa-gate-content {
    transform: translateY(0);
}

/* Заголовок */
.pwa-gate-header {
    text-align: center;
    animation: fadeInDown 0.8s ease forwards;
}

.pwa-gate-logo {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
    animation: logoPulse 2s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 12px 40px rgba(102, 126, 234, 0.6);
    }
}

.pwa-gate-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pwa-gate-title {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 12px 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.pwa-gate-subtitle {
    font-size: 16px;
    color: #999;
    margin: 0;
    line-height: 1.6;
}

/* Инструкции */
.pwa-install-instructions {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeInUp 0.8s ease 0.2s forwards;
    opacity: 0;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Шаг инструкции */
.pwa-install-step {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    align-items: flex-start;
    animation: slideInLeft 0.5s ease forwards;
    opacity: 0;
}

.pwa-install-gate.visible .pwa-install-step:nth-child(1) {
    animation-delay: 0.4s;
}

.pwa-install-gate.visible .pwa-install-step:nth-child(2) {
    animation-delay: 0.6s;
}

.pwa-install-gate.visible .pwa-install-step:nth-child(3) {
    animation-delay: 0.8s;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.pwa-install-step:last-child {
    margin-bottom: 0;
}

.step-number {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.step-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-icon {
    color: #667eea;
}

.step-text {
    font-size: 16px;
    line-height: 1.6;
    color: #e0e0e0;
}

.step-text strong {
    color: #fff;
    font-weight: 600;
}

/* Inline иконки в тексте */
.inline-icon {
    display: inline-block;
    vertical-align: middle;
    margin: 0 4px;
    color: #667eea;
}

.inline-icon.share-icon {
    width: 18px;
    height: 22px;
    color: #667eea;
    stroke: #667eea;
    filter: drop-shadow(0 0 3px rgba(102, 126, 234, 0.5));
}

/* Требование браузера - компактный блок */
.browser-requirement {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid #667eea;
    border-radius: 8px;
    margin-bottom: 20px;
}

.browser-icon {
    flex-shrink: 0;
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
}

.browser-text {
    font-size: 14px;
    line-height: 1.4;
    color: #ccc;
    font-weight: 500;
}

/* Уведомление (для других случаев) */
.pwa-install-notice {
    background: rgba(255, 152, 0, 0.15);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.notice-icon {
    font-size: 32px;
    flex-shrink: 0;
    line-height: 1;
}

.notice-text {
    font-size: 16px;
    line-height: 1.6;
    color: #e0e0e0;
}

.notice-text strong {
    color: #fff;
    font-weight: 600;
}

/* Футер */
.pwa-gate-footer {
    animation: fadeInUp 0.8s ease 0.4s forwards;
    opacity: 0;
}

.pwa-gate-refresh {
    text-align: center;
}

.refresh-text {
    font-size: 14px;
    color: #888;
    margin: 0 0 16px 0;
}

.pwa-gate-btn-refresh {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 16px;
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pwa-gate-btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.pwa-gate-btn-refresh:active {
    transform: translateY(0);
}

.pwa-gate-btn-refresh svg {
    animation: rotateIcon 2s linear infinite;
}

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

/* Адаптация для iOS и маленьких экранов */
@media (max-height: 750px) {
    .pwa-install-gate {
        padding: 15px;
    }
    
    .pwa-gate-content {
        gap: 20px;
        padding: 10px 0;
    }
    
    .pwa-gate-logo {
        width: 64px;
        height: 64px;
        margin-bottom: 12px;
        border-radius: 16px;
    }
    
    .pwa-gate-title {
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .pwa-gate-subtitle {
        font-size: 14px;
        line-height: 1.4;
    }
    
    .pwa-install-instructions {
        padding: 18px;
        gap: 16px;
    }
    
    .browser-requirement {
        padding: 10px 14px;
        gap: 8px;
        margin-bottom: 16px;
    }
    
    .browser-text {
        font-size: 13px;
    }
    
    .browser-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .pwa-install-notice {
        padding: 16px;
        gap: 12px;
    }
    
    .notice-icon {
        font-size: 28px;
    }
    
    .notice-text {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .pwa-install-step {
        margin-bottom: 14px;
        gap: 12px;
    }
    
    .step-number {
        width: 30px;
        height: 30px;
        font-size: 15px;
    }
    
    .step-text {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .pwa-gate-footer {
        gap: 12px;
    }
    
    .refresh-text {
        font-size: 13px;
        margin-bottom: 12px;
    }
    
    .pwa-gate-btn-refresh {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* Специально для iPhone (малые экраны) */
@media (max-height: 700px) {
    .pwa-install-gate {
        padding: 12px;
    }
    
    .pwa-gate-content {
        gap: 16px;
        padding: 8px 0;
    }
    
    .pwa-gate-logo {
        width: 56px;
        height: 56px;
        margin-bottom: 10px;
        border-radius: 14px;
    }
    
    .pwa-gate-title {
        font-size: 22px;
        margin-bottom: 6px;
    }
    
    .pwa-gate-subtitle {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .pwa-gate-header {
        margin-bottom: 0;
    }
    
    .pwa-install-instructions {
        padding: 16px;
    }
    
    .browser-requirement {
        padding: 9px 12px;
        gap: 7px;
        margin-bottom: 14px;
    }
    
    .browser-text {
        font-size: 12px;
    }
    
    .browser-icon svg {
        width: 16px;
        height: 16px;
    }
    
    .pwa-install-notice {
        padding: 14px;
        gap: 10px;
    }
    
    .notice-icon {
        font-size: 24px;
    }
    
    .notice-text {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .pwa-install-step {
        margin-bottom: 12px;
        gap: 10px;
    }
    
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .step-text {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .step-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .pwa-gate-footer {
        gap: 10px;
    }
    
    .refresh-text {
        font-size: 12px;
        margin-bottom: 10px;
    }
    
    .pwa-gate-btn-refresh {
        padding: 12px 18px;
        font-size: 14px;
    }
    
    .pwa-gate-btn-refresh svg {
        width: 18px;
        height: 18px;
    }
}

/* Адаптация для очень маленьких экранов (iPhone SE и аналогичные) */
@media (max-height: 600px) {
    .pwa-install-gate {
        padding: 10px;
        align-items: flex-start;
        padding-top: 15px;
    }
    
    .pwa-gate-content {
        gap: 12px;
        padding: 5px 0;
    }
    
    .pwa-gate-logo {
        width: 48px;
        height: 48px;
        margin-bottom: 8px;
        border-radius: 12px;
    }
    
    .pwa-gate-title {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    .pwa-gate-subtitle {
        font-size: 12px;
        line-height: 1.3;
    }
    
    .pwa-install-instructions {
        padding: 14px;
    }
    
    .pwa-install-step {
        margin-bottom: 10px;
        gap: 8px;
    }
    
    .step-number {
        width: 26px;
        height: 26px;
        font-size: 13px;
    }
    
    .step-text {
        font-size: 12px;
        line-height: 1.3;
    }
    
    .step-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .inline-icon.share-icon {
        width: 16px;
        height: 20px;
    }
    
    .pwa-gate-btn-refresh {
        padding: 11px 16px;
        font-size: 13px;
    }
    
    .refresh-text {
        font-size: 11px;
        margin-bottom: 8px;
    }
    
    .browser-requirement {
        padding: 8px 10px;
        gap: 6px;
        margin-bottom: 12px;
    }
    
    .browser-text {
        font-size: 11px;
        line-height: 1.2;
    }
    
    .browser-icon svg {
        width: 14px;
        height: 14px;
    }
    
    .pwa-install-notice {
        padding: 12px;
        gap: 8px;
    }
    
    .notice-icon {
        font-size: 20px;
    }
    
    .notice-text {
        font-size: 12px;
        line-height: 1.3;
    }
    
    /* Отключаем pulse анимацию на очень маленьких экранах */
    .pwa-gate-logo {
        animation: none;
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    }
    
    /* Ускоряем анимацию появления */
    .pwa-install-step {
        animation-duration: 0.3s;
    }
}

/* Скроллбар для gate */
.pwa-install-gate::-webkit-scrollbar {
    width: 8px;
}

.pwa-install-gate::-webkit-scrollbar-track {
    background: transparent;
}

.pwa-install-gate::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.pwa-install-gate::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Адаптация для Desktop (широких экранов) */
@media (min-width: 768px) {
    .pwa-gate-content {
        max-width: 500px;
    }
}

/* Ландшафтная ориентация на мобильных */
@media (max-height: 500px) and (orientation: landscape) {
    .pwa-install-gate {
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .pwa-gate-logo {
        width: 50px;
        height: 50px;
        margin-bottom: 10px;
    }
    
    .pwa-gate-title {
        font-size: 22px;
        margin-bottom: 6px;
    }
    
    .pwa-gate-subtitle {
        font-size: 13px;
    }
    
    .pwa-gate-content {
        gap: 20px;
    }
}

/* Эффект размытия фона (если есть контент под gate) */
.pwa-install-gate::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: -1;
}

/* Анимация загрузки при проверке PWA статуса */
.pwa-gate-checking {
    position: relative;
}

.pwa-gate-checking::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Темная тема (по умолчанию) */
@media (prefers-color-scheme: dark) {
    .pwa-install-gate {
        background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    }
}

/* Светлая тема */
@media (prefers-color-scheme: light) {
    .pwa-install-gate {
        background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    }
}
