:root {
  --bg-dark: #0a0e17;
  --surface-glass: rgba(255, 255, 255, 0.05);
  --surface-glass-hover: rgba(255, 255, 255, 0.08);
  --surface-card: rgba(18, 24, 38, 0.7);
  --border-glass: rgba(255, 255, 255, 0.1);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-primary: #6366f1;
  --accent-secondary: #ec4899;
  --accent-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Outfit', sans-serif;
  margin: 0;
}

/* Background Animated Mesh */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background-color: var(--bg-dark);
}

.mesh-blob {
  position: absolute;
  filter: blur(80px);
  border-radius: 50%;
  opacity: 0.4;
  animation: float 20s infinite ease-in-out alternate;
}

.blob-1 {
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: rgba(99, 102, 241, 0.3);
  animation-delay: 0s;
}

.blob-2 {
  bottom: -20%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: rgba(236, 72, 153, 0.2);
  animation-delay: -5s;
}

.blob-3 {
  top: 40%;
  left: 60%;
  width: 40vw;
  height: 40vw;
  background: rgba(16, 185, 129, 0.15);
  animation-delay: -10s;
}

.blob-4 {
  top: 20%;
  left: 20%;
  width: 45vw;
  height: 45vw;
  background: rgba(139, 92, 246, 0.2);
  animation-delay: -15s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(5%, 10%) scale(1.1);
  }

  100% {
    transform: translate(-5%, -5%) scale(0.95);
  }
}

/* App Layout */
.app-shell {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 20px 100px;
}

/* Hero Section */
.hero {
  margin-bottom: 32px;
  text-align: left;
}

.hero-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.hero-top-row .badge.glow {
  margin-bottom: 0;
}

.settings-btn {
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.settings-btn:hover {
  background: var(--surface-glass-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: rotate(45deg);
}

.badge.glow {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: var(--shadow-glow);
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(32px, 8vw, 48px);
  line-height: 1.1;
  font-weight: 800;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}

.subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 90%;
}

/* Glass Tabs */
.glass-nav {
  position: relative;
  /* background: var(--surface-glass); */
  /* backdrop-filter: blur(16px); */
  /* -webkit-backdrop-filter: blur(16px); */
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  padding: 6px;
  margin-bottom: 24px;
}

.tabs {
  display: flex;
  position: relative;
}

.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 16px;
  cursor: pointer;
  border-radius: 999px;
  transition: var(--transition);
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab.active {
  color: #fff;
}

.tab-icon {
  font-size: 16px;
}

/* The sliding background for active tab */
.tab-indicator {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 50%;
  background: var(--surface-glass);
  border-radius: 999px;
  z-index: 1;
  transition: transform var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.tabs:has(#tab-videos.active) .tab-indicator {
  transform: translateX(100%);
}

/* Podcast sub-section */
.section-header {
  margin-bottom: 16px;
}

.btn-back {
  width: auto;
  padding: 8px 16px;
  font-size: 14px;
}

.btn-podcast-link {
  margin-top: 8px;
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 14px 20px;
  border-radius: 14px;
  width: 100%;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-podcast-link:hover {
  background: var(--surface-glass-hover);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

/* Settings sheet title */
.sheet-header-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  margin-left: 12px;
}

/* Action Bar */
.action-bar {
  margin-bottom: 24px;
  display: flex;
}

/* Buttons */
.btn {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 14px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.btn.primary {
  background: var(--surface-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn.primary:hover {
  background: var(--surface-glass-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn.glow-btn {
  background: var(--accent-gradient);
  border: none;
  box-shadow: var(--shadow-glow);
}

.btn.glow-btn:hover {
  box-shadow: 0 0 25px rgba(236, 72, 153, 0.5);
  filter: brightness(1.1);
}

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

.btn.danger {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn.generating {
  pointer-events: none;
  opacity: 0.8;
  background: var(--surface);
  border: 1px solid var(--primary);
  color: var(--primary);
  position: relative;
  overflow: hidden;
}

.btn.generating::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.2), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  100% {
    left: 100%;
  }
}

.btn.ready {
  background: var(--success);
  color: white;
  border-color: var(--success);
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.4);
}

/* Status & Loader */
.status-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  min-height: 24px;
}

.status-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface-glass);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.hidden {
  display: none !important;
}

/* Panels */
.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Cards */
.item-card {
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.item-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0.5;
}

.item-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(26, 34, 51, 0.8);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text-primary);
}

.card-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-glass);
  white-space: nowrap;
}

.card-pill.viewed {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.2);
}

.card-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  display: flex;
  gap: 12px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--border-glass);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
}

/* Bottom Sheet */
.bottom-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

.bottom-sheet[aria-hidden="false"] {
  pointer-events: auto;
}

.sheet-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--transition);
}

.bottom-sheet[aria-hidden="false"] .sheet-overlay {
  opacity: 1;
}

.sheet-content {
  position: relative;
  background: var(--bg-dark);
  background: linear-gradient(180deg, rgba(26, 34, 51, 1) 0%, rgba(10, 14, 23, 1) 100%);
  padding: 0 24px 32px;
  height: 100vh;
  width: 100%;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
}

.bottom-sheet[aria-hidden="false"] .sheet-content {
  transform: translateY(0);
}

.sheet-header {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  margin: 0 -24px 24px -24px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(26, 34, 51, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sheet-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: auto;
  padding: 8px 16px;
  border-radius: 999px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.sheet-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sheet-body-scroll {
  overflow-y: auto;
  padding-bottom: 24px;
}

/* Summary Styles inside Sheet */
.summary-title {
  font-size: 24px;
  line-height: 1.2;
  margin-bottom: 12px;
  color: #fff;
}

.summary-meta {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 24px;
}

.summary-content {
  font-size: 16px;
  line-height: 1.7;
  color: #cbd5e1;
  white-space: pre-wrap;
}

.html-content {
  white-space: normal;
}

.html-content h1,
.html-content h2,
.html-content h3 {
  font-family: 'Outfit', sans-serif;
  color: #fff;
  margin-top: 24px;
  margin-bottom: 12px;
  line-height: 1.3;
}

.html-content h1 {
  font-size: 22px;
}

.html-content h2 {
  font-size: 20px;
}

.html-content h3 {
  font-size: 18px;
}

.html-content p {
  margin-top: 0;
  margin-bottom: 16px;
}

.html-content ul,
.html-content ol {
  margin-top: 0;
  margin-bottom: 16px;
  padding-left: 20px;
}

.html-content li {
  margin-bottom: 8px;
}

.html-content strong,
.html-content b {
  color: #fff;
}

.summary-list {
  padding-left: 20px;
  margin: 0 0 24px;
}

.summary-list li {
  margin-bottom: 12px;
  line-height: 1.6;
  color: #cbd5e1;
}

.sheet-divider {
  height: 1px;
  background: var(--border-glass);
  margin: 24px 0;
}

.summary-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* Loading Skeletons */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
    toast-out 0.3s ease 3s forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* Animations */
.slide-in-top {
  animation: slideInDown 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.fade-in {
  animation: fadeIn 0.8s ease both;
}

.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}