/* AI Batch Pro - 共享样式 */

/* ================= 全局重置 ================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ================= Toast 通知 ================= */
.abp-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  animation: abpSlideIn 0.3s ease;
  backdrop-filter: blur(12px);
  max-width: 420px;
}

.abp-toast-success {
  background: rgba(52, 199, 89, 0.95);
  color: white;
}

.abp-toast-error {
  background: rgba(255, 59, 48, 0.95);
  color: white;
}

.abp-toast-warning {
  background: rgba(255, 149, 0, 0.95);
  color: white;
}

.abp-toast-info {
  background: rgba(0, 122, 255, 0.95);
  color: white;
}

.abp-toast-hide {
  animation: abpSlideOut 0.3s ease forwards;
}

@keyframes abpSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes abpSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ================= Modal 对话框 ================= */
.abp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: abpFadeIn 0.2s ease;
}

.abp-modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.2);
  max-width: 480px;
  width: 90%;
  overflow: hidden;
  animation: abpScaleIn 0.2s ease;
}

.abp-modal-header {
  padding: 20px 24px 0;
}

.abp-modal-header h3 {
  font-size: 17px;
  font-weight: 600;
  color: #1d1d1f;
}

.abp-modal-body {
  padding: 12px 24px 20px;
  font-size: 14px;
  color: #6e6e73;
  line-height: 1.5;
}

.abp-modal-footer {
  padding: 12px 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ================= 按钮 ================= */
.abp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.abp-btn:active {
  transform: scale(0.97);
}

.abp-btn-primary {
  background: #0071e3;
  color: white;
}
.abp-btn-primary:hover {
  background: #0077ed;
}

.abp-btn-secondary {
  background: #e8e8ed;
  color: #1d1d1f;
}
.abp-btn-secondary:hover {
  background: #d1d1d6;
}

.abp-btn-danger {
  background: #ff3b30;
  color: white;
}
.abp-btn-danger:hover {
  background: #d32f2f;
}

.abp-btn-success {
  background: #34c759;
  color: white;
}
.abp-btn-success:hover {
  background: #28a745;
}

.abp-btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
}

/* ================= 输入框 ================= */
.abp-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #d2d2d7;
  border-radius: 10px;
  font-size: 14px;
  background: white;
  transition: all 0.2s;
  outline: none;
  color: #1d1d1f;
}
.abp-input:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0,113,227,0.15);
}

.abp-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #d2d2d7;
  border-radius: 10px;
  font-size: 13px;
  font-family: 'SF Mono', 'JetBrains Mono', monospace;
  background: white;
  transition: all 0.2s;
  outline: none;
  resize: vertical;
  color: #1d1d1f;
}
.abp-textarea:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0,113,227,0.15);
}

/* ================= 选择器 ================= */
.abp-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #d2d2d7;
  border-radius: 10px;
  font-size: 14px;
  background: white;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236e6e73' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
  outline: none;
}
.abp-select:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0,113,227,0.15);
}

/* ================= 卡片 ================= */
.abp-card {
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  border: 1px solid #f0f0f2;
  overflow: hidden;
}

.abp-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.abp-card-body {
  padding: 20px;
}

/* ================= 标签 ================= */
.abp-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.abp-badge-active {
  background: #34c759;
  color: white;
}
.abp-badge-pending {
  background: #ff9f0a;
  color: white;
}
.abp-badge-inactive {
  background: #8e8e93;
  color: white;
}

@keyframes abpFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes abpScaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ================= Dark mode select options fix ================= */
select, select option {
  background: #1a1a22;
  color: #e8e8ed;
}
[data-theme="light"] select, [data-theme="light"] select option {
  background: #ffffff;
  color: #1a1d21;
}
.strategy-select-wrapper select, .mapping-row select {
  -webkit-appearance: none;
  appearance: none;
}

/* ================= 滚动条美化 ================= */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #c7c7cc;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #a8a8ad;
}

/* ================= 状态动画 ================= */
@keyframes abpPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.abp-pulse {
  animation: abpPulse 2s ease-in-out infinite;
}

/* ================= 表格 ================= */
.abp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.abp-table th {
  background: #f5f5f7;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #6e6e73;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e8e8ed;
}

.abp-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f2;
  color: #1d1d1f;
}

.abp-table tr:hover td {
  background: #fafafa;
}

/* ================= 加载 Spinner ================= */
.abp-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid #e8e8ed;
  border-top-color: #0071e3;
  border-radius: 50%;
  animation: abpSpin 0.6s linear infinite;
}

@keyframes abpSpin {
  to { transform: rotate(360deg); }
}

/* ================= Light Theme - 完全重写 ================= */
[data-theme="light"] {
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f7fa;
  --border: #d9dde3;
  --border-light: #e4e8ed;
  --text: #1a1d21;
  --text-secondary: #5f6b7a;
  --text-dim: #8e96a3;
  --primary: #4f6ef7;
  --primary-hover: #3b5de7;
  --primary-glow: rgba(79,110,247,0.1);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
}

/* 登录页 */
[data-theme="light"] body {
  background: #f0f2f5;
  color: #1a1d21;
}
[data-theme="light"] #loginPage {
  background: linear-gradient(135deg, #e8ecf1 0%, #f0f2f5 50%, #e0e6ed 100%);
}
[data-theme="light"] #loginPage::before {
  background: radial-gradient(circle at 30% 50%, rgba(79,110,247,0.04) 0%, transparent 50%);
}
[data-theme="light"] .login-container {
  background: #ffffff;
  border-color: #d9dde3;
  box-shadow: 0 8px 40px rgba(0,0,0,0.06);
}
[data-theme="light"] .login-logo .logo-icon {
  background: linear-gradient(135deg, #4f6ef7, #7c5cfc);
  box-shadow: 0 4px 16px rgba(79,110,247,0.2);
}
[data-theme="light"] .login-logo h1 { color: #1a1d21; }
[data-theme="light"] .login-logo p { color: #5f6b7a; }
[data-theme="light"] .login-tab {
  color: #5f6b7a;
  background: transparent;
}
[data-theme="light"] .login-tab.active {
  background: rgba(79,110,247,0.08);
  color: #4f6ef7;
}
[data-theme="light"] .login-input {
  background: #f5f7fa;
  border-color: #d9dde3;
  color: #1a1d21;
}
[data-theme="light"] .login-input:focus {
  border-color: #4f6ef7;
  box-shadow: 0 0 0 3px rgba(79,110,247,0.1);
}
[data-theme="light"] .login-input::placeholder { color: #8e96a3; }
[data-theme="light"] .login-btn {
  background: linear-gradient(135deg, #4f6ef7, #6c5ce7);
}
[data-theme="light"] .login-btn:hover {
  box-shadow: 0 4px 16px rgba(79,110,247,0.3);
}

/* 主界面 */
[data-theme="light"] .app-header {
  background: rgba(255,255,255,0.9);
  border-bottom-color: #e4e8ed;
}
[data-theme="light"] .header-logo span { color: #1a1d21; }
[data-theme="light"] .header-logo .logo-badge {
  background: linear-gradient(135deg, #4f6ef7, #7c5cfc);
}
[data-theme="light"] .header-status {
  background: #f5f7fa;
  border-color: #e4e8ed;
  color: #5f6b7a;
}
[data-theme="light"] .user-chip {
  background: #f5f7fa;
  border-color: #e4e8ed;
}
[data-theme="light"] .user-name { color: #1a1d21; }
[data-theme="light"] .user-uid { color: #8e96a3; }
[data-theme="light"] .user-avatar {
  background: linear-gradient(135deg, #4f6ef7, #7c5cfc);
}
[data-theme="light"] .quota-chip {
  background: rgba(34,197,94,0.06);
  border-color: rgba(34,197,94,0.12);
  color: #16a34a;
}

/* 左侧面板 */
[data-theme="light"] .left-panel {
  background: #ffffff;
  border-right-color: #e4e8ed;
}
[data-theme="light"] .panel-section {
  border-bottom-color: #e4e8ed;
}
[data-theme="light"] .panel-title { color: #8e96a3; }
[data-theme="light"] .panel-title i { color: #4f6ef7; }

/* 上传区 */
[data-theme="light"] .drop-zone {
  background: #f8f9fb;
  border-color: #d9dde3;
}
[data-theme="light"] .drop-zone:hover {
  border-color: #4f6ef7;
  background: rgba(79,110,247,0.04);
}
[data-theme="light"] .drop-zone.has-file {
  border-color: #22c55e;
  background: rgba(34,197,94,0.04);
}
[data-theme="light"] .drop-zone i { color: #4f6ef7; }
[data-theme="light"] .drop-zone p { color: #5f6b7a; }
[data-theme="light"] .drop-zone .file-name { color: #16a34a; }
[data-theme="light"] .drop-zone .file-stats { color: #8e96a3; }

/* 输入框 */
[data-theme="light"] .parse-bar input {
  background: #f5f7fa;
  border-color: #d9dde3;
  color: #1a1d21;
}
[data-theme="light"] .parse-bar input:focus {
  border-color: #4f6ef7;
}

/* 字段标签 */
[data-theme="light"] .fields-strip {
  background: #f8f9fb;
  border-color: #e4e8ed;
}
[data-theme="light"] .field-tag {
  background: rgba(79,110,247,0.06);
  border-color: rgba(79,110,247,0.12);
  color: #4f6ef7;
}
[data-theme="light"] .field-tag-extra {
  background: #f0f2f5;
  border-color: #d9dde3;
  color: #5f6b7a;
}

/* 策略选择 */
[data-theme="light"] .strategy-select-wrapper select {
  background: #f5f7fa;
  border-color: #d9dde3;
  color: #1a1d21;
}
[data-theme="light"] .strategy-select-wrapper select:focus {
  border-color: #4f6ef7;
}
[data-theme="light"] .strategy-select-wrapper::after { color: #8e96a3; }
[data-theme="light"] .strategy-info {
  background: #f8f9fb;
  border-color: #e4e8ed;
}
[data-theme="light"] .strategy-info .si-label { color: #8e96a3; }
[data-theme="light"] .strategy-info .si-desc { color: #5f6b7a; }
[data-theme="light"] .si-field-req {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.15);
  color: #d97706;
}

/* 映射 */
[data-theme="light"] .mapping-row .mr-label { color: #5f6b7a; }
[data-theme="light"] .mapping-row select {
  background: #f5f7fa;
  border-color: #d9dde3;
  color: #1a1d21;
}
[data-theme="light"] .mapping-row select:focus {
  border-color: #4f6ef7;
}

/* 按钮 */
[data-theme="light"] .btn-primary {
  background: #4f6ef7;
  color: white;
}
[data-theme="light"] .btn-primary:hover { background: #3b5de7; }
[data-theme="light"] .btn-outline {
  background: transparent;
  color: #5f6b7a;
  border-color: #d9dde3;
}
[data-theme="light"] .btn-outline:hover {
  border-color: #5f6b7a;
  color: #1a1d21;
}
[data-theme="light"] .btn-success { background: #22c55e; }
[data-theme="light"] .btn-danger { background: #ef4444; }

/* 聊天区 */
[data-theme="light"] .main-content {
  background: #f0f2f5;
}
[data-theme="light"] .msg-bubble {
  background: #ffffff;
  border-color: #e4e8ed;
}
[data-theme="light"] .msg-bubble.user-bubble {
  background: rgba(79,110,247,0.04);
  border-color: rgba(79,110,247,0.1);
}
[data-theme="light"] .msg-header { color: #8e96a3; }
[data-theme="light"] .msg-text { color: #1a1d21; }
[data-theme="light"] .msg-avatar.system { background: #e4e8ed; color: #5f6b7a; }
[data-theme="light"] .msg-avatar.user { background: linear-gradient(135deg, #4f6ef7, #7c5cfc); }
[data-theme="light"] .msg-avatar.ai { background: linear-gradient(135deg, #22c55e, #16a34a); }
[data-theme="light"] .msg-avatar.report { background: linear-gradient(135deg, #f59e0b, #d97706); }

/* 进度条 */
[data-theme="light"] .progress-block {
  background: #f8f9fb;
}
[data-theme="light"] .progress-track {
  background: #e4e8ed;
}
[data-theme="light"] .progress-fill {
  background: linear-gradient(90deg, #4f6ef7, #7c5cfc);
}
[data-theme="light"] .progress-stats .ps-success { color: #22c55e; }
[data-theme="light"] .progress-stats .ps-error { color: #ef4444; }

/* FAB按钮 */
[data-theme="light"] .fab-btn {
  background: linear-gradient(135deg, #4f6ef7, #6c5ce7);
  box-shadow: 0 4px 16px rgba(79,110,247,0.3);
}
[data-theme="light"] .fab-btn.running {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* 空状态 */
[data-theme="light"] .empty-state {
  color: #8e96a3;
}
[data-theme="light"] .empty-state h3 { color: #5f6b7a; }

/* 退出按钮 */
[data-theme="light"] .logout-btn {
  border-color: #e4e8ed;
  color: #5f6b7a;
}
[data-theme="light"] .logout-btn:hover {
  background: rgba(239,68,68,0.06);
  border-color: #ef4444;
  color: #ef4444;
}

/* Toast */
[data-theme="light"] .abp-toast-success { background: rgba(34,197,94,0.95); }
[data-theme="light"] .abp-toast-error { background: rgba(239,68,68,0.95); }
[data-theme="light"] .abp-toast-warning { background: rgba(245,158,11,0.95); }
[data-theme="light"] .abp-toast-info { background: rgba(79,110,247,0.95); }

/* Light Admin */
[data-theme="light"] {
  --admin-bg: #f0f2f5;
  --admin-card: #ffffff;
  --admin-border: #e4e8ed;
  --admin-text: #1a1d21;
  --admin-text-secondary: #5f6b7a;
  --admin-accent: #4f6ef7;
}
[data-theme="light"] #adminLoginPage {
  background: linear-gradient(135deg, #e8ecf1 0%, #f0f2f5 50%, #e0e6ed 100%);
}
[data-theme="light"] .admin-input {
  background: #f5f7fa;
  border-color: #d9dde3;
  color: #1a1d21;
}
[data-theme="light"] .admin-input:focus {
  border-color: #4f6ef7;
}
[data-theme="light"] .admin-modal .admin-input { background: #f5f7fa; }
[data-theme="light"] .admin-modal select.admin-input { background: #f5f7fa; }
