/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f11;
  --bg2: #18181c;
  --bg3: #222228;
  --border: #2e2e36;
  --text: #f0f0f4;
  --text2: #9898a8;
  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
  --transition: .18s ease;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =============================================
   HEADER
   ============================================= */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.logo-icon { font-size: 28px; }
.logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.5px;
}

.tagline {
  font-size: 13px;
  color: var(--text2);
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text2); }

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

/* =============================================
   HERO
   ============================================= */
.hero {
  padding: 56px 0 40px;
  text-align: center;
}

h1 {
  font-size: clamp(26px, 5vw, 42px);
  font-weight: 800;
  letter-spacing: -.8px;
  line-height: 1.2;
  margin-bottom: 16px;
}

.accent { color: var(--accent); }

.hero-sub {
  font-size: clamp(15px, 2.5vw, 18px);
  color: var(--text2);
  max-width: 600px;
  margin: 0 auto 36px;
}

/* =============================================
   DROP ZONE
   ============================================= */
.drop-zone {
  background: var(--bg2);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 52px 24px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(108, 99, 255, .06);
}

.drop-icon { font-size: 48px; line-height: 1; }

.drop-primary {
  font-size: 18px;
  font-weight: 600;
}

.drop-secondary {
  font-size: 14px;
  color: var(--text2);
}

.drop-hint {
  font-size: 13px;
  color: var(--text2);
  margin-top: 4px;
}

#fileInput {
  display: none;
}

/* =============================================
   CONTROLS
   ============================================= */
.controls {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.quality-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 220px;
}

.quality-label {
  font-size: 15px;
  color: var(--text2);
  white-space: nowrap;
  min-width: 120px;
}

.quality-label strong {
  color: var(--text);
}

#qualitySlider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

#qualitySlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--bg2);
  box-shadow: 0 0 0 2px var(--accent);
}

#qualitySlider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--bg2);
  box-shadow: 0 0 0 2px var(--accent);
}

.controls-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* =============================================
   RESULTS
   ============================================= */
.results-section {
  padding-bottom: 64px;
}

/* Summary bar */
.summary-bar {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 28px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text2);
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.stat-value.accent { color: var(--accent); }
.stat-value.green { color: var(--green); }

.summary-arrow {
  font-size: 20px;
  color: var(--text2);
}

/* Cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* Image card */
.img-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.img-card__preview {
  position: relative;
  background: var(--bg3);
  aspect-ratio: 16/10;
  overflow: hidden;
}

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

.img-card__preview .preview-label {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  background: rgba(0,0,0,.6);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

.img-card__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.img-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.img-card__sizes {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.size-original {
  color: var(--text2);
  text-decoration: line-through;
}

.size-arrow { color: var(--text2); font-size: 12px; }

.size-compressed { color: var(--accent); font-weight: 600; }

.size-badge {
  margin-left: auto;
  background: rgba(34, 197, 94, .15);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.img-card__actions {
  display: flex;
  gap: 8px;
}

.img-card__actions .btn {
  flex: 1;
  justify-content: center;
  padding: 8px 12px;
  font-size: 13px;
}

/* Progress / spinner states */
.img-card.is-loading .img-card__preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(15,15,17,.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* Before/After toggle */
.preview-tabs {
  display: flex;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

.preview-tab {
  flex: 1;
  padding: 6px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  color: var(--text2);
  border: none;
  background: transparent;
  text-transform: uppercase;
  letter-spacing: .5px;
  transition: color var(--transition), background var(--transition);
}

.preview-tab.active {
  color: var(--accent);
  background: rgba(108, 99, 255, .1);
}

/* =============================================
   HOW IT WORKS
   ============================================= */
.how-section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.how-section h2,
.features-section h2,
.faq-section h2 {
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 700;
  margin-bottom: 36px;
  text-align: center;
}

.steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 620px;
  margin: 0 auto;
}

.steps li {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.step-num {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.steps li strong { display: block; margin-bottom: 4px; }
.steps li p { font-size: 14px; color: var(--text2); }

/* =============================================
   FEATURES
   ============================================= */
.features-section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

.features-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

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

.feature-icon { font-size: 28px; display: block; margin-bottom: 12px; }
.feature-card h3 { font-size: 16px; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text2); line-height: 1.5; }

/* =============================================
   FAQ
   ============================================= */
.faq-section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.faq-list {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
}

.faq-item dt {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 8px;
  cursor: default;
}

.faq-item dd {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
}

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
}

.site-footer p {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--text2);
  font-size: 14px;
}

.footer-links a:hover { color: var(--text); }

/* =============================================
   UTILITIES
   ============================================= */
[hidden] { display: none !important; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 600px) {
  .site-header .container { justify-content: center; text-align: center; }
  .tagline { display: none; }
  .drop-zone { padding: 36px 16px; }
  .controls { flex-direction: column; align-items: stretch; }
  .quality-row { min-width: unset; }
  .controls-actions { justify-content: center; }
  .summary-bar { justify-content: center; text-align: center; }
  .summary-arrow { display: none; }
  .cards-grid { grid-template-columns: 1fr; }
}
