/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 更柔和、更人性化的配色方案 */
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary-color: #8b5cf6;
  --accent-color: #f59e0b;
  --bg-color: #fafafa;
  --card-bg: #ffffff;
  --text-primary: #18181b;
  --text-secondary: #71717a;
  --border-color: #e4e4e7;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* 头部导航 */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
}

.logo-icon {
  font-size: 28px;
}

.logo-text {
  color: var(--text-primary);
  font-weight: 700;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 400px;
  margin: 0 24px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  width: 0%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 4px;
}

.progress-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 40px;
}

.header-right {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--border-color);
  transform: scale(1.05);
}

/* 主内容区 */
#mainContent {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.view {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.view.active {
  display: block;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* 按钮样式 */
.btn-primary {
  padding: 12px 24px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

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

.btn-secondary {
  padding: 12px 24px;
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-color);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* 弹窗样式 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.modal-content {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.modal-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.btn-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-secondary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

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

.setting-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.setting-group input {
  width: 100%;
  padding: 12px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}

.setting-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* 工具提示 */
[title] {
  position: relative;
}

/* 加载动画 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 代码块样式 */
pre {
  background: #282c34;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
}

code {
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 14px;
  line-height: 1.6;
}


/* icon-btn (header right buttons) */
.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.icon-btn:hover {
  background: var(--border-color);
  transform: scale(1.05);
}

/* modal-close button */
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 22px;
  color: var(--text-secondary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

/* form-group (settings modal) */
.form-group {
  margin-bottom: 20px;
}

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

.form-group input {
  width: 100%;
  padding: 12px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}

.form-group select {
  width: 100%;
  padding: 12px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Stats modal */
.stats-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-color);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 32px;
}

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

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* modal-header h3 fix */
.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
}

/* 响应式设计 */
@media (max-width: 768px) {
  #header {
    padding: 12px 16px;
  }
  
  .logo-text {
    font-size: 16px;
  }
  
  .header-center {
    max-width: 200px;
    margin: 0 12px;
  }
  
  .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
}

/* AC确认弹窗 */
.ac-confirm-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.ac-confirm-dialog {
  background: var(--card-bg, #fff); border-radius: var(--radius-lg, 16px);
  padding: 32px; max-width: 420px; width: 90%;
  text-align: center; box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
.ac-confirm-icon { font-size: 48px; margin-bottom: 12px; }
.ac-confirm-dialog h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; color: var(--text-primary, #18181b); }
.ac-confirm-dialog p { color: var(--text-secondary, #71717a); margin-bottom: 20px; line-height: 1.6; font-size: 15px; }
.ac-confirm-buttons { display: flex; gap: 12px; justify-content: center; }
.ac-confirm-buttons .btn-secondary {
  padding: 10px 20px; border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border-color); background: #fff;
  color: var(--text-secondary); cursor: pointer; font-size: 14px; transition: var(--transition);
}
.ac-confirm-buttons .btn-secondary:hover { background: #f4f4f5; }
.ac-confirm-buttons .btn-ac-confirm {
  padding: 10px 20px; border-radius: var(--radius-sm, 8px);
  border: none; background: var(--primary-color, #6366f1);
  color: #fff; cursor: pointer; font-size: 14px; font-weight: 600; transition: var(--transition);
}
.ac-confirm-buttons .btn-ac-confirm:hover { background: var(--primary-dark, #4f46e5); }

/* 自定义Toast */
.custom-toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--success-color, #10b981); color: #fff;
  padding: 14px 28px; border-radius: var(--radius, 12px);
  font-size: 15px; font-weight: 600; z-index: 10001;
  box-shadow: var(--shadow-lg); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.custom-toast.show { transform: translateX(-50%) translateY(0); }
.custom-toast.error { background: var(--error-color, #ef4444); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

/* 颜色选择器 */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.color-picker-row input[type="color"] {
  width: 42px;
  height: 42px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  background: none;
}
.color-picker-row input[type="color"]:hover {
  border-color: var(--primary-color);
}
.color-hex {
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 70px;
}
.btn-reset-color {
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-color);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-reset-color:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}
