/* ============================================================
 * PitLog 公共组件样式（Toast / 弹窗 / 确认框 / 加载层 / 任务栏）
 * 复用 app.css 中的设计变量与 .btn 按钮类
 * ============================================================ */

/* ===================== Toast 轻提示 ===================== */
.pit-toast {
    position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
    z-index: 9999; display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
}
.pit-toast-item {
    min-width: 200px; max-width: 420px; padding: 11px 16px; border-radius: 12px;
    font-size: 14px; font-weight: 500; color: #fff; box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
    opacity: 0; transform: translateY(-10px); transition: opacity .25s, transform .25s;
    pointer-events: auto;
}
.pit-toast-show { opacity: 1; transform: translateY(0); }
.pit-toast-hide { opacity: 0; transform: translateY(-10px); }
.pit-toast-info { background: #334155; }
.pit-toast-success { background: #16a34a; }
.pit-toast-error { background: #dc2626; }
.pit-toast-warn { background: #d97706; }

/* ===================== 弹窗 ===================== */
.pit-modal-mask {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .42);
    display: flex; align-items: flex-start; justify-content: center;
    z-index: 1000; padding: 6vh 16px;
}
.pit-modal {
    position: fixed; z-index: 1001; min-width: 320px; max-width: calc(100vw - 32px);
    /* 限高：内容过长时正文内部滚动，标题栏/底部按钮始终可见，不再超出视口 */
    max-height: calc(100vh - 48px);
    background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
    display: flex; flex-direction: column; overflow: hidden;
    animation: pit-modal-in .18s ease-out;
}
@keyframes pit-modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.pit-modal-max { left: 16px !important; top: 16px !important; width: calc(100vw - 32px) !important; height: calc(100vh - 32px) !important; max-width: none !important; max-height: none !important; }
.pit-modal-max .pit-modal-body { flex: 1; overflow: auto; }

.pit-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--border, #eef2f7); cursor: move;
    user-select: none;
}
.pit-modal-title { font-size: 15px; font-weight: 700; color: var(--text, #0f172a); }
.pit-modal-tools { display: flex; align-items: center; gap: 6px; }
.pit-mt-btn {
    width: 28px; height: 28px; border: none; border-radius: 8px; cursor: pointer;
    background: transparent; color: var(--text-2, #64748b); font-size: 14px; line-height: 1;
    transition: background .15s, color .15s;
}
.pit-mt-btn:hover { background: var(--border-soft, #f1f5f9); color: var(--primary, #2563eb); }

.pit-modal-body { padding: 18px 16px; color: var(--text, #0f172a); font-size: 14px; flex: 1 1 auto; min-height: 0; overflow: auto; }

/* 弹窗缩放手柄（八方向） */
.pit-resize { position: absolute; z-index: 3; }
.pit-resize-n { top: 0; left: 12px; right: 12px; height: 6px; cursor: ns-resize; }
.pit-resize-s { bottom: 0; left: 12px; right: 12px; height: 6px; cursor: ns-resize; }
.pit-resize-e { right: 0; top: 12px; bottom: 12px; width: 6px; cursor: ew-resize; }
.pit-resize-w { left: 0; top: 12px; bottom: 12px; width: 6px; cursor: ew-resize; }
.pit-resize-ne { top: 0; right: 0; width: 15px; height: 15px; cursor: nesw-resize; }
.pit-resize-nw { top: 0; left: 0; width: 15px; height: 15px; cursor: nwse-resize; }
.pit-resize-se { bottom: 0; right: 0; width: 15px; height: 15px; cursor: nwse-resize; }
.pit-resize-sw { bottom: 0; left: 0; width: 15px; height: 15px; cursor: nesw-resize; }
.pit-modal-max .pit-resize { display: none; }
.pit-modal-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 12px 16px; border-top: 1px solid var(--border, #eef2f7);
}

.pit-confirm-body { font-size: 14px; line-height: 1.6; color: var(--text-2, #475569); padding: 4px 2px; }

/* ===================== 全屏加载层 ===================== */
.pit-loading {
    position: fixed; inset: 0; background: rgba(255, 255, 255, .55);
    display: flex; align-items: center; justify-content: center; z-index: 2000;
}
.pit-spinner {
    width: 38px; height: 38px; border-radius: 50%;
    border: 4px solid var(--border-soft, #e2e8f0); border-top-color: var(--primary, #2563eb);
    animation: pit-spin .8s linear infinite;
}
@keyframes pit-spin { to { transform: rotate(360deg); } }

/* ===================== 最小化任务栏 ===================== */
.pit-taskbar {
    position: fixed; right: 18px; bottom: 18px; z-index: 1500;
    display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.pit-task-pill {
    padding: 9px 14px; border: 1px solid var(--border, #eef2f7); border-radius: 10px;
    background: #fff; color: var(--text, #0f172a); font-size: 13px; font-weight: 500;
    cursor: pointer; box-shadow: 0 8px 20px rgba(15, 23, 42, .14); transition: background .15s;
}
.pit-task-pill:hover { background: var(--border-soft, #f1f5f9); }

/* ===================== API 文档（页面与弹窗共用） ===================== */
.doc-layout { display: flex; gap: 22px; align-items: flex-start; }
.doc-nav { flex: 0 0 192px; position: sticky; top: 0;
           background: var(--surface); border: 1px solid var(--border-soft);
           border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow-sm); }
.doc-nav .nav-title { font-size: 12px; color: var(--muted); padding: 6px 10px 8px; letter-spacing: .04em; }
.doc-nav a { display: block; padding: 11px 12px; border-radius: 9px; font-size: 14px;
             color: var(--text-2); text-decoration: none; cursor: pointer;
             transition: background .15s, color .15s; margin-bottom: 2px; }
.doc-nav a:hover { background: #f1f5f9; }
.doc-nav a.active { background: var(--primary); color: #fff; font-weight: 600; }
.doc-main { flex: 1; min-width: 0; }
.doc-panel { display: none; }
.doc-panel.active { display: block; animation: pit-doc-fade .2s ease; }
@keyframes pit-doc-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.doc-card { background: var(--surface); border: 1px solid var(--border-soft);
            border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px 24px; }
.doc-card h3 { font-size: 17px; font-weight: 700; margin: 0 0 14px; }
.doc-card h4 { font-size: 14px; font-weight: 700; margin: 18px 0 8px; color: var(--text); }
.doc-card p { font-size: 14px; line-height: 1.85; color: var(--text-2); margin: 8px 0; }
.doc-card .lead { font-size: 14px; color: var(--muted); margin: 0 0 16px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc-table th, .doc-table td { border: 1px solid var(--border-soft, #eef1f5);
                               padding: 9px 12px; text-align: left; vertical-align: top; }
.doc-table th { background: #f8fafc; font-weight: 600; white-space: nowrap; }
.doc-table code, p code, td code, h4 code {
    font-family: Consolas, Monaco, monospace; font-size: 13px;
    background: #f1f5f9; border-radius: 5px; padding: 1px 6px; color: #0f172a; }
.doc-code { position: relative; background: #0f172a; border-radius: 12px;
            padding: 16px 18px; overflow-x: auto; margin: 12px 0; }
.doc-code pre { margin: 0; }
.doc-code code { background: none; padding: 0; color: #e2e8f0;
                 font-family: Consolas, Monaco, monospace; font-size: 13px;
                 line-height: 1.75; white-space: pre; }
.doc-code .copy { position: absolute; top: 10px; right: 10px;
                  font-size: 12px; color: #cbd5e1; background: rgba(255,255,255,.08);
                  border: 1px solid rgba(255,255,255,.16); border-radius: 7px;
                  padding: 4px 10px; cursor: pointer; transition: background .15s; }
.doc-code .copy:hover { background: rgba(255,255,255,.18); }
.doc-tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 6px;
           background: #fee2e2; color: #dc2626; margin-left: 4px; font-weight: 600; }
.doc-opt { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 6px;
           background: #f1f5f9; color: #64748b; margin-left: 4px; }
.req-table td:first-child { white-space: nowrap; }
@media (max-width: 760px) {
    .doc-layout { flex-direction: column; }
    .doc-nav { position: static; flex: none; width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
    .doc-nav .nav-title { display: none; }
    .doc-nav a { margin: 0; }
}

/* ===================== 管理员范围开关 ===================== */
.scope-switch {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 16px; padding: 8px 14px;
    background: #fff; border: 1px solid #e7eaf0; border-radius: 12px;
    width: fit-content; box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.scope-switch .scope-label {
    font-size: 13px; color: #475569; font-weight: 500; white-space: nowrap;
}
.scope-switch .switch {
    position: relative; display: inline-block; width: 44px; height: 24px; flex: none;
}
.scope-switch .switch input { opacity: 0; width: 0; height: 0; }
.scope-switch .slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #cbd5e1; border-radius: 999px; transition: .2s;
}
.scope-switch .slider::before {
    content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.scope-switch .switch input:checked + .slider { background: #2563eb; }
.scope-switch .switch input:checked + .slider::before { transform: translateX(20px); }

/* 作者标签（列表元信息行） */
.chip.author-chip {
    background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;
}
