/**
 * TinnyTiger PWA 样式
 */

/* 安装提示横幅 */
.pwa-install-banner {
    position: fixed;
    bottom: 80px;
    left: 16px;
    right: 16px;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 9999;
    animation: slideUp 0.3s ease-out;
}

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

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

.pwa-install-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}

.pwa-install-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pwa-install-text strong {
    font-size: 15px;
}

.pwa-install-text span {
    font-size: 13px;
    color: var(--text-secondary);
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-install-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--ai-badge-start), var(--ai-badge-end));
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.pwa-install-btn:hover {
    opacity: 0.9;
}

.pwa-dismiss-btn {
    width: 32px;
    height: 32px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-dismiss-btn:hover {
    background: var(--border-color);
}

/* 更新提示 */
.pwa-update-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    padding: 12px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 9999;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.pwa-update-toast button {
    padding: 6px 16px;
    border-radius: 16px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.pwa-update-toast button:first-of-type {
    background: linear-gradient(135deg, var(--ai-badge-start), var(--ai-badge-end));
    color: white;
}

.pwa-update-toast button:last-of-type {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* 离线提示 */
.pwa-offline-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff9800;
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 离线模式样式 */
body.is-offline::before {
    content: '📴 离线模式';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff9800;
    color: white;
    text-align: center;
    padding: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 99999;
}

/* PWA 独立模式优化 */
@media (display-mode: standalone) {
    /* 添加安全区域适配 */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    /* 隐藏浏览器默认滚动条 */
    ::-webkit-scrollbar {
        width: 0;
    }
    
    /* 优化触摸反馈 */
    button, a {
        -webkit-tap-highlight-color: transparent;
    }
}

/* iOS 状态栏适配 */
@supports (-webkit-touch-callout: none) {
    @media (display-mode: standalone) {
        #header {
            padding-top: env(safe-area-inset-top);
        }
        
        .tt-bottom-nav {
            padding-bottom: env(safe-area-inset-bottom);
        }
    }
}
