/* 由 views/layouts/main.handlebars 內嵌區塊搬出 (每頁共用，可被瀏覽器快取) */
/* ID selectors below set display:flex, which would otherwise override the
   UA [hidden]{display:none} rule. Re-assert hidden at higher specificity. */
#offline-status-pill[hidden],
#offline-failed-modal[hidden] { display: none !important; }

#offline-status-pill {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 9999;
    background: rgba(33, 37, 41, 0.92);
    color: #fff;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}
#offline-status-pill.osp-clickable { cursor: pointer; }
#offline-status-pill.osp-clickable:hover { background: rgba(33, 37, 41, 1); }
#offline-status-pill .osp-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #27ae60;
}
#offline-status-pill.osp-offline .osp-dot { background: #e74c3c; }
#offline-status-pill.osp-pending .osp-dot { background: #f39c12; }
#offline-status-pill.osp-syncing .osp-dot { background: #3498db; animation: osp-pulse 1.2s infinite; }
#offline-status-pill.osp-failed { background: rgba(192, 57, 43, 0.95); }
#offline-status-pill.osp-failed .osp-dot { background: #fff; }
#offline-status-pill.osp-auth { background: rgba(155, 89, 182, 0.95); }
#offline-status-pill.osp-auth .osp-dot { background: #fff; }
@keyframes osp-pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

#offline-failed-modal {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
}
#offline-failed-modal .ofm-backdrop {
    position: absolute; inset: 0; background: rgba(0,0,0,0.5);
}
#offline-failed-modal .ofm-card {
    position: relative; background: #fff; border-radius: 8px;
    width: min(560px, 92vw); max-height: 80vh; display: flex; flex-direction: column;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
#offline-failed-modal .ofm-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid #eee;
}
#offline-failed-modal .ofm-header h3 { margin: 0; font-size: 16px; }
#offline-failed-modal .ofm-close {
    background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer; color: #666;
}
#offline-failed-modal .ofm-help {
    margin: 0; padding: 10px 18px; color: #666; font-size: 13px; background: #f8f9fa;
}
#offline-failed-modal .ofm-list {
    list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1;
}
#offline-failed-modal .ofm-list li {
    padding: 12px 18px; border-bottom: 1px solid #eee;
    display: flex; align-items: flex-start; gap: 10px;
}
#offline-failed-modal .ofm-meta { flex: 1; min-width: 0; }
#offline-failed-modal .ofm-title { font-weight: 600; color: #333; }
#offline-failed-modal .ofm-detail {
    color: #888; font-size: 12px; margin-top: 4px; word-break: break-word;
}
#offline-failed-modal .ofm-actions { display: flex; gap: 6px; flex-shrink: 0; }
#offline-failed-modal .ofm-footer {
    padding: 12px 18px; border-top: 1px solid #eee; display: flex; gap: 8px; justify-content: flex-end;
}
#offline-failed-modal .ofm-btn {
    padding: 6px 12px; font-size: 13px; border-radius: 4px; border: 1px solid transparent; cursor: pointer;
}
#offline-failed-modal .ofm-btn-primary { background: #3498db; color: #fff; }
#offline-failed-modal .ofm-btn-danger { background: #e74c3c; color: #fff; }
#offline-failed-modal .ofm-btn-ghost { background: #fff; color: #555; border-color: #ddd; }
#offline-failed-modal .ofm-empty {
    padding: 28px; text-align: center; color: #888;
}

