/* ============================================================
   TikGrab HD - Modern TikTok Downloader CSS
   Ultra-clean Dark Theme with TikTok Neon Accents
============================================================ */

:root {
  --bg-primary: #0a0b10;
  --bg-secondary: #12141c;
  --bg-card: rgba(22, 25, 37, 0.85);
  --bg-input: #191c28;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  
  --tt-cyan: #25f4ee;
  --tt-pink: #fe2c55;
  --tt-gradient: linear-gradient(135deg, #25f4ee 0%, #fe2c55 100%);
  --tt-glow: 0 0 25px rgba(254, 44, 85, 0.35);
  --cyan-glow: 0 0 20px rgba(37, 244, 238, 0.35);

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-sub: #6b7280;

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Background Ambient Glows */
.bg-glow-1 {
  position: absolute;
  top: -120px;
  left: 20%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(37, 244, 238, 0.12) 0%, transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

.bg-glow-2 {
  position: absolute;
  top: 100px;
  right: 15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(254, 44, 85, 0.12) 0%, transparent 70%);
  filter: blur(70px);
  pointer-events: none;
  z-index: 0;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

/* Header Section */
header {
  padding: 2.5rem 0 1.5rem;
  text-align: center;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(254, 44, 85, 0.1);
  border: 1px solid rgba(254, 44, 85, 0.25);
  color: #ff5b79;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.main-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.gradient-text {
  background: var(--tt-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: clamp(0.95rem, 1.8vw, 1.15rem);
  max-width: 650px;
  margin: 0 auto 1.5rem;
}

.features-pill-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.feature-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.feature-pill svg {
  color: var(--tt-cyan);
}

/* Master Actions Toolbar */
.master-toolbar {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.toolbar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.toolbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.toolbar-title svg {
  color: var(--tt-cyan);
}

.toolbar-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--tt-gradient);
  color: #fff;
  box-shadow: var(--tt-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 35px rgba(254, 44, 85, 0.55);
}

.btn-secondary {
  background: rgba(37, 244, 238, 0.12);
  color: var(--tt-cyan);
  border: 1px solid rgba(37, 244, 238, 0.3);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(37, 244, 238, 0.2);
  border-color: var(--tt-cyan);
  transform: translateY(-2px);
}

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

.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

.btn-danger-outline {
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger-outline:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.18);
  border-color: #f87171;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Batch Progress Banner */
.batch-progress-box {
  background: linear-gradient(135deg, rgba(37, 244, 238, 0.1) 0%, rgba(254, 44, 85, 0.1) 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  display: none;
}

.batch-progress-box.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.batch-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--tt-gradient);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* 3-Column Grid */
.slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}

@media (max-width: 1024px) {
  .slots-grid {
    grid-template-columns: 1fr;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Video Slot Card */
.slot-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.slot-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.slot-card.has-data {
  border-color: rgba(37, 244, 238, 0.3);
}

.slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.slot-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.slot-number-tag {
  background: var(--tt-gradient);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
}

.slot-status-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-sub);
}

.slot-status-pill.ready {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.slot-status-pill.loading {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.slot-status-pill.error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Input Group */
.input-group {
  position: relative;
  margin-bottom: 1rem;
}

.slot-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 5.5rem 0.85rem 1rem;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.slot-input:focus {
  border-color: var(--tt-cyan);
  box-shadow: 0 0 0 3px rgba(37, 244, 238, 0.15);
}

.slot-input::placeholder {
  color: var(--text-sub);
  font-size: 0.82rem;
}

.input-quick-actions {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 0.3rem;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.07);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

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

.btn-icon.paste-btn:hover {
  background: rgba(37, 244, 238, 0.2);
  color: var(--tt-cyan);
}

.btn-icon.clear-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.slot-action-btn {
  width: 100%;
  margin-bottom: 1rem;
}

/* Video Result Card Inside Slot */
.video-result {
  display: none;
  flex-direction: column;
  background: rgba(18, 20, 28, 0.95);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 0.5rem;
  flex-grow: 1;
}

.video-result.active {
  display: flex;
  animation: slideUp 0.35s ease;
}

.video-thumb-container {
  position: relative;
  width: 100%;
  height: 180px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  margin-bottom: 0.85rem;
}

.video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.video-thumb-container:hover .video-thumb {
  transform: scale(1.05);
}

.thumb-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

.thumb-preview-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
}

.video-thumb-container:hover .thumb-preview-btn {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.author-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  object-fit: cover;
}

.author-info {
  line-height: 1.2;
  overflow: hidden;
}

.author-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.author-user {
  font-size: 0.75rem;
  color: var(--text-sub);
}

.video-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

/* Resolution Dropdown Selector */
.resolution-section {
  margin-bottom: 0.85rem;
}

.resolution-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 0.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.resolution-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(37, 244, 238, 0.3);
  color: var(--tt-cyan);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.resolution-select:focus {
  border-color: var(--tt-cyan);
  box-shadow: 0 0 0 2px rgba(37, 244, 238, 0.2);
}

.resolution-select option {
  background: var(--bg-secondary);
  color: var(--text-main);
  padding: 0.5rem;
}

.slot-download-btn {
  width: 100%;
  margin-top: auto;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

/* Modal Preview */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.25s ease;
}

.modal-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.modal-header {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

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

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-video-player {
  width: 100%;
  max-height: 480px;
  border-radius: var(--radius-sm);
  background: #000;
  outline: none;
}

/* Cloudflare & FAQ Section */
.info-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 3rem;
}

.info-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.info-title svg {
  color: #f6821f; /* Cloudflare orange */
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.info-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.info-card h4 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-card p, .info-card ol, .info-card ul {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.info-card ol {
  padding-left: 1.2rem;
}

.info-card code {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--tt-cyan);
  font-family: monospace;
  font-size: 0.8rem;
}

/* Footer */
footer {
  margin-top: auto;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-sub);
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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