/* ============================================================
   dialogs.css —— 添加分类 / 添加网站 / 扩展 小弹窗 + 自定义确认弹窗
   深色主题（复用 --auth-* 变量）的通用 mini 弹窗外壳、表单字段、
   分类图标选择网格。弹窗动画 keyframes auth-in 定义在 base.css。
   ============================================================ */

/* ===== 全局自定义确认弹窗（替代 window.confirm） ===== */
.confirm-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: auth-in 0.18s ease;
}
.confirm-mask.show { display: flex; }
.confirm-dialog {
    width: 340px;
    max-width: calc(100vw - 48px);
    background: var(--auth-card);
    border: 1px solid var(--auth-line);
    border-radius: 16px;
    padding: 22px 22px 18px;
    color: var(--auth-text);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    animation: auth-in 0.2s ease;
}
.confirm-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--auth-text);
}
.confirm-msg {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--auth-muted);
}
.confirm-msg strong { color: var(--auth-danger); font-weight: 600; }
.confirm-foot {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.confirm-btn {
    min-width: 72px;
    height: 36px;
    padding: 0 18px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.confirm-btn-cancel {
    background: transparent;
    border: 1px solid var(--auth-line);
    color: var(--auth-muted);
}
.confirm-btn-cancel:hover { background: var(--auth-card-2); color: var(--auth-text); }
.confirm-btn-ok {
    background: var(--auth-brand);
    border: 1px solid var(--auth-brand);
    color: #fff;
}
.confirm-btn-ok:hover { background: var(--auth-brand-hover); border-color: var(--auth-brand-hover); }
.confirm-btn-ok.is-danger {
    background: var(--auth-danger);
    border-color: var(--auth-danger);
}
.confirm-btn-ok.is-danger:hover { background: var(--auth-danger-hover); border-color: var(--auth-danger-hover); }

/* ===== 添加分类 / 添加网站 / 扩展 小弹窗（复用账号弹窗配色） ===== */
.mini-mask {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 2200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* 添加分类弹窗：不靠屏幕居中，而是停靠在左侧侧边栏（宽 60px）旁边，间距 48px */
#categoryModal.mini-mask {
    justify-content: flex-start;
    padding-left: calc(60px + 40px);
}
.mini-dialog {
    position: relative;
    width: 380px;
    max-width: calc(100vw - 48px);
    background: var(--auth-card);
    border: 1px solid var(--auth-line);
    border-radius: 18px;
    padding: 24px;
    color: var(--auth-text);
    animation: auth-in 0.22s ease;
}
.mini-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    color: var(--auth-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.mini-close:hover { color: var(--auth-text); }
.mini-title { margin: 0; font-size: 18px; font-weight: 700; }
.mini-sub { margin: 6px 0 18px; font-size: 13px; color: var(--auth-muted); }
.mini-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.mini-field label { font-size: 13px; color: var(--auth-muted); }
.mini-field input {
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--auth-line);
    background: var(--auth-bg);
    color: var(--auth-text);
    font-size: 14px;
    outline: none;
}
.mini-field input:focus { border-color: var(--auth-brand); }
.mini-field select {
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--auth-line);
    background: var(--auth-bg);
    color: var(--auth-text);
    font-size: 14px;
    outline: none;
    cursor: pointer;
}
.mini-field select:focus { border-color: var(--auth-brand); }
.mini-field select option { background: var(--auth-card); color: var(--auth-text); }
.mini-error {
    display: none;
    margin: -4px 0 10px;
    padding: 8px 11px;
    background: var(--auth-danger-bg);
    border: 1px solid var(--auth-danger-border);
    border-radius: 9px;
    color: var(--auth-danger);
    font-size: 12px;
}
.mini-error.show { display: block; }
.mini-foot { display: flex; gap: 12px; margin-top: 4px; }
.mini-btn {
    flex: 1;
    height: 40px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.mini-btn-ghost {
    background: var(--auth-card);
    border: 1px solid var(--auth-line);
    color: var(--auth-text);
}
.mini-btn-ghost:hover { background: var(--auth-card-2); }
.mini-btn-primary {
    background: var(--auth-brand);
    border: 1px solid var(--auth-brand);
    color: #fff;
}
.mini-btn-primary:hover { background: var(--auth-brand-hover); }
.mini-btn:disabled { opacity: 0.6; cursor: default; }

/* 分类图标选择网格：6 列排布，图标整齐填满 */
.cat-icon-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}
.cat-icon-btn {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-on-white);
    border-radius: 12px;
    border: 1px solid var(--auth-line);
    background: var(--auth-bg);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, color 0.15s ease;
}
.cat-icon-btn .icon {
    width: 24px;
    height: 24px;
}
.cat-icon-btn:hover { background: var(--auth-card-2); color: var(--auth-text); }
.cat-icon-btn.selected {
    border-color: var(--auth-brand);
    background: var(--auth-sel-bg);
    color: var(--auth-brand-text);
    transform: scale(1.06);
}
.cat-icon-btn { position: relative; }
.cat-icon-tip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--auth-tip-bg);
    border: 1px solid var(--auth-line);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 5px 8px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
    z-index: 10;
}
.cat-icon-btn:hover .cat-icon-tip,
.cat-icon-btn:focus-visible .cat-icon-tip { opacity: 1; }
