/* ============================================
   LinguaFlow 智能翻译工作台 - 全局样式
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

/* CSS Custom Properties */
:root {
  --bg-primary: #F7F5F0;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FAFAFA;
  --accent: #2A9D8F;
  --accent-hover: #238B7E;
  --accent-light: rgba(42, 157, 143, 0.1);
  --accent-lighter: rgba(42, 157, 143, 0.05);
  --secondary: #E76F51;
  --secondary-hover: #D35D42;
  --text-primary: #2D3436;
  --text-secondary: #636E72;
  --text-light: #B2BEC3;
  --border: #DFE6E9;
  --border-light: #EDF0F2;
  --success: #00B894;
  --warning: #FDCB6E;
  --error: #E17055;
  --gradient-accent: linear-gradient(135deg, #2A9D8F, #264653);
  --gradient-warm: linear-gradient(135deg, #E76F51, #F4A261);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --shadow-xl: 0 12px 40px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Noto Sans SC', system-ui, -apple-system, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
  color: var(--accent-hover);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--text-light);
  border-radius: 3px;
}

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

/* ============================================
   Login / Register Page
   ============================================ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.auth-page::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(42,157,143,0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.auth-page::after {
  content: '';
  position: absolute;
  bottom: -40%;
  left: -20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(231,111,81,0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  width: 100%;
  max-width: 860px;
  min-height: 560px;
  position: relative;
  z-index: 1;
  animation: cardFadeIn 0.6s ease-out;
}

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

/* Left branding side */
.auth-brand {
  flex: 0 0 280px;
  background: var(--gradient-accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 30px;
  position: relative;
  overflow: hidden;
  color: #fff;
}

.auth-brand::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z' fill='rgba(255,255,255,0.08)'/%3E%3C/svg%3E") no-repeat bottom;
  background-size: cover;
}

.auth-brand-logo {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.auth-brand-logo span {
  display: block;
  font-size: 18px;
  font-weight: 300;
  opacity: 0.9;
  margin-top: 4px;
}

.auth-brand-features {
  margin-top: 40px;
  list-style: none;
  position: relative;
  z-index: 1;
}

.auth-brand-features li {
  font-size: 13px;
  font-weight: 300;
  opacity: 0.85;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-brand-features li::before {
  content: '✓';
  width: 20px;
  height: 20px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

/* Right form side */
.auth-form-section {
  flex: 1;
  padding: 40px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-form-header {
  margin-bottom: 30px;
}

.auth-form-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-form-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.auth-tab:hover:not(.active) {
  color: var(--text-primary);
}

/* Form */
.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: formFadeIn 0.3s ease-out;
}

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

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

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

.form-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  outline: none;
}

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

.form-input::placeholder {
  color: var(--text-light);
}

.btn-primary {
  width: 100%;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-family);
  color: #fff;
  background: var(--gradient-accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(42,157,143,0.35);
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--accent);
  font-weight: 500;
}

.auth-subtitle-link {
  text-align: center;
  margin-top: 16px;
}

.auth-subtitle-link a {
  font-size: 13px;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.auth-subtitle-link a:hover {
  gap: 8px;
}

/* ============================================
   Navbar
   ============================================ */

.navbar {
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-brand svg {
  width: 28px;
  height: 28px;
}

.navbar-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-user {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 12px;
  background: var(--accent-light);
  border-radius: 20px;
  font-weight: 500;
}

.navbar-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
  font-size: 16px;
}

.navbar-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.navbar-btn.danger:hover {
  background: rgba(225, 112, 85, 0.1);
  color: var(--error);
}

/* ============================================
   Main Workbench Layout
   ============================================ */

.workbench {
  margin-top: 60px;
  display: flex;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* Left Panel */
.panel-left {
  width: 360px;
  min-width: 360px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  padding: 24px;
}

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

.panel-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-section-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--accent-lighter);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upload-zone-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  color: var(--accent);
  opacity: 0.7;
}

.upload-zone-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.upload-zone-hint {
  font-size: 12px;
  color: var(--text-light);
}

.upload-file-info {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.upload-file-info.show {
  display: flex;
}

.upload-file-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.upload-file-name {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.upload-file-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.upload-file-remove:hover {
  background: rgba(225,112,85,0.1);
  color: var(--error);
}

/* Language Pills */
.lang-pills {
  display: flex;
  gap: 0;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.lang-pill {
  flex: 1;
  text-align: center;
  padding: 9px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.lang-pill.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.lang-pill:hover:not(.active) {
  color: var(--text-primary);
}

/* Select */
.form-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  outline: none;
  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 d='M6 8L1 3h10z' fill='%23636E72'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input {
  display: none;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 12px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* TM / Corpus Table */
.tm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 12px;
}

.tm-table th {
  text-align: left;
  padding: 8px 6px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.tm-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* Small Buttons */
.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--accent);
  background: var(--accent-light);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-sm:hover {
  background: var(--accent);
  color: #fff;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-outline-sm {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-outline-sm:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-lighter);
}

/* Translate Button */
.btn-translate {
  width: 100%;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-family);
  color: #fff;
  background: var(--gradient-accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-translate:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(42,157,143,0.35);
}

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

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

.btn-translate svg {
  width: 18px;
  height: 18px;
  transition: var(--transition);
}

.btn-translate:hover svg {
  transform: translateX(3px);
}

/* Corpus info */
.corpus-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--accent-lighter);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
}

.corpus-count {
  font-weight: 600;
  color: var(--accent);
}

/* ============================================
   Right Panel - Output
   ============================================ */

.panel-right {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-primary);
}

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

.output-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.btn-export {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-export:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-lighter);
}

/* Output Display */
.output-area {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  min-height: 400px;
  overflow: hidden;
}

.output-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 40px;
  color: var(--text-light);
  text-align: center;
}

.output-prompt-icon {
  width: 60px;
  height: 60px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.output-prompt-text {
  font-size: 15px;
  margin-bottom: 4px;
}

.output-prompt-hint {
  font-size: 13px;
  opacity: 0.7;
}

/* Loading */
.output-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 40px;
}

.output-loading.show {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.output-loading-text {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.progress-bar {
  width: 200px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-bar-inner {
  width: 30%;
  height: 100%;
  background: var(--gradient-accent);
  border-radius: 2px;
  animation: progressSlide 1.5s ease-in-out infinite;
}

@keyframes progressSlide {
  0% { width: 5%; margin-left: 0; }
  50% { width: 60%; margin-left: 20%; }
  100% { width: 5%; margin-left: 95%; }
}

/* Result */
.output-result {
  display: none;
  padding: 24px;
}

.output-result.show {
  display: block;
  animation: resultFadeIn 0.4s ease-out;
}

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

.result-source, .result-target {
  margin-bottom: 20px;
}

.result-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-label-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.result-label-dot.source {
  background: var(--secondary);
}

.result-label-dot.target {
  background: var(--accent);
}

.result-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Stats bar */
.output-stats {
  display: flex;
  gap: 20px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-secondary);
}

.output-stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.output-stat-value {
  font-weight: 600;
  color: var(--accent);
}

/* Copy button */
.btn-copy {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.result-target {
  position: relative;
}

/* ============================================
   Modals
   ============================================ */

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

.modal-overlay.show {
  display: flex;
  animation: overlayFadeIn 0.25s ease-out;
}

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

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.modal-close:hover {
  background: rgba(225,112,85,0.1);
  color: var(--error);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

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

/* TM Modal Table */
.tm-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 16px;
}

.tm-modal-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-weight: 500;
  border-bottom: 2px solid var(--border);
}

.tm-modal-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.tm-modal-table tr:hover td {
  background: var(--accent-lighter);
}

.tm-modal-table .btn-delete {
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--font-family);
  color: var(--error);
  background: rgba(225,112,85,0.08);
  border: 1px solid rgba(225,112,85,0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.tm-modal-table .btn-delete:hover {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

/* Modal form row */
.modal-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-form-row.full {
  grid-template-columns: 1fr;
}

/* Search input in modal */
.modal-search {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.modal-search input {
  flex: 1;
}

/* ============================================
   Subtitle Page
   ============================================ */

.subtitle-page {
  min-height: 100vh;
  background: var(--bg-primary);
}

.subtitle-header {
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: var(--shadow-sm);
}

.subtitle-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-family: var(--font-family);
}

.subtitle-back:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.subtitle-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.subtitle-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.subtitle-main {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 24px;
}

.subtitle-display {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  padding: 32px;
  margin-bottom: 24px;
  font-size: 20px;
  line-height: 2;
  color: var(--text-primary);
}

.subtitle-display:empty::before {
  content: '点击"开始录音"按钮，说话后识别内容将显示在这里...';
  color: var(--text-light);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.subtitle-display .subtitle-line {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  animation: subtitleLineIn 0.3s ease-out;
}

.subtitle-display .subtitle-line:last-child {
  border-bottom: none;
}

.subtitle-display .subtitle-line .original {
  color: var(--text-primary);
}

.subtitle-display .subtitle-line .translated {
  color: var(--accent);
  font-size: 16px;
  margin-top: 4px;
  display: block;
}

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

/* Controls */
.subtitle-controls {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 24px;
}

.subtitle-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.subtitle-lang-select {
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.subtitle-lang-select:focus {
  border-color: var(--accent);
}

.btn-record {
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-family);
  color: #fff;
  background: var(--gradient-accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-record:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(42,157,143,0.35);
}

.btn-record.recording {
  background: linear-gradient(135deg, #E17055, #D63031);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225,112,85,0.4); }
  50% { box-shadow: 0 0 0 12px rgba(225,112,85,0); }
}

.btn-subtitle-action {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--text-secondary);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-subtitle-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-subtitle-action.clear:hover {
  border-color: var(--error);
  color: var(--error);
}

/* Recording indicator */
.recording-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--error);
}

.recording-indicator.show {
  display: flex;
}

.recording-dot {
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: 50%;
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 380px;
  border-left: 4px solid var(--accent);
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--error);
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--error); }
.toast.warning .toast-icon { color: var(--warning); }

.toast.removing {
  animation: toastSlideOut 0.3s ease-in forwards;
}

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

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

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 900px) {
  .auth-card {
    flex-direction: column;
    max-width: 460px;
  }

  .auth-brand {
    flex: 0 0 auto;
    padding: 28px 24px;
  }

  .auth-brand-features {
    display: none;
  }

  .workbench {
    flex-direction: column;
  }

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

  .panel-right {
    height: auto;
    flex: 1;
  }
}

@media (max-width: 600px) {
  .auth-form-section {
    padding: 24px 20px;
  }

  .navbar {
    padding: 0 12px;
  }

  .navbar-title {
    display: none;
  }

  .panel-left, .panel-right {
    padding: 16px;
  }
}

/* ============================================
   Utility Classes
   ============================================ */

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

/* API Key Modal specific */
.apikey-provider-select {
  margin-bottom: 16px;
}

.apikey-model-row {
  margin-top: 12px;
}
