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

:root {
  --bg-primary: #0a0e27;
  --bg-secondary: #151932;
  --bg-tertiary: #1e2139;
  --bg-input: #0f1429;
  --border-color: #2d3250;
  --border-focus: #7c6fff;
  --text-primary: #f0f0f5;
  --text-secondary: #b0b0c8;
  --text-muted: #7a7a9a;
  --accent: #7c6fff;
  --accent-hover: #6a5ee6;
  --accent-light: rgba(124, 111, 255, 0.15);
  --success: #10d876;
  --warning: #ffc107;
  --error: #ff6b6b;
  --info: #4dabf7;
  --generate: #10d876;
  --generate-hover: #0ec46a;
  --cancel: #ff6b6b;
  --cancel-hover: #ff5252;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(124, 111, 255, 0.3);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="purple"] {
  --bg-primary: #0a0e27;
  --bg-secondary: #151932;
  --bg-tertiary: #1e2139;
  --bg-input: #0f1429;
  --border-color: #2d3250;
  --border-focus: #7c6fff;
  --accent: #7c6fff;
  --accent-hover: #6a5ee6;
  --accent-light: rgba(124, 111, 255, 0.15);
  --shadow-glow: 0 0 20px rgba(124, 111, 255, 0.3);
}

[data-theme="ocean"] {
  --bg-primary: #0a1628;
  --bg-secondary: #0f1f35;
  --bg-tertiary: #152840;
  --bg-input: #0c1a2e;
  --border-color: #1e3a5f;
  --border-focus: #00d4ff;
  --accent: #00d4ff;
  --accent-hover: #00b8e6;
  --accent-light: rgba(0, 212, 255, 0.15);
  --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);
}

[data-theme="sunset"] {
  --bg-primary: #1a0a1e;
  --bg-secondary: #2d1233;
  --bg-tertiary: #3d1a44;
  --bg-input: #240e28;
  --border-color: #5a2a64;
  --border-focus: #ff6b9d;
  --accent: #ff6b9d;
  --accent-hover: #ff5288;
  --accent-light: rgba(255, 107, 157, 0.15);
  --shadow-glow: 0 0 20px rgba(255, 107, 157, 0.3);
}

[data-theme="forest"] {
  --bg-primary: #0a1a12;
  --bg-secondary: #0f2818;
  --bg-tertiary: #163a22;
  --bg-input: #0c1f14;
  --border-color: #2a5a3a;
  --border-focus: #4ade80;
  --accent: #4ade80;
  --accent-hover: #3dcc6e;
  --accent-light: rgba(74, 222, 128, 0.15);
  --shadow-glow: 0 0 20px rgba(74, 222, 128, 0.3);
}

[data-theme="dark"] {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #141414;
  --bg-input: #050505;
  --border-color: #2a2a2a;
  --border-focus: #ffffff;
  --accent: #ffffff;
  --accent-hover: #e0e0e0;
  --accent-light: rgba(255, 255, 255, 0.1);
  --shadow-glow: 0 0 20px rgba(255, 255, 255, 0.1);
}

[data-theme="cyberpunk"] {
  --bg-primary: #0d0221;
  --bg-secondary: #150734;
  --bg-tertiary: #1f0a4a;
  --bg-input: #0a0318;
  --border-color: #3d1a78;
  --border-focus: #ff00ff;
  --accent: #ff00ff;
  --accent-hover: #e600e6;
  --accent-light: rgba(255, 0, 255, 0.15);
  --shadow-glow: 0 0 20px rgba(255, 0, 255, 0.3);
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-tertiary: #e8e8ed;
  --bg-input: #ffffff;
  --border-color: #d1d1d6;
  --border-focus: #007aff;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-muted: #8e8e93;
  --accent: #007aff;
  --accent-hover: #0056cc;
  --accent-light: rgba(0, 122, 255, 0.1);
  --shadow-glow: 0 0 20px rgba(0, 122, 255, 0.2);
}

[data-theme="warm-light"] {
  --bg-primary: #faf8f5;
  --bg-secondary: #f5f0e8;
  --bg-tertiary: #ebe5da;
  --bg-input: #ffffff;
  --border-color: #d4c8b8;
  --border-focus: #d97706;
  --text-primary: #1f1f1f;
  --text-secondary: #5c5c5c;
  --text-muted: #8a8a8a;
  --accent: #d97706;
  --accent-hover: #b45c05;
  --accent-light: rgba(217, 119, 6, 0.1);
  --shadow-glow: 0 0 20px rgba(217, 119, 6, 0.2);
}

[data-theme="mint"] {
  --bg-primary: #f0fdf4;
  --bg-secondary: #dcfce7;
  --bg-tertiary: #bbf7d0;
  --bg-input: #ffffff;
  --border-color: #86efac;
  --border-focus: #22c55e;
  --text-primary: #14532d;
  --text-secondary: #166534;
  --text-muted: #4ade80;
  --accent: #22c55e;
  --accent-hover: #16a34a;
  --accent-light: rgba(34, 197, 94, 0.15);
  --shadow-glow: 0 0 20px rgba(34, 197, 94, 0.3);
}

[data-theme="lavender"] {
  --bg-primary: #faf5ff;
  --bg-secondary: #f3e8ff;
  --bg-tertiary: #e9d5ff;
  --bg-input: #ffffff;
  --border-color: #d8b4fe;
  --border-focus: #a855f7;
  --text-primary: #3b0764;
  --text-secondary: #581c87;
  --text-muted: #a855f7;
  --accent: #a855f7;
  --accent-hover: #9333ea;
  --accent-light: rgba(168, 85, 247, 0.15);
  --shadow-glow: 0 0 20px rgba(168, 85, 247, 0.3);
}

[data-theme="rose"] {
  --bg-primary: #fff1f2;
  --bg-secondary: #ffe4e6;
  --bg-tertiary: #fecdd3;
  --bg-input: #ffffff;
  --border-color: #fda4af;
  --border-focus: #f43f5e;
  --text-primary: #4c0519;
  --text-secondary: #881337;
  --text-muted: #f43f5e;
  --accent: #f43f5e;
  --accent-hover: #e11d48;
  --accent-light: rgba(244, 63, 94, 0.15);
  --shadow-glow: 0 0 20px rgba(244, 63, 94, 0.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.top-nav {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-brand {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, #7c6fff, #5ce1e6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  border: 1px solid transparent;
}

.nav-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(124, 111, 255, 0.2);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 49px);
  overflow: hidden;
}

.theme-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.theme-modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
}

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

.theme-modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.theme-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

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

.theme-modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(80vh - 70px);
}

.theme-section {
  margin-bottom: 24px;
}

.theme-section:last-child {
  margin-bottom: 0;
}

.theme-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}

.theme-card:hover {
  background: var(--bg-tertiary);
}

.theme-card.active {
  border-color: var(--accent);
  background: var(--accent-light);
}

.theme-preview-large {
  width: 60px;
  height: 60px;
  border-radius: var(--radius);
  border: 2px solid var(--border-color);
}

.theme-preview-large.purple {
  background: linear-gradient(135deg, #7c6fff, #5ce1e6);
}

.theme-preview-large.ocean {
  background: linear-gradient(135deg, #00d4ff, #0066ff);
}

.theme-preview-large.sunset {
  background: linear-gradient(135deg, #ff6b9d, #ff8a5b);
}

.theme-preview-large.forest {
  background: linear-gradient(135deg, #4ade80, #22c55e);
}

.theme-preview-large.dark {
  background: linear-gradient(135deg, #ffffff, #808080);
}

.theme-preview-large.cyberpunk {
  background: linear-gradient(135deg, #ff00ff, #00ffff);
}

.theme-preview-large.light {
  background: linear-gradient(135deg, #ffffff, #f0f0f0);
  border-color: #d1d1d6;
}

.theme-preview-large.warm-light {
  background: linear-gradient(135deg, #faf8f5, #f5f0e8);
  border-color: #d4c8b8;
}

.theme-preview-large.mint {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  border-color: #86efac;
}

.theme-preview-large.lavender {
  background: linear-gradient(135deg, #f3e8ff, #e9d5ff);
  border-color: #d8b4fe;
}

.theme-preview-large.rose {
  background: linear-gradient(135deg, #ffe4e6, #fecdd3);
  border-color: #fda4af;
}

.theme-card span {
  font-size: 12px;
  color: var(--text-secondary);
}

.theme-card.active span {
  color: var(--accent);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: var(--transition);
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-dot.offline {
  background: var(--error);
  box-shadow: 0 0 6px var(--error);
}

/* ==================== 额度显示样式 ==================== */
.quota-display {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-primary);
  transition: var(--transition);
}

.quota-icon {
  font-size: 14px;
}

.quota-value {
  font-weight: 600;
  color: var(--success);
  min-width: 20px;
  text-align: center;
}

.quota-display.quota-low .quota-value {
  color: var(--warning);
}

.quota-display.quota-empty .quota-value {
  color: var(--error);
}

.app-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: 280px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-left {
  border-right: 1px solid var(--border-color);
}

.sidebar-right {
  border-left: 1px solid var(--border-color);
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 12px;
}

.preset-search {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.preset-search:focus {
  border-color: var(--border-focus);
  background: var(--bg-tertiary);
}

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

.history-list, .preset-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.history-list::-webkit-scrollbar, .preset-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-track, .preset-list::-webkit-scrollbar-track {
  background: transparent;
}

.history-list::-webkit-scrollbar-thumb, .preset-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  color: var(--text-muted);
  font-size: 13px;
}

.preset-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.preset-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.preset-item:hover::before {
  transform: scaleY(1);
}

.preset-item:hover {
  background: var(--bg-input);
  border-color: var(--border-focus);
  color: var(--text-primary);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(124, 111, 255, 0.2);
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 4px;
}

.history-item:hover {
  background: var(--bg-tertiary);
}

.history-item .history-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-input);
}

.history-item .history-prompt {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.history-item .history-time {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.params-panel {
  width: 380px;
  flex-shrink: 0;
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.params-panel::-webkit-scrollbar {
  width: 6px;
}

.params-panel::-webkit-scrollbar-track {
  background: transparent;
}

.params-panel::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.prompt-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-reset {
  font-size: 12px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: var(--transition);
  width: auto !important;
  height: auto !important;
  flex-shrink: 0;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 80px;
}

.btn-reset:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.param-value {
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(124, 111, 255, 0.2);
}

.prompt-textarea {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
  min-height: 100px;
}

.prompt-textarea:focus {
  border-color: var(--border-focus);
  background: var(--bg-tertiary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.prompt-textarea:hover {
  border-color: var(--text-muted);
}

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

.prompt-textarea.negative {
  border-color: rgba(255, 107, 107, 0.3);
}

.prompt-textarea.negative:focus {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15);
}

.params-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.param-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.param-select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  width: 100%;
  cursor: pointer;
}

.param-select:focus {
  border-color: var(--border-focus);
}

.param-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  outline: none;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.param-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(108, 99, 255, 0.4);
}

.param-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 10px rgba(108, 99, 255, 0.6);
}

.param-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(108, 99, 255, 0.4);
}

.param-input {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.param-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-tertiary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.param-input:hover {
  border-color: var(--text-muted);
}

.size-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.size-field {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.size-label {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.size-separator {
  color: var(--text-muted);
  font-size: 16px;
  flex-shrink: 0;
}

.size-field .param-input {
  width: 100%;
}

.seed-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.seed-input {
  flex: 1;
}

.btn {
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 10px 24px;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
  border: 1px solid var(--border-color);
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

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

.btn-icon {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 16px;
  flex-shrink: 0;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  transform: scale(1.05);
}

.btn-generate {
  background: linear-gradient(135deg, var(--generate), #0ec46a);
  color: #fff;
  padding: 16px 36px;
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 20px rgba(16, 216, 118, 0.4);
  position: relative;
  overflow: hidden;
}

.btn-generate::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-generate:hover::before {
  left: 100%;
}

.btn-generate:hover {
  background: linear-gradient(135deg, var(--generate-hover), #0ab35e);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(16, 216, 118, 0.5);
}

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

.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-cancel {
  background: var(--cancel);
  color: #fff;
  padding: 14px 32px;
  font-size: 16px;
  width: 100%;
  border-radius: var(--radius-lg);
}

.btn-cancel:hover {
  background: var(--cancel-hover);
}

.generate-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.progress-bar-container {
  position: relative;
  width: 100%;
  height: 24px;
  background: var(--bg-input);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #48c6ef);
  border-radius: 12px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.results-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.results-panel::-webkit-scrollbar {
  width: 6px;
}

.results-panel::-webkit-scrollbar-track {
  background: transparent;
}

.results-panel::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.results-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-muted);
  gap: 12px;
  min-height: 300px;
}

.placeholder-icon {
  font-size: 64px;
  opacity: 0.6;
}

.results-placeholder p {
  font-size: 14px;
}

.generating-animation {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 20px;
  min-height: 300px;
}

.animation-spinner {
  width: 80px;
  height: 80px;
  border: 6px solid var(--bg-tertiary);
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 30px rgba(124, 111, 255, 0.3);
}

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

.animation-text {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
  animation: pulse 1.5s ease-in-out infinite;
  letter-spacing: 0.5px;
}

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

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 4px;
}

.result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  animation: fadeInUp 0.5s ease;
}

.result-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(124, 111, 255, 0.3);
  transform: translateY(-4px);
}

.result-card .result-image-wrapper {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  background: var(--bg-input);
}

.result-card .result-image {
  width: 100%;
  display: block;
  transition: transform 0.3s ease;
}

.result-card:hover .result-image {
  transform: scale(1.02);
}

.result-card .result-image-wrapper .zoom-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.result-card:hover .zoom-hint {
  opacity: 1;
}

.result-card .result-actions {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
}

.result-card .result-actions .btn {
  flex: 1;
  font-size: 12px;
  padding: 6px 8px;
}

.result-card .result-info {
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.result-card .result-info strong {
  color: var(--accent);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 1;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}

.lightbox-actions {
  display: flex;
  gap: 8px;
}

.lightbox-info {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 600px;
  word-break: break-all;
}

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

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
  max-width: 360px;
}

.toast.success {
  background: rgba(0, 200, 83, 0.9);
  color: #fff;
}

.toast.error {
  background: rgba(255, 82, 82, 0.9);
  color: #fff;
}

.toast.info {
  background: rgba(68, 138, 255, 0.9);
  color: #fff;
}

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

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

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

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.generating .placeholder-icon {
  animation: pulse 1.5s ease-in-out infinite;
}

@media (max-width: 1200px) {
  .params-panel {
    width: 320px;
  }
  
  .nav-links {
    gap: 4px;
  }
  
  .nav-link {
    padding: 6px 10px;
    font-size: 13px;
  }
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .workspace {
    flex-direction: column;
  }

  .params-panel {
    width: 100%;
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  
  .nav-container {
    padding: 10px 16px;
    gap: 12px;
  }
  
  .nav-left {
    gap: 12px;
  }
  
  .nav-brand {
    font-size: 16px;
  }
  
  .nav-links {
    gap: 2px;
  }
  
  .nav-link {
    padding: 5px 8px;
    font-size: 12px;
  }
  
  .nav-right {
    gap: 8px;
  }
}

@media (max-width: 600px) {
  .app-header {
    padding: 10px 16px;
  }

  .app-header h1 {
    font-size: 16px;
  }

  .params-panel {
    padding: 12px;
  }

  .results-panel {
    padding: 12px;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .btn-generate {
    padding: 12px 24px;
    font-size: 14px;
  }

  .size-inputs {
    flex-wrap: wrap;
  }
  
  .nav-links {
    display: none;
  }
  
  .nav-brand {
    font-size: 14px;
  }
  
  .nav-right .btn-ghost {
    padding: 4px 8px;
    font-size: 12px;
  }
}

/* ==================== 用户菜单样式 ==================== */
.user-menu {
  position: relative;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), #48c6ef);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.user-name {
  font-size: 13px;
  color: var(--text-primary);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.user-menu.active .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 1000;
  overflow: hidden;
  animation: fadeIn 0.2s ease;
}

.dropdown-item {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
}

.dropdown-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.dropdown-item.logout {
  color: var(--error);
}

.dropdown-item.logout:hover {
  background: rgba(255, 82, 82, 0.1);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 0;
}

/* 提示词翻译悬浮窗口 */
.translate-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.translate-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.translate-modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  animation: modalZoomIn 0.3s ease;
}

@keyframes modalZoomIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

.translate-modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

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

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

.translate-modal-body {
  padding: 20px;
}

.translate-section {
  margin-bottom: 16px;
}

.translate-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.translate-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: var(--transition);
  font-family: inherit;
}

.translate-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

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

.translate-textarea.output {
  background: var(--bg-primary);
  cursor: default;
}

.translate-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.translate-actions .btn {
  flex: 1;
  min-width: 120px;
}

.translate-actions .btn-generate {
  background: linear-gradient(135deg, var(--accent), #48c6ef);
}

.translate-actions .btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.4);
}

.translate-actions .btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
