/**
 * B2 PWA Pro - 前端样式
 * 兼容 B2 PRO 和 极主题(jitheme) 的暗黑模式和CSS变量
 * 注意：所有选择器均使用 b2-pwa- 前缀，避免与主题冲突
 */

/* ── 推送订阅按钮 ── */
.b2-pwa-subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--b2color, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1.5;
}

.b2-pwa-subscribe-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.b2-pwa-subscribe-btn.subscribed {
    background: #22c55e;
    cursor: default;
    opacity: 0.85;
}

.b2-pwa-subscribe-btn:disabled {
    opacity: 0.7;
    cursor: default;
}

.style-for-dark .b2-pwa-subscribe-btn {
    background: #22c55e;
}

.style-for-dark .b2-pwa-subscribe-btn.subscribed {
    background: #16a34a;
}

/* ── 离线指示器（默认隐藏，JS控制显示） ── */
.b2-pwa-offline-indicator {
    display: none;
}

.b2-pwa-offline-indicator.b2-pwa-visible {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #f59e0b;
    color: #fff;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    z-index: 999999;
}

/* ── 更新提示（默认隐藏） ── */
.b2-pwa-update-toast {
    display: none;
}

.b2-pwa-update-toast.b2-pwa-visible {
    display: flex;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--main-bg-color, #ffffff);
    color: var(--key-color, #1e293b);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 999999;
    align-items: center;
    gap: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    max-width: 90vw;
    white-space: nowrap;
}

.b2-pwa-update-toast .b2-pwa-update-btn {
    background: var(--b2color, #3b82f6);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}

.b2-pwa-update-toast .b2-pwa-update-btn:hover {
    opacity: 0.85;
}

.b2-pwa-update-toast .b2-pwa-close-btn {
    background: none;
    border: none;
    color: var(--this-text, #94a3b8);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.style-for-dark .b2-pwa-update-toast.b2-pwa-visible {
    background: #1e293b;
    color: #e2e8f0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.style-for-dark .b2-pwa-update-toast .b2-pwa-close-btn {
    color: #64748b;
}

/* ── 独立应用模式下的隐藏类 ── */
@media (display-mode: standalone) {
    .b2-pwa-hide-standalone {
        display: none;
    }
}

@media (display-mode: fullscreen) {
    .b2-pwa-hide-fullscreen {
        display: none;
    }
}
