/* Variables & Color Palette */
:root {
  --bg-color: #0b0f19;
  --card-bg: rgba(17, 25, 40, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #8b5cf6; /* Accent primary: violet */
  --primary-hover: #7c3aed;
  --primary-glow: rgba(139, 92, 246, 0.15);
  --secondary: #ec4899; /* Accent secondary: pink */
  --secondary-hover: #db2777;
  --secondary-glow: rgba(236, 72, 153, 0.15);
  --danger: #ef4444;
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --radius-lg: 16px;
  --radius-md: 12px;
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  overflow-x: hidden;
}

/* Dynamic Glowing Background Effect */
.glow-bg {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, rgba(236, 72, 153, 0.04) 50%, transparent 100%);
  z-index: -1;
  pointer-events: none;
  filter: blur(40px);
  animation: pulseGlow 10s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
  0% {
    width: 450px;
    height: 450px;
    opacity: 0.8;
  }
  100% {
    width: 550px;
    height: 550px;
    opacity: 1.2;
  }
}

/* App Containers */
.app-container {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 1;
}

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

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
}

.app-header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 30%, #fbcfe8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 400;
}

/* Card Components with Glassmorphism */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Dropzone styling */
.dropzone {
  position: relative;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  transition: all 0.25s ease;
  cursor: pointer;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.03);
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.upload-icon {
  color: var(--text-muted);
  transition: transform 0.3s ease, color 0.3s ease;
}

.dropzone:hover .upload-icon {
  color: var(--primary);
  transform: translateY(-4px);
}

.dropzone-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

.dropzone-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 14px 0 var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px 0 var(--primary-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-block {
  width: 100%;
}

.select-btn {
  margin-top: 8px;
}

/* File info card details */
.file-details {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.03);
  padding: 16px;
  border-radius: var(--radius-md);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.file-icon {
  color: var(--secondary);
}

.file-metadata {
  flex-grow: 1;
  min-width: 0;
}

.file-metadata h4 {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-metadata p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--danger);
}

/* Audio Player styling */
.audio-preview-container {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.audio-preview-container audio {
  width: 100%;
  border-radius: 8px;
}

/* Processing card elements */
.processing-card {
  align-items: center;
  text-align: center;
  padding: 40px 24px;
}

.spinner-container {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.spinner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid rgba(139, 92, 246, 0.1);
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}

.spinner-inner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.progress-percent {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.status-subtext {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 16px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width 0.1s ease;
}

/* Language Selection Custom Toggle */
.language-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selector-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.toggle-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Model Size Toggle (Tiny vs Base) */
.model-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Result Card & OCR Text Block */
.result-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.transcribe-textarea {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 16px;
  min-height: 200px;
  max-height: 500px;
  resize: vertical;
  outline: none;
  line-height: 1.6;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.transcribe-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.1);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

/* Toast Alert Style */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(139, 92, 246, 0.9);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
  z-index: 999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Footer layout */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 8px;
}

.app-footer a {
  color: var(--primary);
  text-decoration: none;
}

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