/* addon.css —— 前后端分离版新增组件 */

/* ---------------- 首屏加载遮罩 ---------------- */
.app-loading {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-warm);
}
.app-loading .loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
}
.app-loading .loading-box p { font-size: 14px; }
.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: wb-spin .8s linear infinite;
}
@keyframes wb-spin { to { transform: rotate(360deg); } }

/* ---------------- 同步状态指示器 ---------------- */
.sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
    background: var(--border-light);
    color: var(--text-secondary);
    transition: background .2s, color .2s;
}
.sync-indicator i { font-size: 7px; }
.sync-indicator.sync-loaded,
.sync-indicator.sync-reloaded,
.sync-indicator.sync-synced { background: var(--primary-lighter); color: var(--primary); }
.sync-indicator.sync-syncing { background: var(--accent-blue-light); color: var(--accent-blue); }
.sync-indicator.sync-syncing i { animation: wb-pulse 1s ease-in-out infinite; }
.sync-indicator.sync-error { background: rgba(220, 38, 38, .14); color: #DC2626; }
@keyframes wb-pulse { 50% { opacity: .25; } }

@media (max-width: 900px) {
    .sync-indicator span { display: none; }
    .sync-indicator { padding: 0 9px; }
}

/* ---------------- 顶栏按钮 / 用户菜单 ---------------- */
button.topbar-icon {
    border: none;
    cursor: pointer;
    font: inherit;
    background: transparent;
    padding: 0;
}
.user-menu { position: relative; }
button.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    cursor: pointer;
    font: inherit;
    color: var(--text-primary);
    transition: background .15s, border-color .15s;
}
button.user-info:hover { background: var(--border-light); border-color: var(--border); }
.user-caret { font-size: 10px; color: var(--text-muted); transition: transform .18s; }
.user-menu.open .user-caret { transform: rotate(180deg); }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 176px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 6px;
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .16s, transform .16s, visibility .16s;
}
.user-menu.open .user-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
}
.user-dropdown a:hover { background: var(--border-light); }
.user-dropdown a i { width: 14px; text-align: center; color: var(--text-secondary); }
.user-dropdown a.danger { color: #DC2626; }
.user-dropdown a.danger i { color: #DC2626; }
.user-dropdown-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------------- 登录页 ---------------- */
.login-body {
    overflow: auto;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1000px 520px at 12% -10%, var(--primary-lighter), transparent 60%),
        radial-gradient(900px 480px at 108% 110%, var(--accent-blue-light), transparent 60%),
        var(--bg-warm);
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 30px;
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand h1 { font-size: 19px; font-weight: 600; color: var(--text-primary); }
.login-brand p { margin-top: 6px; font-size: 12px; color: var(--text-secondary); }

.login-field { position: relative; }
.login-field > i:first-child {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-muted);
    pointer-events: none;
}
.login-field .form-control { padding-left: 34px; height: 42px; }
.login-eye {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.login-eye:hover { color: var(--text-secondary); background: var(--border-light); }

.login-error {
    display: none;
    margin-bottom: 14px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: rgba(220, 38, 38, .10);
    border: 1px solid rgba(220, 38, 38, .28);
    color: #DC2626;
    font-size: 12.5px;
}
.login-error.show { display: block; }

.login-submit {
    width: 100%;
    height: 42px;
    justify-content: center;
    font-size: 15px;
    gap: 8px;
}
.login-submit:disabled { opacity: .7; cursor: not-allowed; }

.login-foot {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}
.login-copyright { margin-top: 18px; text-align: center; font-size: 12px; color: var(--text-muted); }
.login-icp { width: 100%; margin-top: 4px; text-align: center; font-size: 12px; color: var(--text-muted); }
.login-icp a { display: inline-block; color: var(--text-muted); text-decoration: none; text-align: center; }
.login-icp a:hover { color: var(--text-secondary); }

.hamburger { display: none; }
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 99;
}

/* ---------------- 小屏适配 ---------------- */
@media (max-width: 768px) {
    .hamburger { display: flex; }
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; z-index: 100; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
    .sidebar.open + .sidebar-backdrop { display: block; }
    .main { width: 100%; }
    .search-box { display: none; }
    .topbar-left { gap: 12px; }
}
