/* ============================================
   AM1450 前端 v2 - 全局样式
   ============================================ */

/* === CSS 变量 === */
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --panel-bg: #e8f0fe;
  --panel-text: #1a3a5c;
  --text: #2c3e50;
  --text-secondary: #7f8c9b;
  --text-muted: #aab2bd;
  --accent: #3b6df0;
  --accent-hover: #2b56d4;
  --accent-light: #e8f0fe;
  --danger: #e74c3c;
  --success: #27ae60;
  --warning: #f39c12;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #1a1f2e;
  --panel-bg: #1e2a3a;
  --panel-text: #e0e6f0;
  --text: #e0e6f0;
  --text-secondary: #8899a6;
  --text-muted: #5c6a7a;
  --accent: #5b8af7;
  --accent-hover: #7aa2ff;
  --accent-light: #1a2a4a;
  --border: #2a3545;
  --shadow: 0 4px 24px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.5);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent-hover); }

/* === 主题切换按钮 === */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  backdrop-filter: blur(10px);
}
.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

/* === 动画 === */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlideLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeSlideRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* === 按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59, 109, 240, 0.35);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 109, 240, 0.45);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}
.btn-ghost:hover {
  color: var(--text);
  background: rgba(128,128,128,0.1);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { opacity: 0.9; }

/* === 输入框 === */
.input-group {
  position: relative;
  margin-bottom: 20px;
}

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

.input-group input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
  transition: all var(--transition);
  outline: none;
}
.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 109, 240, 0.15);
}
.input-group input::placeholder {
  color: var(--text-muted);
}
.input-group input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg);
}

.input-group .input-hint {
  font-size: 0.75rem;
  margin-top: 6px;
  min-height: 18px;
  transition: color var(--transition);
}
.input-group .input-hint.error { color: var(--danger); }
.input-group .input-hint.success { color: var(--success); }
.input-group .input-hint.info { color: var(--text-secondary); }

/* 密码强度指示器 */
.pw-strength {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  height: 4px;
}
.pw-strength .bar {
  flex: 1;
  border-radius: 2px;
  background: var(--border);
  transition: background var(--transition);
}
.pw-strength.weak .bar:nth-child(1)   { background: var(--danger); }
.pw-strength.medium .bar:nth-child(-n+2) { background: var(--warning); }
.pw-strength.strong .bar:nth-child(-n+3) { background: var(--success); }

/* === 消息提示 === */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  animation: fadeSlideUp 0.3s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--accent); }
.toast.warning { background: var(--warning); }

/* === 模态弹窗 === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeSlideUp 0.2s ease;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: scaleIn 0.3s ease;
}
.modal-box h2 {
  font-size: 1.3rem;
  margin-bottom: 12px;
}
.modal-box p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}
.modal-box .btn {
  margin-top: 8px;
}

/* === 滚动条 === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* === 响应式断点 === */
@media (max-width: 767px) {
  body { padding: 0; }
  .theme-toggle {
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
}