/* ==========================================================================
   VoxClone Studio - Premium Dark Aesthetic CSS
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', var(--font-sans);

  /* Color Palette */
  --bg-base: #090d16;
  --bg-surface: #0f172a;
  --bg-card: rgba(18, 26, 43, 0.75);
  --bg-card-hover: rgba(24, 35, 58, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(99, 102, 241, 0.4);

  /* Accent Gradients & Colors */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --secondary: #1e293b;
  --secondary-hover: #334155;
  --accent-glow: rgba(99, 102, 241, 0.25);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.25);
  --warning: #f59e0b;

  /* Typography */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Shadows & Glassmorphism */
  --glass-blur: blur(14px);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 35px var(--accent-glow);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  min-height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-main);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient Background Lights */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}

.glow-1 {
  width: 500px;
  height: 500px;
  top: -100px;
  left: 10%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.35) 0%, transparent 70%);
}

.glow-2 {
  width: 450px;
  height: 450px;
  bottom: 10%;
  right: 5%;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.2) 0%, transparent 70%);
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 13, 22, 0.8);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 1.5rem;
}

.header-container {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-studio {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-sm);
  letter-spacing: 0.08em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-status-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Status Badge */
.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.5);
  transition: all var(--transition-fast);
}

.status-badge:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--border-hover);
}

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

.status-online .status-dot {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}
.status-online {
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

.status-offline .status-dot {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}
.status-offline {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.status-checking .status-dot {
  background: var(--warning);
  animation: pulse 1.5s infinite;
}

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

/* Main Layout */
.main-layout {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.5rem;
}

/* License & Consent Notice Banner */
.license-banner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: #c7d2fe;
}

.banner-icon {
  color: #818cf8;
  flex-shrink: 0;
}

/* 2-Column Studio Grid */
.studio-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 980px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
}

/* Studio Panels */
.studio-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-normal);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.step-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.card-description {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

/* Input Choice Tabs */
.input-tabs {
  display: flex;
  background: rgba(15, 23, 42, 0.8);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}

.tab-btn {
  flex: 1;
  padding: 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* Drag & Drop Dropzone */
.dropzone {
  border: 2px dashed rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  padding: 2rem 1.25rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.5);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-1px);
}

.file-input-hidden {
  display: none;
}

.upload-icon {
  margin-bottom: 0.75rem;
  color: #818cf8;
}

.dropzone-text .primary-text {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.dropzone-text .secondary-text {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-link {
  background: none;
  border: none;
  color: #a5b4fc;
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  font-weight: 600;
}

/* Recorder Box */
.recorder-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
}

.recorder-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.record-pulsar {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all var(--transition-fast);
}

.record-pulsar.recording {
  background: var(--danger);
  box-shadow: 0 0 16px var(--danger);
  animation: pulse 1s infinite;
}

.record-timer {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-main);
}

.record-status-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.recorder-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

/* Reference Audio Preview */
.sample-preview-card {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
}

.preview-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.preview-icon {
  color: #818cf8;
}

.preview-meta {
  flex: 1;
  overflow: hidden;
}

.preview-filename {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-details {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.custom-audio-native {
  width: 100%;
  height: 36px;
  border-radius: var(--radius-sm);
  outline: none;
}

/* Consent Box */
.consent-box {
  margin-top: 1.25rem;
  padding: 0.85rem;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background: rgba(30, 41, 59, 0.5);
  flex-shrink: 0;
  margin-top: 2px;
  transition: all var(--transition-fast);
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark {
  background: var(--primary);
  border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
}

.consent-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Form Styles */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.68rem;
  color: var(--text-muted);
  cursor: help;
}

.form-select, .form-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-fast);
}

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

.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider-value-pill {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border-radius: var(--radius-sm);
}

.form-range {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  outline: none;
  margin: 0.5rem 0 0.25rem;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.6);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* Script Editor */
.script-tools {
  display: flex;
  gap: 0.5rem;
}

.script-editor-wrapper {
  margin-bottom: 0.75rem;
}

.script-textarea {
  width: 100%;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.94rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 160px;
  outline: none;
  transition: all var(--transition-fast);
}

.script-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.script-helpers {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.helper-label {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.btn-cue {
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: #c7d2fe;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-cue:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
}

/* Script Stats Bar */
.script-stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 0.85rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.stat-highlight .stat-number {
  color: #38bdf8;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1.4rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-normal);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.6);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--secondary-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-record {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-record:hover {
  background: rgba(239, 68, 68, 0.3);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-subtle {
  background: none;
  border: none;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.btn-subtle:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: var(--border-hover);
}

.btn-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.btn-remove:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-generate {
  width: 100%;
  padding: 0.95rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Generation Progress Box */
.progress-card {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(18, 26, 43, 0.9);
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.spinner-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.progress-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.progress-percent-label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: #a5b4fc;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.stepper-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

@media (max-width: 640px) {
  .stepper-list {
    grid-template-columns: 1fr;
  }
}

.step-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.step-bullet {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.65rem;
  flex-shrink: 0;
}

.step-active {
  color: #a5b4fc;
}

.step-active .step-bullet {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.6);
}

.step-done {
  color: var(--success);
}

.step-done .step-bullet {
  background: var(--success);
  color: white;
}

/* Studio Audio Player */
.output-card {
  border-color: rgba(16, 185, 129, 0.35);
}

.studio-player {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-play-large {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-gradient);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.btn-play-large:hover {
  transform: scale(1.06);
}

.player-timeline {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.time-readout {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.timeline-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  outline: none;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #38bdf8;
  cursor: pointer;
}

.speed-toggle-btn {
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.output-actions {
  display: flex;
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .output-actions {
    flex-direction: column;
  }
}

/* Pills */
.pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.pill-success {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pill-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.info-pill {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

/* History Card */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.history-item:hover {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(255, 255, 255, 0.15);
}

.history-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow: hidden;
  margin-right: 0.75rem;
}

.history-script {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.history-empty {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-content {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: modalEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.input-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.input-hint code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: #a5b4fc;
}

.system-stats-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stat-row span:last-child {
  font-weight: 600;
  color: var(--text-main);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.5);
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.75rem 1.25rem;
  background: #1e293b;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 0.84rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: toastIn 0.25s ease-out;
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.4);
  background: #201318;
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.4);
  background: #0f231c;
}

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

/* Footer */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.footer-container {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links a {
  color: #818cf8;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .footer-container {
    flex-direction: column;
    gap: 0.5rem;
  }
}

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