
:root {
  --bg-gradient: radial-gradient(circle at top left, #1e1b4b, #0f172a, #020617);
  --panel-bg: rgba(15, 23, 42, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --card-glow: 0 0 20px rgba(59, 130, 246, 0.15);
}

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

body {
  font-family: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.card {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-color), transparent);
}

.textarea-container {
  position: relative;
  flex: 1;
  min-height: 250px;
  display: flex;
}

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

textarea {
  min-height: 250px;
  resize: vertical;
}

textarea:focus, input:focus, select:focus {
  border-color: var(--accent-color);
  box-shadow: var(--card-glow);
}

.pre-container {
  flex: 1;
  min-height: 250px;
  max-height: 450px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
}

pre {
  margin: 0;
}

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  color: #93c5fd;
  white-space: pre-wrap;
  word-break: break-all;
}

.btn-bar {
  display: flex;
  gap: 1rem;
  margin-top: auto;
}

.btn-primary {
  background: var(--accent-color);
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.seo-section {
  color: var(--text-secondary);
  line-height: 1.7;
}

.seo-section h2 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.seo-section p {
  margin-bottom: 1rem;
}

footer {
  border-top: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  padding: 3rem 2rem 1.5rem 2rem;
  margin-top: auto;
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  margin-bottom: 3rem;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-col h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 0.75rem;
}

.footer-col ul li a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.footer-col ul li a:hover {
  color: var(--accent-color);
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-bottom p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tool-ui { text-align: left; }
.drop-zone { border: 2px dashed var(--accent-color); border-radius: 12px; padding: 3rem; text-align: center; cursor: pointer; transition: all 0.3s; background: rgba(59, 130, 246, 0.05); }
.drop-zone:hover, .drop-zone.dragover { background: rgba(59, 130, 246, 0.15); border-color: #60a5fa; }
.drop-icon { font-size: 3rem; margin-bottom: 1rem; }
.progress-panel { margin-top: 2rem; text-align: center; }
.progress-bar-bg { flex: 1; height: 14px; background: rgba(255,255,255,0.1); border-radius: 99px; overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #3b82f6, #8b5cf6); transition: width 0.3s ease; border-radius: 99px; }

/* Progress bar row with percentage badge */
.progress-bar-wrap { display: flex; align-items: center; gap: 0.85rem; margin-top: 0.5rem; }
.progress-pct { font-size: 1rem; font-weight: 700; color: var(--text-primary); min-width: 3.5rem; text-align: right; letter-spacing: 0.02em; }

/* ETA / meta line */
.progress-meta { margin-top: 0.75rem; font-size: 0.88rem; color: var(--text-muted); letter-spacing: 0.01em; }

/* File counter pill */
.progress-file-counter { display: inline-block; background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.3); border-radius: 99px; padding: 0.2rem 0.85rem; font-size: 0.82rem; color: #93c5fd; margin-bottom: 0.25rem; min-height: 1.5rem; }

.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--text-secondary); font-size: 0.9rem; }

/* Fix select dropdown */
select {
  background: #1e293b !important;
  color: var(--text-primary) !important;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 1rem center !important;
  padding-right: 2.5rem !important;
}
select option {
  background: #1e293b;
  color: var(--text-primary);
}

/* Queue */
.queue-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; flex-wrap: wrap; gap: 0.5rem; }
.queue-count { font-weight: 600; color: var(--text-secondary); font-size: 0.95rem; }
.queue-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 220px; overflow-y: auto; margin-bottom: 0.5rem; }
.queue-item { display: flex; align-items: center; gap: 0.75rem; background: rgba(59,130,246,0.07); border: 1px solid rgba(59,130,246,0.2); border-radius: 8px; padding: 0.6rem 0.9rem; }
.queue-icon { font-size: 1.1rem; flex-shrink: 0; }
.queue-name { flex: 1; font-size: 0.9rem; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.queue-remove { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.9rem; padding: 0 0.25rem; transition: color 0.2s; flex-shrink: 0; }
.queue-remove:hover { color: #ef4444; }
.btn-sm { font-size: 0.85rem !important; padding: 0.4rem 0.9rem !important; }

/* Results — desktop: single row */
.results-list { display: flex; flex-direction: column; gap: 0.65rem; margin-bottom: 1.25rem; }

.result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(34,197,94,0.07);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  flex-wrap: wrap;
}
.result-item.result-error { background: rgba(239,68,68,0.07); border-color: rgba(239,68,68,0.25); }

.result-icon  { font-size: 1.1rem; flex-shrink: 0; }
.result-name  { flex: 1; font-size: 0.9rem; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.result-meta  { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; flex-wrap: wrap; }
.result-size  { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.result-badge { font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 99px; white-space: nowrap; }
.error-badge    { background: rgba(239,68,68,0.2);  color: #f87171; }
.reduction-good { background: rgba(34,197,94,0.15); color: #4ade80; }
.reduction-bad  { background: rgba(239,68,68,0.15); color: #f87171; }

.btn-download-single {
  background: rgba(59,130,246,0.15);
  border: 1px solid rgba(59,130,246,0.35);
  color: #93c5fd;
  border-radius: 6px;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-download-single:hover { background: rgba(59,130,246,0.3); color: #fff; }

/* Results action buttons */
.results-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}
.results-actions .btn-primary,
.results-actions .btn-secondary {
  flex: 1;
  min-width: 180px;
  justify-content: center;
  text-align: center;
}

/* ── Mobile overrides ─────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  /* Result card becomes two rows */
  .result-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* Top row: icon + name */
  .result-icon { align-self: flex-start; }
  .result-name { white-space: normal; word-break: break-word; width: 100%; }

  /* Bottom row: size badge + download button side by side, full width */
  .result-meta {
    width: 100%;
    justify-content: space-between;
  }
  .btn-download-single {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
  }

  /* Queue header stacks on very small screens */
  .queue-header { flex-direction: column; align-items: flex-start; }

  /* Action buttons stack full-width */
  .results-actions { flex-direction: column; }
  .results-actions .btn-primary,
  .results-actions .btn-secondary { min-width: unset; width: 100%; }
}
