/* ==================== CSS 变量 & 基础重置 ==================== */

:root {
  --bg-primary: #0a0a14;
  --bg-secondary: #12121f;
  --bg-card: rgba(22, 22, 40, 0.75);
  --bg-card-hover: rgba(32, 32, 55, 0.85);
  --border-color: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(99, 102, 241, 0.4);

  --text-primary: #eaeaf2;
  --text-secondary: #8a8aaa;
  --text-muted: #55557a;

  --accent-primary: #6366f1;
  --accent-primary-hover: #818cf8;
  --accent-success: #22c55e;
  --accent-danger: #ef4444;
  --accent-danger-hover: #f87171;
  --accent-warning: #f59e0b;

  --glass-bg: rgba(16, 16, 32, 0.65);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --sidebar-width: 240px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="light"] {
  --bg-primary: #f4f4f7;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-card-hover: rgba(255, 255, 255, 0.9);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(99, 102, 241, 0.35);

  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  --glass-bg: rgba(255, 255, 255, 0.96); /* 浅色模式下弹窗与卡片背景接近实白，去除黑灰色背景混色 */
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

/* 浅色模式特定元素高级美化适配 */
[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse at 15% 50%, rgba(99, 102, 241, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 20%, rgba(139, 92, 246, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 85%, rgba(59, 130, 246, 0.02) 0%, transparent 50%);
}

[data-theme="light"] .modal-overlay {
  background: rgba(15, 23, 42, 0.2) !important; /* 降低遮罩层暗度，让底部浅色背景能透出来 */
  backdrop-filter: blur(4px) !important;
}

[data-theme="light"] .modal {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.15) !important;
}

[data-theme="light"] .modal-header {
  border-bottom-color: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .modal-footer {
  border-top-color: rgba(0, 0, 0, 0.05) !important;
}

/* 浅色模式弹窗输入控件亮白化，拒绝脏灰色 */
[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .checkbox-group {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  color: #1f2937 !important;
}

[data-theme="light"] .form-group input:focus,
[data-theme="light"] .form-group select:focus {
  background: #ffffff !important;
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08) !important;
}

[data-theme="light"] .preset-btn:not(.active),
[data-theme="light"] .preset-btn-user:not(.active),
[data-theme="light"] .btn-ghost {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  color: #4b5563 !important;
}

[data-theme="light"] .preset-btn:not(.active):hover,
[data-theme="light"] .preset-btn-user:not(.active):hover,
[data-theme="light"] .btn-ghost:hover {
  background: rgba(0, 0, 0, 0.03) !important;
  color: #1f2937 !important;
}

[data-theme="light"] .data-table th {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .checkbox-group {
  background: #ffffff;
}

[data-theme="light"] .sub-link code {
  background: rgba(99, 102, 241, 0.04);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 背景装饰 — 深邃感 */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 15% 50%, rgba(99, 102, 241, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 85%, rgba(59, 130, 246, 0.04) 0%, transparent 50%);
  z-index: -1;
  animation: bgFloat 25s ease-in-out infinite;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-1.5%, 0.5%) scale(1.01); }
  66% { transform: translate(0.5%, -0.5%) scale(0.99); }
}

/* ==================== 通用组件 ==================== */

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(120%);
  -webkit-backdrop-filter: blur(24px) saturate(120%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.view { display: none; }
.view.active { display: flex; }

.page { display: none; }
.page.active { display: block; animation: pageIn 0.35s ease; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.text-muted { color: var(--text-muted); }

/* ==================== 登录页 ==================== */

#login-view {
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  padding: 48px 36px;
  border-radius: var(--radius-xl);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), #8b5cf6, #ec4899);
}

.login-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35); }
  50% { box-shadow: 0 8px 32px rgba(99, 102, 241, 0.5); }
}

.login-logo .material-icons-round {
  font-size: 36px;
  color: white;
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 0.9rem;
}

.input-group {
  position: relative;
  margin-bottom: 20px;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 20px;
  transition: var(--transition);
}

.input-group input:focus + .input-icon,
.input-group input:focus ~ .input-icon {
  color: var(--accent-primary);
}

.input-group input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-family);
  transition: var(--transition);
  outline: none;
}

.input-group input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.login-error {
  color: var(--accent-danger);
  font-size: 0.85rem;
  margin-top: 12px;
  min-height: 20px;
}

/* ==================== 按钮 ==================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn .material-icons-round {
  font-size: 18px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, var(--accent-danger));
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
  filter: brightness(1.1);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.12);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 7px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  transform: scale(1.1);
}

.btn-icon.danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-danger);
}

.btn-icon.success:hover {
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent-success);
}

.btn-icon.warning:hover {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-warning);
}

.btn-block {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 14px;
}

.btn-loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ==================== 侧边栏 ==================== */

#main-view {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-right: 1px solid var(--glass-border);
  border-radius: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header .material-icons-round {
  font-size: 28px;
  color: var(--accent-primary);
}

.sidebar-title {
  font-size: 1.15rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border-color);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  font-weight: 500;
  position: relative;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-primary-hover);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-primary);
}

.nav-item .material-icons-round {
  font-size: 22px;
}

/* ==================== 主内容区 ==================== */

.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  padding: 32px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* 实时标识 */
.realtime-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--accent-success);
  background: rgba(34, 197, 94, 0.08);
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 500;
}

.realtime-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-success);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ==================== 统计卡片 ==================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  opacity: 0;
  transition: var(--transition);
  background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent);
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-glow);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon .material-icons-round {
  font-size: 24px;
  color: white;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  transition: var(--transition-fast);
}

.stat-value.updating {
  opacity: 0.5;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-top: 3px;
}

/* ==================== 数据表格 ==================== */

.table-container {
  border-radius: var(--radius-md);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 14px 16px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.25);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.025);
  vertical-align: middle;
  font-size: 0.92rem;
}

.data-table tbody tr {
  transition: var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 16px !important;
  font-size: 0.92rem;
}

/* 状态标签 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-active {
  background: rgba(34, 197, 94, 0.1);
  color: var(--accent-success);
}

.badge-active::before {
  background: var(--accent-success);
}

.badge-inactive {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-danger);
}

.badge-inactive::before {
  background: var(--accent-danger);
}

.badge-expired {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-warning);
}

.badge-expired::before {
  background: var(--accent-warning);
}

/* 订阅链接 */
.sub-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 6px;
  padding: 4px 8px;
}

.sub-link code {
  font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--accent-primary-hover);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
  display: inline-block;
}

.copy-btn {
  font-size: 16px !important;
  padding: 4px !important;
  color: var(--accent-primary-hover) !important;
}

.copy-btn:hover {
  background: rgba(99, 102, 241, 0.12) !important;
}

/* 操作按钮组 */
.actions {
  display: flex;
  gap: 2px;
}

/* ==================== 模态框 ==================== */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  animation: overlayIn 0.2s ease;
}

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

.modal-overlay.active .modal {
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal {
  width: 100%;
  max-width: 500px;
  border-radius: var(--radius-lg);
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), #8b5cf6, #ec4899);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: var(--transition-fast);
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.modal form {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.form-group select {
  cursor: pointer;
  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='%238888a8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-group select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* 更新间隔输入 */
.interval-input-group,
.expiry-input-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.interval-input-group input,
.expiry-input-group input {
  width: 120px;
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
}

.interval-hint,
.expiry-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* 预设按钮 */
.interval-presets,
.expiry-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
  margin-top: -8px;
}

.preset-btn,
.preset-btn-user {
  padding: 5px 12px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition-fast);
  font-weight: 500;
}

.preset-btn:hover,
.preset-btn-user:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--accent-primary-hover);
}

.preset-btn.active,
.preset-btn-user.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary-hover);
}

/* 复选框 */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 0;
  transition: var(--transition-fast);
}

.checkbox-item:hover {
  color: var(--accent-primary-hover);
}

.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* ==================== 自定义确认对话框 ==================== */

.confirm-modal {
  max-width: 380px;
  text-align: center;
  padding: 32px 28px 24px;
}

.confirm-modal::before {
  display: none;
}

.confirm-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  animation: confirmBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confirm-icon-wrap.danger {
  background: rgba(239, 68, 68, 0.12);
}

.confirm-icon-wrap.danger .material-icons-round {
  color: var(--accent-danger);
  font-size: 28px;
}

.confirm-icon-wrap.warning {
  background: rgba(245, 158, 11, 0.12);
}

.confirm-icon-wrap.warning .material-icons-round {
  color: var(--accent-warning);
  font-size: 28px;
}

@keyframes confirmBounce {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.confirm-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.confirm-message {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.confirm-footer {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.confirm-footer .btn {
  min-width: 100px;
  justify-content: center;
}

/* ==================== Toast 通知 ==================== */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: white;
  min-width: 240px;
  max-width: 360px;
  animation: slideInRight 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.success {
  background: linear-gradient(135deg, #059669, #10b981);
}

.toast.error {
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

.toast.info {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
}

.toast .material-icons-round {
  font-size: 20px;
  flex-shrink: 0;
}

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

.toast.removing {
  animation: slideOutRight 0.3s ease forwards;
}

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

/* ==================== 滚动条美化 ==================== */

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ==================== 移动端元素（PC 默认隐藏） ==================== */
.mobile-header,
.mobile-nav {
  display: none;
}

/* ==================== 响应式 ==================== */

@media (max-width: 768px) {
  .sidebar {
    display: none !important; /* 彻底隐藏 PC 端侧边栏 */
  }

  /* 移动端顶部标题栏 */
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 16px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99;
    border-bottom: 1px solid var(--border-color);
  }

  .mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-logo .material-icons-round {
    font-size: 24px;
    color: var(--accent-primary);
  }

  .mobile-logo span:last-child {
    font-weight: 700;
    font-size: 1.05rem;
    background: linear-gradient(135deg, var(--accent-primary), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  /* 移动端底部导航栏 */
  .mobile-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 100;
    border-top: 1px solid var(--border-color);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    flex: 1;
    height: 100%;
    transition: var(--transition-fast);
  }

  .mobile-nav-item .material-icons-round {
    font-size: 22px;
  }

  .mobile-nav-item.active {
    color: var(--accent-primary-hover);
  }

  /* 移动端主内容区边距调整 */
  .main-content {
    margin-left: 0 !important;
    padding: 76px 16px 88px !important;
  }

  /* 移动端数据表格转化为卡片式 */
  .table-container {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none; /* 隐藏表头 */
  }

  .data-table tr {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    padding: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
  }

  .data-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    padding: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
  }

  .data-table td:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-top: 8px;
  }

  /* 使用 data-label 输出标签名称 */
  .data-table td::before {
    content: attr(data-label);
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.85rem;
    float: left;
    text-align: left;
  }

  /* 操作按钮在移动端居右 */
  .data-table td .actions {
    justify-content: flex-end;
    width: 100%;
  }

  /* 模态弹窗抽屉式滑出效果 */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 85vh;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.94, 0.6, 1);
  }

  .modal-overlay.active .modal {
    transform: translateY(0);
    animation: none;
  }
}
