/* ==========================================================================
   VIDEO TOOL STUDIO - PREMIUM DESIGN SYSTEM (GLASSMORPHISM & DARK MODE)
   ========================================================================== */

/* Modern CSS Reset & Variable Definitions */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-title: 'Outfit', var(--font-sans);
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Color Palette */
  --bg-dark: #070a13;
  --panel-bg: rgba(13, 20, 38, 0.6);
  --panel-border: rgba(255, 255, 255, 0.07);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  
  --purple-glow: rgba(139, 92, 246, 0.15);
  --blue-glow: rgba(59, 130, 246, 0.15);
  
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Glowing Background Elements */
.glow-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: 
    radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.12) 0%, transparent 40%);
  filter: blur(80px);
  pointer-events: none;
}

/* Main Container Layout */
.app-container {
  width: 100%;
  max-width: 760px;
  margin: 2rem 1.5rem;
  padding: 2.5rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  transition: var(--transition-smooth);
}

/* Header Styles */
.app-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.logo-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.logo-area h1 {
  font-family: var(--font-title);
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
}

.logo-badge {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  letter-spacing: 0.05em;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.app-header .subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Tab Navigation Styles */
.tab-navigation {
  display: flex;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 0.35rem;
  gap: 0.25rem;
}

.tab-btn {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* App Main Content Area */
.app-main-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Card Styling */
.config-card {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Drag & Drop Zone Styles */
.upload-dropzone {
  border: 2px dashed rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.02);
  border-radius: 12px;
  padding: 2.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.06);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

.file-input-hidden {
  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: 0.75rem;
  pointer-events: none;
}

.icon-circle {
  width: 54px;
  height: 54px;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-purple);
  transition: var(--transition-smooth);
}

.upload-dropzone:hover .icon-circle {
  transform: translateY(-3px);
  background: rgba(139, 92, 246, 0.2);
  color: #c084fc;
}

.upload-svg {
  width: 26px;
  height: 26px;
}

.dropzone-main-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dropzone-sub-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.selected-filename {
  font-size: 0.9rem;
  color: var(--accent-emerald);
  font-weight: 500;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.selected-filename::before {
  content: '✓';
  font-weight: 700;
}

/* UI Dividers */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.divider span {
  padding: 0 1rem;
}

/* URL Input Styles */
.url-input-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.input-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  outline: none;
  transition: var(--transition-smooth);
}

.input-wrapper input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.15);
  background: rgba(15, 23, 42, 0.8);
}

.btn-clear {
  position: absolute;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.btn-clear:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  white-space: pre-line;
}

.hint-text.active {
  color: var(--accent-amber);
}

.hint-text.success {
  color: var(--accent-emerald);
}

/* Video Preview Panel Styles */
.preview-viewport {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.05);
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-viewport video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Action Area & Buttons */
.actions-area {
  display: flex;
  flex-direction: column;
}

.btn-action {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
  color: #fff;
  border: none;
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 1rem 2rem;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
  transition: var(--transition-smooth);
}

.btn-action:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
  background: linear-gradient(135deg, #9333ea 0%, #2563eb 100%);
}

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

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

/* Progress & Status Card styling */
.status-card {
  background: rgba(10, 15, 30, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.status-msg {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-msg.error {
  color: var(--accent-rose);
}

.status-msg.success {
  color: var(--accent-emerald);
}

.progress-pct {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-purple);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
  border-radius: 4px;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

/* Console Log Terminal styling */
.log-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.btn-clear-logs {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  transition: var(--transition-smooth);
}

.btn-clear-logs:hover {
  color: var(--text-secondary);
}

.log-terminal {
  background: #04060b;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: #cbd5e1;
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  scroll-behavior: smooth;
}

/* Scrollbar styles for the terminal */
.log-terminal::-webkit-scrollbar {
  width: 6px;
}

.log-terminal::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.log-terminal::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.log-terminal::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.1);
}

.log-line {
  word-break: break-all;
  white-space: pre-wrap;
}

.log-line.system {
  color: var(--text-muted);
}

.log-line.info {
  color: var(--accent-blue);
}

.log-line.warning {
  color: var(--accent-amber);
}

.log-line.error {
  color: var(--accent-rose);
}

.log-line.success {
  color: var(--accent-emerald);
}

/* Footer & Attributions */
.app-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.attribution {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.attribution code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  color: var(--text-secondary);
}

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

/* Responsive Scaling Adjustments */
@media (max-width: 640px) {
  .app-container {
    padding: 1.5rem;
    margin: 1rem;
  }
  .logo-area h1 {
    font-size: 2rem;
  }
}
