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

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a25;
  --bg-card: #14141e;
  --border-color: #2a2a3a;
  --border-hover: #3a3a5a;
  --text-primary: #e8e8f0;
  --text-secondary: #9090a8;
  --text-muted: #606078;
  --accent-tts: #6c5ce7;
  --accent-tts-light: #a29bfe;
  --accent-video: #00cec9;
  --accent-video-light: #55efc4;
  --danger: #ff6b6b;
  --success: #51cf66;
  --warning: #ffd43b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --transition: all 0.3s ease;
}

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

/* ==================== Header ==================== */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 20px 40px;
  text-align: center;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
  background: linear-gradient(135deg, var(--accent-tts), var(--accent-video));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo h1 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-tts-light), var(--accent-video-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
  font-weight: 400;
}

/* ==================== Main Layout ==================== */
.main-container {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  gap: 24px;
  min-height: calc(100vh - 100px);
}

.divider {
  width: 1px;
  background: var(--border-color);
  flex-shrink: 0;
}

/* ==================== Panel ==================== */
.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.panel:hover {
  border-color: var(--border-hover);
}

.panel-tts { border-top: 3px solid var(--accent-tts); }
.panel-video { border-top: 3px solid var(--accent-video); }

.panel-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

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

.panel-header h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.panel-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.panel-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ==================== Input Group ==================== */
.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.text-input:focus {
  outline: none;
  border-color: var(--accent-tts);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

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

.char-count {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ==================== Drop Zone ==================== */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-secondary);
  position: relative;
  overflow: hidden;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent-video);
  background: rgba(0, 206, 201, 0.05);
}

.drop-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.drop-icon {
  font-size: 48px;
  opacity: 0.6;
}

.drop-placeholder p {
  color: var(--text-secondary);
  font-size: 14px;
}

.drop-hint {
  font-size: 12px !important;
  color: var(--text-muted) !important;
}

.image-preview {
  max-width: 100%;
  max-height: 300px;
  border-radius: 6px;
  object-fit: contain;
}

.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-clear {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-clear:hover {
  background: rgba(255, 107, 107, 0.1);
}

/* ==================== Buttons ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.3px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-tts), var(--accent-video));
  color: white;
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(108, 92, 231, 0.4);
}

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

.panel-tts .btn-primary {
  background: linear-gradient(135deg, var(--accent-tts), #8b7cf7);
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.3);
}

.panel-video .btn-primary {
  background: linear-gradient(135deg, var(--accent-video), #00b4d8);
  box-shadow: 0 4px 16px rgba(0, 206, 201, 0.3);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

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

.btn-icon {
  font-size: 16px;
}

/* ==================== Result Section ==================== */
.result-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  animation: fadeIn 0.3s ease;
}

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

.result-header {
  margin-bottom: 12px;
}

.result-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

audio, video {
  width: 100%;
  border-radius: 8px;
  outline: none;
}

audio::-webkit-media-controls-panel {
  background: var(--bg-tertiary);
}

video {
  background: #000;
  max-height: 400px;
}

.result-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

/* ==================== Loading Overlay ==================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.loading-content {
  text-align: center;
  padding: 40px;
}

.loading-spinner {
  width: 56px;
  height: 56px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-tts);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 0.8s linear infinite;
}

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

.loading-content p {
  font-size: 16px;
  font-weight: 500;
}

.loading-hint {
  color: var(--text-secondary);
  font-size: 13px !important;
  font-weight: 400 !important;
  margin-top: 8px;
}

/* ==================== Toast ==================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.toast-success {
  background: rgba(81, 207, 102, 0.15);
  border: 1px solid rgba(81, 207, 102, 0.3);
  color: var(--success);
}

.toast-error {
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: var(--danger);
}

.toast-info {
  background: rgba(108, 92, 231, 0.15);
  border: 1px solid rgba(108, 92, 231, 0.3);
  color: var(--accent-tts-light);
}

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

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

/* ==================== Utilities ==================== */
.hidden {
  display: none !important;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
    padding: 16px;
  }

  .divider {
    width: 100%;
    height: 1px;
  }

  .header {
    padding: 16px 20px;
  }

  .logo h1 {
    font-size: 20px;
  }

  .panel-body {
    padding: 16px;
  }
}
