/* TikTok Pro Web Downloader - Design System 2026 */
:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: rgba(18, 25, 43, 0.75);
  --bg-card-hover: rgba(26, 36, 61, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.65);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.18);
  --border-glow: rgba(37, 244, 238, 0.35);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --brand-tiktok: #fe2c55;
  --brand-tiktok-glow: rgba(254, 44, 85, 0.35);
  --brand-cyan: #25f4ee;
  --brand-cyan-glow: rgba(37, 244, 238, 0.3);
  --brand-gradient: linear-gradient(135deg, #fe2c55 0%, #ff0050 50%, #25f4ee 100%);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --shadow-glow: 0 0 25px rgba(254, 44, 85, 0.25);
  --shadow-cyan-glow: 0 0 25px rgba(37, 244, 238, 0.25);

  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.aurora-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.aurora-blob {
  position: absolute;
  filter: blur(120px);
  border-radius: 50%;
  opacity: 0.22;
  animation: floatSlow 20s infinite alternate ease-in-out;
}

.aurora-1 {
  top: -10%;
  left: 15%;
  width: 50vw;
  height: 50vh;
  background: radial-gradient(circle, #fe2c55 0%, transparent 70%);
}

.aurora-2 {
  top: 20%;
  right: -10%;
  width: 55vw;
  height: 55vh;
  background: radial-gradient(circle, #25f4ee 0%, transparent 70%);
  animation-duration: 25s;
  animation-delay: -5s;
}

@keyframes floatSlow {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.08); }
  100% { transform: translate(-20px, 30px) scale(0.95); }
}

.app-container {
  position: relative;
  z-index: 1;
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 35px;
  box-shadow: var(--shadow-card);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #182238, #0e1422);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.logo-icon svg {
  width: 22px;
  height: 22px;
}

.brand-name {
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-name .highlight {
  background: linear-gradient(90deg, #fe2c55, #25f4ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(37, 244, 238, 0.12);
  color: var(--brand-cyan);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(37, 244, 238, 0.25);
}

.hero-section {
  text-align: center;
  margin-bottom: 30px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(254, 44, 85, 0.1);
  border: 1px solid rgba(254, 44, 85, 0.25);
  color: #ff5b79;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.hero-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.hero-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto;
}

/* Tabs */
.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  max-width: 480px;
  margin: 0 auto 26px;
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.mode-tab:hover {
  color: var(--text-primary);
}

.mode-tab.active {
  background: linear-gradient(135deg, #1e293b, #111827);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Input Card */
.input-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  margin-bottom: 30px;
  transition: var(--transition-normal);
}

.input-card:focus-within {
  border-color: rgba(37, 244, 238, 0.4);
  box-shadow: 0 10px 35px -5px rgba(0, 0, 0, 0.6), var(--shadow-cyan-glow);
}

.single-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(11, 17, 30, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.input-icon-left {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.main-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  min-width: 0;
}

.main-input::placeholder {
  color: var(--text-muted);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-gradient);
  border: none;
  color: #fff;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--brand-tiktok-glow);
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(254, 44, 85, 0.45);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Batch Area */
.batch-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.batch-textarea {
  width: 100%;
  min-height: 140px;
  background: rgba(11, 17, 30, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  color: var(--text-primary);
  font-family: Consolas, monospace;
  font-size: 0.92rem;
  outline: none;
  resize: vertical;
}

.batch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.batch-stats {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.batch-stats strong {
  color: var(--brand-cyan);
}

.supported-hints {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.supported-hints span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.supported-hints svg {
  width: 14px;
  height: 14px;
  color: var(--brand-cyan);
}

/* Loading Card */
.loading-card {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  margin-bottom: 25px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(254, 44, 85, 0.15);
  border-top-color: var(--brand-tiktok);
  border-right-color: var(--brand-cyan);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.loading-subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Result Section */
.result-section {
  display: none;
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.post-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.author-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.author-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--brand-tiktok);
}

.author-meta {
  display: flex;
  flex-direction: column;
}

.author-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.author-username {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.post-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 4px;
  width: fit-content;
}

.post-type-badge.photo-badge {
  background: rgba(37, 244, 238, 0.12);
  color: var(--brand-cyan);
  border: 1px solid rgba(37, 244, 238, 0.3);
}

.post-type-badge.video-badge {
  background: rgba(254, 44, 85, 0.12);
  color: #ff5b79;
  border: 1px solid rgba(254, 44, 85, 0.3);
}

.post-stats-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(11, 17, 30, 0.6);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-md);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.stat-item strong {
  color: var(--text-primary);
}

.post-caption {
  width: 100%;
  font-size: 0.92rem;
  color: var(--text-secondary);
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Video Grid */
.video-container-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  margin-bottom: 30px;
}

@media (max-width: 800px) {
  .video-container-grid {
    grid-template-columns: 1fr;
  }
}

.video-preview-wrapper {
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
}

.video-preview-wrapper video {
  width: 100%;
  height: 100%;
  max-height: 480px;
  object-fit: contain;
}

.video-options-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quality-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: var(--transition-fast);
}

.quality-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
  transform: translateY(-2px);
}

.quality-card.featured {
  background: linear-gradient(135deg, rgba(254, 44, 85, 0.12), rgba(18, 25, 43, 0.8));
  border-color: rgba(254, 44, 85, 0.4);
}

.quality-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quality-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quality-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.quality-tag.best {
  background: rgba(254, 44, 85, 0.2);
  color: #ff5b79;
}

.quality-tag.hd {
  background: rgba(37, 244, 238, 0.2);
  color: var(--brand-cyan);
}

.quality-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Album Grid */
.album-controls-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  box-shadow: var(--shadow-card);
}

.album-stats-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.album-actions-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.photo-bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.photo-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  aspect-ratio: 3 / 4;
  transition: var(--transition-fast);
}

.photo-card:hover {
  border-color: var(--brand-cyan);
  transform: translateY(-4px);
  box-shadow: 0 12px 25px -5px rgba(0, 0, 0, 0.6), var(--shadow-cyan-glow);
}

.photo-card.selected {
  border-color: var(--brand-tiktok);
  box-shadow: 0 0 0 2px var(--brand-tiktok);
}

.photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0%, transparent 40%, rgba(0, 0, 0, 0.85) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  opacity: 0;
  transition: var(--transition-fast);
}

.photo-card:hover .photo-card-overlay,
.photo-card.selected .photo-card-overlay {
  opacity: 1;
}

.photo-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.photo-index-pill {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.photo-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--brand-tiktok);
  cursor: pointer;
}

.photo-card-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-card-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-card-action:hover {
  background: var(--brand-gradient);
  border-color: transparent;
}

/* Batch Results */
.batch-results-section {
  display: none;
  margin-top: 25px;
}

.batch-progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.progress-title {
  font-size: 1rem;
  font-weight: 700;
}

.progress-percentage {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brand-cyan);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--brand-gradient);
  transition: width 0.3s ease;
}

.batch-action-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.batch-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.batch-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  gap: 12px;
}

.batch-item-thumb {
  width: 70px;
  height: 90px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #000;
}

.batch-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.batch-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.batch-item-author {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Lightbox */
.lightbox-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(15px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(18, 25, 43, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideInToast 0.3s ease forwards;
  min-width: 260px;
  max-width: 400px;
  font-size: 0.9rem;
}

.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error { border-left: 4px solid var(--danger); }
.toast.toast-info { border-left: 4px solid var(--brand-cyan); }

@keyframes slideInToast {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 768px) {
  .app-container { padding: 16px 12px 60px; }
  .single-input-bar { flex-wrap: wrap; }
  .main-input { width: 100%; }
  .input-actions { width: 100%; justify-content: space-between; }
  .btn-primary { flex: 1; justify-content: center; }
  .post-header-card { flex-direction: column; align-items: flex-start; }
  .post-stats-row { width: 100%; justify-content: space-between; }
  .photo-bento-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
