/* ===== Unified Account Picker 样式 =====
 *
 * 用于 dashboard/js/account-picker.js 的 modal 形态 + inline 形态。
 * 所有颜色/圆角/阴影均读取项目 CSS 变量（variables.css / dark-mode.css），
 * 暗色模式自动适配。
 */

/* ───────── Modal mask + dialog ───────── */
.acp-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: acpFadeIn .15s ease-out;
}
@keyframes acpFadeIn {
  from { opacity: 0 }
  to { opacity: 1 }
}

.acp-dialog {
  background: var(--md-surface);
  color: var(--md-on-surface);
  border: 1px solid var(--md-surface-3);
  border-radius: var(--radius-md, 14px);
  box-shadow: var(--shadow-2, 0 8px 24px rgba(0, 0, 0, .35));
  width: 720px;
  max-width: 92vw;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ───────── Header ───────── */
.acp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--md-surface-3);
}
.acp-head-text { flex: 1; min-width: 0 }
.acp-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--md-on-surface);
}
.acp-subtitle {
  font-size: 11px;
  color: var(--md-outline);
  margin-top: 3px;
}
.acp-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--md-outline);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: inherit;
  display: flex;
  align-items: center;
}
.acp-close:hover {
  background: var(--md-surface-2);
  color: var(--md-on-surface);
}
.acp-close .material-symbols-outlined { font-size: 18px }

/* ───────── Root 区（search + body + footer，供 modal/inline 共用） ───────── */
.acp-root {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.acp-inline .acp-root {
  border: 1px solid var(--md-surface-3);
  border-radius: var(--radius-sm, 10px);
  overflow: hidden;
}

.acp-search {
  padding: 12px 20px;
  border-bottom: 1px solid var(--md-surface-3);
}
.acp-inline .acp-search {
  padding: 10px 12px;
}
.acp-search input {
  width: 100%;
  padding: 8px 12px;
  background: var(--md-surface-1);
  color: var(--md-on-surface);
  border: 1px solid var(--md-surface-3);
  border-radius: var(--radius-sm, 10px);
  outline: none;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}
.acp-search input::placeholder { color: var(--md-outline) }
.acp-search input:focus {
  border-color: var(--md-primary);
  box-shadow: 0 0 0 2px rgba(61, 128, 255, .15);
}

/* ───────── Body 表格 ───────── */
.acp-body {
  flex: 1;
  overflow: auto;
  min-height: 240px;
}
.acp-inline .acp-body {
  max-height: 280px;
  min-height: 180px;
}

.acp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.acp-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--md-surface-2);
  color: var(--md-on-surface-variant);
  font-weight: 600;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--md-surface-3);
}
.acp-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--md-surface-3);
  vertical-align: middle;
  color: var(--md-on-surface);
}
.acp-table tbody tr:hover td {
  background: rgba(61, 128, 255, .05);
}

.acp-table input[type="checkbox"],
.acp-table input[type="radio"] {
  accent-color: var(--md-primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.acp-col-cb {
  width: 44px;
  text-align: center;
}
.acp-col-state {
  width: 96px;
  color: var(--md-on-surface-variant);
}

.acp-name-line {
  font-weight: 600;
  font-size: 13px;
  color: var(--md-on-surface);
}
.acp-id-line {
  font-size: 11px;
  color: var(--md-outline);
  font-family: var(--font-family-mono, 'JetBrains Mono', monospace);
  margin-top: 2px;
}
.acp-scope {
  font-family: inherit;
  color: var(--md-on-surface-variant);
}

.acp-loading,
.acp-empty {
  padding: 40px 12px !important;
  text-align: center;
  color: var(--md-outline);
}

/* ───────── Footer ───────── */
.acp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  border-top: 1px solid var(--md-surface-3);
  background: var(--md-surface);
  font-size: 11px;
  color: var(--md-outline);
}
.acp-inline .acp-footer {
  padding: 8px 12px;
  background: var(--md-surface-1);
}
.acp-info strong {
  color: var(--md-primary);
  font-weight: 700;
}

.acp-pager {
  display: flex;
  gap: 6px;
  align-items: center;
}
.acp-pager-btn {
  font-size: 11px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--md-surface-3);
  color: var(--md-on-surface);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.acp-pager-btn:hover:not(:disabled) { background: var(--md-surface-2) }
.acp-pager-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ───────── Action bar（仅 modal 形态） ───────── */
.acp-action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--md-surface-3);
  background: var(--md-surface);
}
.acp-btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm, 10px);
  border: 1px solid var(--md-surface-3);
  background: transparent;
  color: var(--md-on-surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
}
.acp-btn:hover:not(:disabled) { background: var(--md-surface-2) }
.acp-btn-primary {
  background: var(--md-primary);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}
.acp-btn-primary:hover:not(:disabled) { filter: brightness(1.08) }
.acp-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ───────── 暗色模式特例（如 variables 未完全覆盖时兜底） ───────── */
[data-theme="dark"] .acp-table input[type="checkbox"],
[data-theme="dark"] .acp-table input[type="radio"] {
  accent-color: var(--md-primary);
}

/* ───────── 批量 ID 模式 / 全选所有匹配 bar ───────── */
.acp-batch-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 12px;
  margin: 6px 0 4px;
  border-radius: var(--radius-sm, 8px);
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  font-size: 12px;
  line-height: 1.5;
}
.acp-batch-info { color: inherit; }
.acp-batch-info strong { color: inherit; font-weight: 700; }
.acp-link-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--md-primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: inherit;
}
.acp-link-btn:hover { background: rgba(0,0,0,.05); }
.acp-link-btn-muted { color: var(--md-on-surface-variant); font-weight: 500; }
[data-theme="dark"] .acp-link-btn:hover { background: rgba(255,255,255,.06); }
