:root {
  --bg-main: #090d16;
  --bg-card: #0f1624;
  --bg-card-hover: #151f33;
  --bg-input: #0b111c;
  --border: #1e293b;
  --border-focus: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-glow: rgba(16, 185, 129, 0.2);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.15);
  --purple: #a855f7;
  --danger: #ef4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

.font-mono {
  font-family: var(--font-mono);
}

.app-container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

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

.brand-title {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--primary);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 36px 0 48px;
}

/* Hero Section */
.hero-section {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 36px;
}

.hero-title {
  font-size: clamp(1.85rem, 5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 12px;
}

.gradient-text {
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: clamp(0.92rem, 2.5vw, 1.02rem);
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 28px;
}

/* Input Card */
.input-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease;
}

.input-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.input-wrapper {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-icon {
  width: 18px;
  height: 18px;
  margin-left: 14px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.input-wrapper input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 14px 10px;
  color: var(--text-main);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
}

.input-wrapper input::placeholder {
  color: var(--text-dim);
}

/* Action Icon Buttons inside Input (Clear & Paste) */
.action-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 10px;
  margin-right: 6px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  height: 32px;
  min-width: 32px;
  flex-shrink: 0;
}

.action-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

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

.clear-btn {
  padding: 6px;
  color: var(--text-dim);
}

.clear-btn:hover {
  color: #fff;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

/* Submit Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  border: none;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
  min-height: 44px;
}

.btn-primary {
  background: var(--primary);
  color: #032013;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

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

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn svg,
.btn-svg,
.btn-icon {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  flex-shrink: 0 !important;
  display: inline-block;
  vertical-align: middle;
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #032013;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-primary.loading .btn-text,
.btn-primary.loading .btn-icon {
  display: none;
}

.btn-primary.loading .spinner {
  display: inline-block;
}

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

/* Minimalist Loading State */
.loading-state {
  margin-top: 14px;
  padding: 8px 4px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeIn 0.2s ease;
}

.loading-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.loading-progress {
  width: 35%;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #06b6d4);
  border-radius: 9999px;
  position: absolute;
  animation: glide 1.3s ease-in-out infinite;
}

@keyframes glide {
  0% { left: -35%; width: 25%; }
  50% { left: 45%; width: 45%; }
  100% { left: 100%; width: 25%; }
}

.loading-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
  font-family: var(--font-mono);
}

/* Alert Card */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  align-items: flex-start;
}

.alert-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.alert-error svg {
  width: 20px;
  height: 20px;
  color: var(--danger);
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.alert-title {
  font-weight: 700;
  color: #fecaca;
  font-size: 0.9rem;
}

.alert-msg {
  font-size: 0.84rem;
  color: #fca5a5;
  word-break: break-word;
}

/* Result Card */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 36px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  gap: 10px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
}

.result-badge svg {
  width: 16px;
  height: 16px;
}

.meta-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.result-body {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 22px;
  align-items: start;
}

/* Media (Thumbnail & Video) */
.media-container {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}

.thumbnail-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
}

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

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #032013;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
}

.play-overlay:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: #22c55e;
}

.play-overlay svg {
  width: 22px;
  height: 22px;
  margin-left: 2px;
}

.player-wrapper {
  width: 100%;
  height: 100%;
}

.player-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* Info Container */
.info-container {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.video-title {
  font-size: clamp(1.15rem, 3vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  line-height: 1.35;
  word-break: break-word;
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.spec-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.spec-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.spec-value {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-success {
  color: var(--primary);
}

/* Actions */
.action-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.btn-download,
.btn-secondary {
  height: 46px;
  min-height: 46px;
  max-height: 46px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1;
}

.btn-download {
  flex: 1.6;
  min-width: 170px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-download:hover {
  background: linear-gradient(135deg, #22c55e, #10b981);
  transform: translateY(-1px);
}

.btn-secondary {
  flex: 1;
  min-width: 120px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-main);
}

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

.btn-download svg,
.btn-secondary svg {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  flex-shrink: 0 !important;
}

/* Technical Details Section */
.tech-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.tech-header {
  margin-bottom: 14px;
}

.tech-header h3 {
  font-size: 0.98rem;
  font-weight: 700;
}

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

.tabs-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  min-height: 36px;
}

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

.tab-btn.active {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--cyan);
  color: var(--cyan);
}

.tab-panel {
  display: none;
}

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

.code-box {
  background: #060a12;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.code-box pre {
  margin: 0;
  padding-right: 65px;
}

.code-box code {
  color: #38bdf8;
  font-size: 0.82rem;
  word-break: break-all;
  white-space: pre-wrap;
  line-height: 1.5;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 30px;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.copy-btn svg {
  width: 12px;
  height: 12px;
}

.copy-btn.copied {
  background: var(--primary);
  color: #032013;
  border-color: var(--primary);
}

.tab-hint {
  font-size: 0.78rem;
  color: #fbbf24;
  margin-top: 8px;
  line-height: 1.4;
}

.tab-hint code {
  background: rgba(251, 191, 36, 0.1);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 36px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.feature-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.feature-icon svg {
  width: 18px;
  height: 18px;
}

.text-cyan { color: var(--cyan); }
.text-green { color: var(--primary); }
.text-purple { color: var(--purple); }

.feature-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #10b981;
  color: #032013;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   Mobile-First Responsiveness (Tablets & Phones: 360px - 768px)
   ========================================================================== */

@media (max-width: 820px) {
  .result-body {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .app-container {
    padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  }

  .navbar {
    padding: 14px 0;
  }

  .main-content {
    padding: 24px 0 36px;
  }

  .hero-section {
    margin-bottom: 24px;
  }

  .hero-title {
    margin-bottom: 8px;
  }

  .hero-desc {
    margin-bottom: 20px;
  }

  .input-card {
    padding: 8px;
  }

  .input-form {
    flex-direction: column;
    gap: 8px;
  }

  .input-wrapper {
    height: 48px;
  }

  .input-wrapper input {
    padding: 10px 8px;
    font-size: 0.9rem;
  }

  .btn-primary {
    width: 100%;
    height: 48px;
    font-size: 0.95rem;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn-download,
  .btn-secondary {
    width: 100%;
    height: 48px;
  }

  .result-card {
    padding: 16px 14px;
  }

  .media-container {
    width: 100%;
    aspect-ratio: 16/9;
    min-height: 200px;
    border-radius: var(--radius-md);
  }

  .play-overlay {
    width: 56px;
    height: 56px;
  }

  .play-overlay svg {
    width: 24px;
    height: 24px;
  }

  .specs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .spec-item {
    padding: 6px 10px;
  }

  .spec-label {
    font-size: 0.68rem;
  }

  .spec-value {
    font-size: 0.82rem;
  }

  .code-box pre {
    padding-right: 0;
    padding-top: 32px;
  }

  .copy-btn {
    top: 6px;
    right: 6px;
  }

  .toast {
    left: 20px;
    right: 20px;
    bottom: 16px;
    text-align: center;
  }
}

/* Extra Small Phones (360px - 420px) */
@media (max-width: 420px) {
  .btn-label-text {
    display: none;
  }

  .action-icon-btn.paste-btn {
    padding: 6px;
  }

  .brand-sub {
    display: none;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Folder Collection Styles
   ========================================================================== */
.folder-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 36px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.25s ease;
}

.folder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.folder-meta-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.folder-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

.folder-icon {
  width: 20px;
  height: 20px;
  color: #f59e0b;
}

.folder-count-badge {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Subfolders Bar */
.subfolders-bar {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.subfolder-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
}

.subfolders-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.subfolder-chip {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.subfolder-chip:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #fff;
}

.subfolder-chip svg {
  width: 14px;
  height: 14px;
}

/* Folder Video Grid */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.folder-item-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
}

.folder-item-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.folder-item-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  z-index: 2;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.folder-hint-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}

.folder-item-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.folder-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.folder-item-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #032013;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.92;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.folder-item-card:hover .folder-item-play {
  transform: translate(-50%, -50%) scale(1.1);
  opacity: 1;
  background: #22c55e;
}

.folder-item-play:active {
  transform: translate(-50%, -50%) scale(0.95);
}


.folder-item-play svg {
  width: 16px;
  height: 16px;
  margin-left: 2px;
}

.folder-item-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
  gap: 10px;
}

.folder-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  text-decoration: none;
  transition: color 0.15s ease;
}

.folder-item-title:hover {
  color: var(--primary);
}

.folder-item-actions {
  display: flex;
  gap: 6px;
}

.folder-item-btn {
  flex: 1;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
  text-decoration: none;
}

.folder-item-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #032013;
}

.folder-item-btn.item-play-btn {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--primary);
}

.folder-item-btn.item-play-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #032013;
}

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

.folder-item-btn svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 680px) {
  .folder-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .folder-card {
    padding: 16px 14px;
  }
  .folder-item-thumb {
    aspect-ratio: 16/9;
    width: 100%;
  }
  .folder-item-play {
    width: 52px;
    height: 52px;
  }
  .folder-item-play svg {
    width: 20px;
    height: 20px;
  }
  .folder-item-btn {
    height: 40px;
    font-size: 0.82rem;
  }
  .folder-hint-pill {
    display: none;
  }
}

/* Folder Direct Video Player Modal (Theater Overlay) */
.folder-player-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.folder-player-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.folder-player-dialog {
  position: relative;
  width: 100%;
  max-width: 920px;
  background: #0d0f15;
  border: 1px solid #232736;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  animation: folderModalEnter 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes folderModalEnter {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.folder-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.folder-player-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.folder-player-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.folder-player-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.folder-player-body {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.folder-player-body video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  outline: none;
}

.folder-player-loading {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 5;
}

.folder-player-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.folder-player-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.folder-player-nav,
.folder-player-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.folder-nav-btn {
  min-width: 80px;
  justify-content: center;
}

.folder-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 640px) {
  .folder-player-modal {
    padding: 0;
  }
  .folder-player-dialog {
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
    justify-content: space-between;
  }
  .folder-player-body {
    flex: 1;
    aspect-ratio: auto;
  }
  .folder-player-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px max(14px, env(safe-area-inset-bottom));
  }
  .folder-player-nav,
  .folder-player-actions {
    width: 100%;
  }
  .folder-player-nav button,
  .folder-player-actions a {
    flex: 1;
    height: 42px;
  }
}

/* ==========================================================================
   Navbar Actions, Auth, and Saved Library Styles
   ========================================================================== */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.nav-btn svg {
  width: 15px;
  height: 15px;
}

.nav-badge-count {
  background: var(--primary);
  color: #032013;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  margin-left: 2px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.user-name {
  font-weight: 700;
  color: var(--primary);
}

.logout-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.76rem;
  padding: 2px 4px;
  border-radius: 4px;
}

.logout-btn:hover {
  color: #ef4444;
}

/* Saved Action Button */
.save-action-btn.saved {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #fbbf24;
}

/* Saved Library Section */
.saved-library-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 36px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.25s ease;
}

.library-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  gap: 16px;
}

.library-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.library-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.library-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.library-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.close-icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.close-icon-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.close-icon-btn svg {
  width: 16px;
  height: 16px;
}

/* Saved Accordion */
.saved-links-accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.saved-accordion-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.2s ease;
}

.saved-accordion-item.open {
  border-color: rgba(16, 185, 129, 0.35);
}

.saved-item-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.saved-item-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.saved-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.saved-item-type-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.badge-video {
  background: rgba(16, 185, 129, 0.1);
  color: var(--primary);
}

.badge-folder {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
}

.saved-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-item-meta {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-left: 6px;
  flex-shrink: 0;
}

.saved-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.saved-item-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}

.saved-accordion-item.open .saved-item-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

.saved-item-body {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  display: none;
  animation: fadeIn 0.2s ease;
}

.saved-accordion-item.open .saved-item-body {
  display: block;
}

.saved-item-details-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
}

.saved-item-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.saved-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.saved-item-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

.saved-item-url {
  font-size: 0.78rem;
  color: var(--cyan);
  word-break: break-all;
  font-family: var(--font-mono);
}

.saved-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 6px 12px;
  height: 34px;
  min-height: 34px;
  font-size: 0.8rem;
}

/* Auth Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus {
  border-color: var(--primary);
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrap .form-input {
  width: 100%;
  padding-right: 44px;
}

.password-toggle-btn {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

.password-toggle-btn:hover {
  color: var(--primary);
}

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

.auth-submit-btn {
  width: 100%;
  height: 44px;
  margin-top: 6px;
}

.modal-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.auth-toggle-link {
  background: transparent;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  font-size: inherit;
}

.auth-toggle-link:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .saved-item-details-grid {
    grid-template-columns: 1fr;
  }
  .saved-item-meta {
    display: none;
  }
  .nav-btn-label {
    display: none;
  }
}
