:root {
  --bg-color: #080c14;
  --card-bg: rgba(15, 23, 42, 0.72);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-hover-border: rgba(99, 102, 241, 0.4);
  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-violet: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background Glow Effects */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

.orb-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, var(--accent-indigo), transparent);
  top: -100px;
  left: 10%;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-cyan), transparent);
  bottom: -100px;
  right: 10%;
}

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

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
}

.logo-icon svg {
  width: 24px;
  height: 24px;
}

.logo-text h1 {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff 30%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.vps-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  font-weight: 600;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent-emerald);
}

.status-indicator {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Glassmorphic Cards */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.36);
  transition: var(--transition);
}

/* URL Input */
.input-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.input-group {
  display: flex;
  align-items: center;
  background: rgba(10, 15, 29, 0.7);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 6px 8px 6px 14px;
  gap: 12px;
  transition: var(--transition);
}

.input-group:focus-within {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-paste {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-paste:hover {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.3);
}

.btn-paste:active {
  transform: scale(0.95);
}

.btn-paste svg {
  width: 18px;
  height: 18px;
}

.input-group input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.96rem;
  font-family: var(--font-body);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-violet));
  color: #ffffff;
  padding: 10px 22px;
  font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

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

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

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

.error-banner {
  margin-top: 14px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #fda4af;
  font-size: 0.88rem;
}

/* Video Preview Header */
.video-preview-header {
  display: flex;
  gap: 20px;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--card-border);
}

.thumbnail-wrapper {
  position: relative;
  width: 190px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duration-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.video-details {
  flex: 1;
  min-width: 0;
}

.video-details h2 {
  font-family: var(--font-heading);
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-details p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.duration-info {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.duration-info strong {
  color: var(--text-primary);
}

/* Tabs */
.tabs-wrapper {
  display: flex;
  gap: 10px;
  margin: 20px 0;
  background: rgba(10, 15, 29, 0.5);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

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

.tab-btn svg {
  width: 18px;
  height: 18px;
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.25));
  color: #fff;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

/* Trimmer Card */
.trimmer-card {
  background: rgba(10, 15, 29, 0.5);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
}

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

.trimmer-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: 0.3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
}

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

.trim-inputs {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
}

.trim-fields-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

/* Dual Range Slider Styles */
.dual-range-slider {
  position: relative;
  width: 100%;
  height: 24px;
  margin-top: 10px;
  margin-bottom: 6px;
}

.dual-range-slider .track {
  position: absolute;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  top: 9px;
  z-index: 1;
}

.dual-range-slider .range-fill {
  position: absolute;
  height: 6px;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-cyan));
  border-radius: 3px;
  top: 9px;
  z-index: 2;
}

.dual-range-slider input[type="range"] {
  position: absolute;
  width: 100%;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  z-index: 3;
  height: 24px;
  top: 0;
  margin: 0;
}

.dual-range-slider input[type="range"]::-webkit-slider-thumb {
  pointer-events: all;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  border: 2px solid #fff;
  cursor: pointer;
  -webkit-appearance: none;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  position: relative;
  z-index: 4;
}

.dual-range-slider input[type="range"]:focus {
  outline: none;
}

.trim-field {
  flex: 1;
  min-width: 120px;
}

.trim-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.trim-field input {
  width: 100%;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
}

.trim-field input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.trim-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
  padding-top: 18px;
}

.trim-summary {
  width: 100%;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.trim-summary strong {
  color: var(--accent-cyan);
}

/* Quality Section */
.quality-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-subtitle {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.size-notice {
  font-size: 0.78rem;
  color: var(--accent-cyan);
  font-weight: 500;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

/* Option Card */
.option-card {
  background: rgba(10, 15, 29, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  position: relative;
}

.option-card:hover {
  border-color: var(--card-hover-border);
  background: rgba(15, 23, 42, 0.8);
  transform: translateY(-2px);
}

.option-card.selected {
  border-color: var(--accent-indigo);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.1));
  box-shadow: 0 0 0 2px var(--accent-indigo);
}

.option-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.option-details {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Dynamic Estimated Size Pill Badge */
.size-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: #67e8f9;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
  white-space: nowrap;
}

.option-card.selected .size-badge {
  background: var(--accent-cyan);
  color: #080c14;
  border-color: var(--accent-cyan);
}

/* Action Footer */
.action-footer {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}

.btn-action {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.35);
}

.btn-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(6, 182, 212, 0.5);
}

.btn-action svg {
  width: 20px;
  height: 20px;
}

/* Progress Card */
.progress-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.progress-status-header h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
}

#progress-percentage-badge {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-cyan));
  border-radius: 9999px;
  transition: width 0.3s ease;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.6);
}

.progress-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Download Ready Box */
.download-ready-box {
  margin-top: 14px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.success-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-emerald);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.success-icon svg {
  width: 20px;
  height: 20px;
}

.file-summary {
  flex: 1;
  min-width: 180px;
}

.file-summary h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}

.file-summary span {
  font-size: 0.82rem;
  color: #a7f3d0;
}

.btn-download-file {
  background: var(--accent-emerald);
  color: #064e3b;
  padding: 10px 22px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-download-file:hover {
  background: #34d399;
  transform: translateY(-1px);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  body {
    padding: 20px 12px;
  }
  .video-preview-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .thumbnail-wrapper {
    width: 100%;
  }
  .options-grid {
    grid-template-columns: 1fr;
  }
}
