/* Global Resets & Typography */
:root {
  --bg-color: #070a13;
  --card-bg: rgba(13, 20, 38, 0.65);
  --card-border: rgba(255, 255, 255, 0.06);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --primary: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.5);
  --secondary: #3b82f6;
  --accent: #ec4899;
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --error: #ef4444;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', var(--font-family);
}

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

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

/* Background Gradients */
.glow-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background: 
    radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.05) 0%, transparent 60%);
  background-attachment: fixed;
}

/* Container Layout */
.container {
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Header Styling */
header {
  text-align: center;
  margin-bottom: 10px;
}

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

.logo-icon {
  width: 36px;
  height: 36px;
  color: var(--primary);
  filter: drop-shadow(0 0 10px var(--primary-glow));
  animation: pulse 3s infinite ease-in-out;
}

header h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa 0%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Card Style (Glassmorphism) */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 30px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.url-card {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Input & Button Groups */
.input-group {
  display: flex;
  gap: 12px;
}

input[type="text"] {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 20px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.25);
}

/* Buttons */
.btn {
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 16px 28px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.btn-primary:active {
  transform: translateY(1px);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.btn-icon {
  padding: 12px 20px;
}

/* Glowing Download Button */
.btn-glowing {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 18px 36px;
  width: 100%;
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
  margin-top: 10px;
}

.btn-glowing:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(139, 92, 246, 0.6), 0 0 15px rgba(236, 72, 153, 0.4);
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s infinite linear;
  display: inline-block;
}

.hidden {
  display: none !important;
}

/* Error Banner */
.error-banner {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: left;
}

/* Video info header */
.video-info-header {
  display: flex;
  gap: 20px;
  margin-bottom: 25px;
  align-items: center;
}

.video-thumb {
  width: 120px;
  height: 68px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.video-details {
  flex: 1;
}

#video-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.author-label, .duration-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.author-label span, .duration-label span {
  color: var(--text-main);
  font-weight: 500;
}

/* Player Frame */
.player-wrapper {
  margin-bottom: 30px;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 40px rgba(0,0,0,0.8);
}

.aspect-ratio-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
}

.aspect-ratio-container iframe,
#player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Slider Controls */
.trim-controls {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 25px;
}

.trim-controls h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-muted);
}

/* Double Slider CSS */
.slider-container {
  position: relative;
  width: 100%;
  height: 8px;
  margin: 35px 0 25px 0;
  background: none;
}

.slider-track {
  position: absolute;
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  z-index: 1;
}

.slider-range {
  position: absolute;
  height: 8px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 4px;
  z-index: 2;
}

.range-thumb {
  position: absolute;
  width: 100%;
  height: 8px;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  margin: 0;
  z-index: 3;
  left: 0;
}

/* Style Range Thumb */
.range-thumb::-webkit-slider-thumb {
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--primary);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4), 0 0 10px var(--primary-glow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.range-thumb::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  border-color: var(--accent);
}

.range-thumb::-moz-range-thumb {
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--primary);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4), 0 0 10px var(--primary-glow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.range-thumb::-moz-range-thumb:hover {
  transform: scale(1.15);
  border-color: var(--accent);
}

/* Time Input Fields */
.time-inputs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 10px;
}

.time-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.time-box label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.time-input-group {
  display: flex;
  gap: 8px;
}

.time-input-group input {
  width: 100px;
  text-align: center;
  font-family: monospace;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-radius: 10px;
  padding: 10px;
}

.btn-set-time {
  flex: 1;
  padding: 10px 14px;
  font-size: 0.85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  gap: 4px;
}

.btn-set-time:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.25);
  color: var(--text-main);
}

.icon-sm {
  width: 14px;
  height: 14px;
}

/* Range Action Bar */
.range-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 25px;
}

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

.range-duration span {
  font-family: var(--font-display);
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
}

.icon-play, .icon-pause {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.divider {
  border: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 30px 0;
}

/* Download Section & Formats */
.download-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.download-section h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
}

.format-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.format-card {
  position: relative;
  background: rgba(255, 255, 255, 0.02);
  border: 2px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 18px 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.format-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

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

.format-ext {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  transition: color 0.3s;
}

.format-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.check-icon {
  width: 20px;
  height: 20px;
  color: var(--primary);
  opacity: 0;
  transform: scale(0.7);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Selected Format State */
.format-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.format-card.active {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.06);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.15);
}

.format-card.active .format-ext {
  color: var(--primary);
}

.format-card.active .check-icon {
  opacity: 1;
  transform: scale(1);
}

/* Progress & Terminal Panel */
.progress-panel {
  margin-top: 30px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

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

.progress-status {
  color: var(--text-main);
  font-weight: 500;
}

.progress-percentage {
  color: var(--primary);
  font-weight: 700;
  font-family: var(--font-display);
}

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

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
  transition: width 0.3s ease;
}

/* Monospace Terminal Logs */
.terminal-logs-wrapper {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.terminal-header {
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-clear-logs {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
  outline: none;
}

.btn-clear-logs:hover {
  text-decoration: underline;
}

.terminal-body {
  background: #04060b;
  color: #10b981; /* Lime/Emerald terminal text */
  padding: 16px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
  text-align: left;
}

/* Footer */
footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 10px;
  opacity: 0.7;
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.05); opacity: 1; filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.8)); }
}

/* Responsive adjustment */
@media (max-width: 600px) {
  body {
    padding: 20px 10px;
  }
  
  .card {
    padding: 20px;
  }
  
  header h1 {
    font-size: 2rem;
  }
  
  .input-group {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
  
  .time-inputs-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .time-input-group input {
    flex: 1;
  }
  
  .format-options {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
