/**
 * PWA 相关样式
 * @author ningning.cheng
 */

/* 网络状态指示器 */
.network-status {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 8px 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.network-status.online {
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    color: white;
    transform: translateY(-100%);
    opacity: 0;
}

.network-status.online.show {
    transform: translateY(0);
    opacity: 1;
}

.network-status.offline {
    background: linear-gradient(90deg, #f44336, #ff5722);
    color: white;
}

.network-status-icon {
    margin-right: 8px;
}

/* 安装提示横幅 */
.install-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 400px;
    margin: 0 auto;
    background: linear-gradient(135deg, #e91e63 0%, #9c27b0 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(233, 30, 99, 0.3);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 9998;
    animation: slideUp 0.4s ease;
}

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

.install-banner-icon {
    font-size: 32px;
    flex-shrink: 0;
}

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

.install-banner-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.install-banner-desc {
    font-size: 13px;
    opacity: 0.9;
}

.install-banner-actions {
    display: flex;
    gap: 8px;
}

.install-banner .btn-install {
    background: white;
    color: #e91e63;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.install-banner .btn-install:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.install-banner .btn-dismiss {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.install-banner .btn-dismiss:hover {
    border-color: white;
}

/* 同步状态指示 */
.sync-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--color-bg-tertiary, #f0f0f0);
    color: var(--color-text-secondary, #666);
}

.sync-status.syncing {
    background: #e3f2fd;
    color: #1976d2;
}

.sync-status.pending {
    background: #fff3e0;
    color: #f57c00;
}

.sync-status.synced {
    background: #e8f5e9;
    color: #388e3c;
}

.sync-status-icon {
    display: inline-flex;
}

.sync-status.syncing .sync-status-icon svg {
    animation: spin 1s linear infinite;
}

/* 更新提示 */
.update-banner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9997;
    animation: slideLeft 0.4s ease;
}

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

.update-banner-icon {
    font-size: 24px;
}

.update-banner-content {
    flex: 1;
}

.update-banner-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.update-banner-desc {
    font-size: 13px;
    color: #666;
}

.update-banner .btn-update {
    background: #e91e63;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
}

.update-banner .btn-update:hover {
    background: #c2185b;
}

/* 离线指示器 */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #424242;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9996;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.offline-indicator-dot {
    width: 8px;
    height: 8px;
    background: #f44336;
    border-radius: 50%;
    animation: blink 1.5s ease-in-out infinite;
}

/* 待同步徽章 */
.pending-sync-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    background: #ff5722;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* 暗色主题适配 */
[data-theme="dark"] .install-banner {
    background: linear-gradient(135deg, #ad1457 0%, #6a1b9a 100%);
}

[data-theme="dark"] .update-banner {
    background: #2d2d2d;
}

[data-theme="dark"] .update-banner-title {
    color: #fff;
}

[data-theme="dark"] .update-banner-desc {
    color: #aaa;
}

[data-theme="dark"] .sync-status {
    background: #333;
    color: #aaa;
}

[data-theme="dark"] .sync-status.syncing {
    background: #1a3a52;
    color: #64b5f6;
}

[data-theme="dark"] .sync-status.pending {
    background: #3d3020;
    color: #ffb74d;
}

[data-theme="dark"] .sync-status.synced {
    background: #1d3d24;
    color: #81c784;
}

/* 移动端适配 */
@media (max-width: 480px) {
    .install-banner {
        left: 10px;
        right: 10px;
        bottom: 10px;
        flex-direction: column;
        text-align: center;
    }

    .install-banner-actions {
        width: 100%;
        justify-content: center;
    }

    .update-banner {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
}
