/* =========
   THEME
   ========= */
html[data-theme="light"],
html:not([data-theme]) {
  --background: #fdfdfd;
  --foreground: #0f172a;

  --muted: #f9fafb;
  --muted-foreground: #6b7280;

  --primary: #ec4899;
  --primary-soft: #f97316;
  --primary-foreground: #ffffff;

  --secondary: #eff6ff;
  --secondary-foreground: #1d4ed8;

  --border: #e5e7eb;
  --radius-xl: 1.5rem;
  --radius-lg: 1rem;
  --radius-md: 0.75rem;
  --radius-full: 999px;

  --shadow-soft: 0 18px 60px rgba(15, 23, 42, 0.10);
  --shadow-sm: 0 8px 20px rgba(15, 23, 42, 0.06);
}

html[data-theme="dark"] {
  --background: #020817;
  --foreground: #e5e7eb;

  --muted: #020817;
  --muted-foreground: #9ca3af;

  --primary: #ec4899;
  --primary-soft: #f97316;
  --primary-foreground: #ffffff;

  --secondary: #111827;
  --secondary-foreground: #e5e7eb;

  --border: #111827;

  --shadow-soft: 0 18px 60px rgba(0, 0, 0, 0.7);
  --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.5);
}

/* =========
   GLOBAL
   ========= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, -system-ui, sans-serif;
  background: radial-gradient(circle at top, rgba(236, 72, 153, 0.04), transparent),
              var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* =========
   LAYOUT
   ========= */

.header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
}

html[data-theme="dark"] .header {
  background: rgba(2, 8, 23, 0.96);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1rem;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0;
  gap: 1.25rem;
}

/* Logo */
.logo-section {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 1.1rem;
  background: linear-gradient(to bottom right, var(--primary), var(--primary-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(236, 72, 153, 0.4);
}

.logo-text h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--foreground);
}

.logo-text p {
  margin: 0;
  font-size: 0.65rem;
  color: var(--muted-foreground);
}

/* Theme toggle */
.theme-toggle {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.18s ease;
}

.theme-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
}

/* Main wrapper */
.main-content {
  padding: 2.2rem 0 3rem;
}

.main-content .container {
  max-width: 1120px;
}

/* =========
   CARD / WRAPPER
   ========= */

.card {
  background: var(--background);
  border-radius: var(--radius-xl);
  padding: 1.7rem 1.5rem 1.7rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.25rem;
}

html[data-theme="dark"] .card {
  box-shadow: var(--shadow-soft);
}

/* =========
   TABS
   ========= */

.tabs-container {
  margin-bottom: 1rem;
}

.tabs-list {
  display: flex;
  gap: 0.35rem;
  padding: 0.3rem;
  border-radius: var(--radius-full);
  background: var(--muted);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.tab-trigger {
  flex: 1;
  border: none;
  border-radius: var(--radius-full);
  padding: 0.48rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted-foreground);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.tab-trigger i {
  font-size: 0.8rem;
}

.tab-trigger.active {
  color: var(--primary-foreground);
  background: linear-gradient(to right, var(--primary), var(--primary-soft));
  box-shadow: 0 6px 16px rgba(236, 72, 153, 0.35);
}

.tab-content {
  display: none;
  margin-top: 0.5rem;
}

.tab-content.active {
  display: block;
}

/* =========
   DOWNLOADER
   ========= */

.download-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--foreground);
}

.download-header p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted-foreground);
}

/* Input row */
.input-container {
  margin-top: 1rem;
}

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

.input-icon-left {
  position: absolute;
  left: 0.9rem;
  color: #9ca3af;
  font-size: 0.9rem;
}

.url-input {
  flex: 1;
  padding: 0.75rem 0.9rem 0.75rem 2.3rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  font-size: 0.86rem;
  color: var(--foreground);
  background: var(--background);
  outline: none;
  transition: all 0.18s ease;
}

.url-input::placeholder {
  color: #9ca3af;
}

.url-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(236, 72, 153, 0.35);
}

/* Paste button */
.paste-button {
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-lg);
  border: none;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.paste-button i {
  font-size: 0.8rem;
}

.paste-button:hover {
  background: var(--primary);
  color: #ffffff;
}

/* Analyze / New */
.button-container {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.btn {
  border: none;
  cursor: pointer;
  border-radius: var(--radius-lg);
  padding: 0.8rem 1.1rem;
  font-size: 0.86rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.18s ease;
}

.btn-primary {
  background: linear-gradient(to right, var(--primary), var(--primary-soft));
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(236, 72, 153, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(236, 72, 153, 0.45);
}

.new-video-btn {
  background: var(--muted);
  color: var(--foreground);
  border-radius: var(--radius-lg);
}

.new-video-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

/* =========
   LOADING / ERROR
   ========= */

.loading-state,
.error-state {
  margin-top: 0.9rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.loading-state {
  background: rgba(236, 72, 153, 0.04);
  color: var(--muted-foreground);
  border: 1px solid rgba(236, 72, 153, 0.22);
}

.error-state {
  background: rgba(220, 38, 38, 0.06);
  color: #b91c1c;
  border: 1px solid rgba(248, 113, 113, 0.45);
}

.hidden {
  display: none !important;
}

/* =========
   VIDEO PREVIEW
   ========= */

#video-preview .card {
  margin-bottom: 1rem;
}

.video-info-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.video-thumbnail {
  width: 140px;
  min-width: 120px;
  border-radius: 1rem;
  overflow: hidden;
  background: #000;
}

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

.video-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.video-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--foreground);
}

.video-author {
  font-size: 0.8rem;
  color: #3b82f6;
  margin: 0;
}

.video-description {
  font-size: 0.78rem;
  color: var(--muted-foreground);
  margin: 0.2rem 0 0.2rem;
}

/* Stats */
.video-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.3rem;
}

.stat-item {
  min-width: 60px;
  padding: 0.35rem 0.55rem;
  border-radius: 0.7rem;
  background: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  align-items: flex-start;
  font-size: 0.7rem;
}

.stat-icon {
  font-size: 0.8rem;
}

.stat-value {
  font-weight: 600;
  color: var(--foreground);
}

.stat-label {
  color: var(--muted-foreground);
}

/* =========
   PROGRESS
   ========= */

.progress-container {
  margin-top: 1rem;
  padding: 0.9rem 0.9rem 0.9rem;
  border-radius: var(--radius-lg);
  background: var(--muted);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.progress-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.progress-icon {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(148, 163, 253, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, var(--primary), var(--primary-soft));
  transform: translateX(-100%);
  transform-origin: left center;
  transition: transform 0.22s ease;
}

/* =========
   DOWNLOAD OPTIONS
   ========= */

.download-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.download-option {
  padding: 1rem 0.9rem;
  border-radius: 1rem;
  background: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.download-option-icon {
  width: 34px;
  height: 34px;
  border-radius: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(15,23,42,0.08);
}

.quality-badge {
  display: inline-flex;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 600;
  background: rgba(236,72,153,0.08);
  color: var(--primary);
}

.download-option h3 {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--foreground);
}

.download-option p {
  font-size: 0.74rem;
  color: var(--muted-foreground);
}

.download-btn {
  margin-top: 0.2rem;
  padding: 0.55rem 0.85rem;
  border-radius: 0.8rem;
  border: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(to right, var(--primary), var(--primary-soft));
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.download-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(236,72,153,0.4);
}

/* =========
   HISTORY
   ========= */

.history-item {
  display: flex;
  gap: 0.8rem;
  padding: 0.65rem 0.55rem;
  border-radius: 0.9rem;
  background: var(--muted);
  margin-bottom: 0.45rem;
}

.history-thumbnail {
  width: 90px;
  min-width: 90px;
  border-radius: 0.7rem;
  overflow: hidden;
  background: #000;
}

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

/* =========
   FAQ
   ========= */

.faq-item {
  border-radius: 0.9rem;
  border: 1px solid var(--border);
  background: var(--background);
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.faq-trigger {
  width: 100%;
  padding: 0.65rem 0.8rem;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--foreground);
}

.faq-trigger i.fa-chevron-down {
  font-size: 0.7rem;
  color: var(--muted-foreground);
  transition: transform 0.2s ease;
}

.faq-content {
  padding: 0.5rem 0.8rem 0.7rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* =========
   TOAST (folosit de showToast din script.js)
   ========= */

.toast {
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  color: #ffffff;
  background: #111827;
  box-shadow: 0 8px 18px rgba(15,23,42,0.45);
}

.toast-success {
  background: #16a34a;
}

.toast-error {
  background: #dc2626;
}

/* =========
   RESPONSIVE
   ========= */

@media (max-width: 640px) {
  .header-content {
    padding: 0.55rem 0;
  }

  .card {
    padding: 1.25rem 1rem;
  }

  .video-info-card {
    flex-direction: column;
  }

  .video-thumbnail {
    width: 100%;
    max-width: 260px;
  }

  .tabs-list {
    gap: 0.25rem;
  }

  .tab-trigger {
    font-size: 0.72rem;
    padding: 0.45rem 0.65rem;
  }
}
