/* ============================================================
   Uniqualizer — Apple-inspired Minimal Dark UI
   ============================================================ */

:root {
  --white: #ffffff;
  --black: #000000;
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #1a1a1a;
  --border: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.2);
  --text-primary: #f5f5f7;
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-tertiary: rgba(255, 255, 255, 0.35);
  --accent: #ffffff;
  --success: #30d158;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition: 200ms var(--ease);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: rgba(255, 255, 255, 0.15);
}

/* ---- Navigation ---- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 40px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.nav-logo {
  width: 32px;
  height: 32px;
  background: var(--white);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--black);
}

.nav-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

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

.nav-socials {
  display: flex;
  align-items: center;
  gap: 4px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  transition: all var(--transition);
}

.social-link svg {
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity var(--transition);
}

.social-link:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-color: var(--border-active);
}

.social-link:hover svg {
  opacity: 1;
}

.nav-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.nav-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

/* ---- Container ---- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 40px 80px;
}

/* ---- Hero ---- */
.hero {
  padding: 72px 0 56px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(36px, 7vw, 56px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  color: var(--text-primary);
}

.hero h1 em {
  font-style: italic;
  background: linear-gradient(135deg, #ffffff 0%, rgba(255,255,255,0.5) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding: 0 4px 4px 0;
  display: inline-block;
}

.hero-sub {
  margin-top: 16px;
  font-size: 17px;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  font-weight: 400;
}

/* ---- Section ---- */
.section {
  margin-bottom: 32px;
}

.section-heading {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

/* ---- Upload Area ---- */
.upload-area {
  border: 1.5px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: rgba(255, 255, 255, 0.3);
  background: var(--bg-secondary);
}

.upload-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
}

.upload-area:hover .upload-icon {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.upload-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.upload-hint {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.upload-formats {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  padding: 4px 12px;
  border-radius: 20px;
}

/* ---- File Preview ---- */
.file-preview {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.preview-video-wrap {
  width: 100%;
  aspect-ratio: 9/10;
  max-height: 360px;
  background: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-info {
  padding: 20px;
}

.preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.preview-top h3 {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 40px);
}

.btn-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-remove:hover {
  background: rgba(255, 59, 48, 0.2);
  color: #ff453a;
}

.meta-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.meta-item {
  background: var(--bg-tertiary);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
}

.meta-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-value {
  font-size: 14px;
  font-weight: 600;
}

.hash-block {
  background: var(--bg-tertiary);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
}

.hash-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.hash-value {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-all;
  line-height: 1.6;
}

/* ---- Presets ---- */
.presets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.preset {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.preset input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.preset:hover {
  background: var(--bg-secondary);
  border-color: var(--border-active);
}

.preset.active {
  background: var(--bg-secondary);
  border-color: rgba(255, 255, 255, 0.25);
}

.preset-inner {
  flex: 1;
  min-width: 0;
}

.preset-name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.preset-desc {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.preset-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: transparent;
  transition: all var(--transition);
}

.preset.active .preset-check {
  background: var(--white);
  border-color: var(--white);
  color: var(--black);
}

/* ---- Custom Panel ---- */
.custom-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

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

.control-header label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.control-val {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
}

/* Range Slider — Apple style */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  border: none;
  cursor: pointer;
}

/* Toggles */
.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--bg-tertiary);
  transition: all var(--transition);
}

.toggle:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--white);
  cursor: pointer;
}

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

.device-select label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.device-select select {
  flex: 1;
  max-width: 240px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}

.device-select select:focus {
  border-color: var(--border-active);
}

/* ---- Variants ---- */
.variants-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.variants-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.variants-pills {
  display: flex;
  gap: 6px;
}

.pill {
  width: 40px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  display: grid;
  place-items: center;
}

.pill:hover {
  border-color: var(--border-active);
  color: var(--text-primary);
}

.pill.active {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
}

/* ---- Start Button ---- */
.btn-start {
  width: 100%;
  height: 52px;
  border-radius: var(--radius);
  border: none;
  background: var(--white);
  color: var(--black);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-start:hover:not(:disabled) {
  opacity: 0.88;
  transform: scale(0.99);
}

.btn-start:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-start:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* ---- Progress ---- */
.progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.progress-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.progress-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.progress-pct {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.progress-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 24px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--white);
  border-radius: 2px;
  transition: width 300ms var(--ease);
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pipe-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.pipe-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
  transition: all var(--transition);
}

.pipe-step.active {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.pipe-step.active .pipe-dot {
  background: var(--white);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.pipe-step.completed {
  color: var(--success);
}

.pipe-step.completed .pipe-dot {
  background: var(--success);
}

/* ---- Results ---- */
.results-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.results-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(48, 209, 88, 0.12);
  color: var(--success);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.results-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.results-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

/* Result Item */
.result-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.result-video-box {
  width: 100%;
  aspect-ratio: 16/10;
  max-height: 280px;
  background: #000;
  overflow: hidden;
}

.result-video-box video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-body {
  padding: 18px 20px;
}

.result-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.result-variant-tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--white);
  color: var(--black);
  padding: 3px 10px;
  border-radius: 6px;
}

.result-filename {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mod-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.mod-pill {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 4px 10px;
  border-radius: 6px;
}

.result-hashes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.result-hash {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-tertiary);
}

.result-hash.old { color: rgba(255, 255, 255, 0.35); }
.result-hash.new { color: var(--success); }

.result-hash strong {
  font-weight: 600;
  min-width: 40px;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--white);
  color: var(--black);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-download:hover {
  opacity: 0.88;
}

/* Results Actions */
.results-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.btn-zip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  text-decoration: none;
  transition: all var(--transition);
}

.btn-zip:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-active);
}

.btn-reset {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  padding: 8px 0;
  transition: color var(--transition);
}

.btn-reset:hover {
  color: var(--text-primary);
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
}

/* ---- Utility ---- */
.hidden {
  display: none !important;
}

/* ---- Desktop enhancements ---- */
@media (min-width: 768px) {
  .result-card {
    display: grid;
    grid-template-columns: 280px 1fr;
  }

  .result-video-box {
    aspect-ratio: auto;
    max-height: none;
    height: 100%;
  }

  .results-list {
    gap: 16px;
  }

  .file-preview {
    display: grid;
    grid-template-columns: 240px 1fr;
  }

  .preview-video-wrap {
    aspect-ratio: auto;
    max-height: none;
    height: 100%;
  }
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .nav-inner {
    padding: 0 16px;
  }

  .nav-right {
    gap: 8px;
  }

  .social-label {
    display: none;
  }

  .social-link {
    padding: 6px;
    width: 32px;
    height: 32px;
    justify-content: center;
  }

  .container {
    padding: 0 16px 60px;
  }

  .hero {
    padding: 48px 0 36px;
  }

  .hero-sub {
    font-size: 15px;
  }

  .upload-area {
    padding: 40px 16px;
  }

  .meta-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .presets {
    grid-template-columns: 1fr;
  }

  .pipeline {
    grid-template-columns: repeat(2, 1fr);
  }

  .controls-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .variants-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .progress-pct {
    font-size: 22px;
  }
}

@media (max-width: 380px) {
  .hero h1 {
    font-size: 30px;
  }

  .meta-row {
    grid-template-columns: 1fr 1fr;
  }

  .pipeline {
    grid-template-columns: 1fr 1fr;
  }

  .pill {
    width: 36px;
    height: 32px;
    font-size: 13px;
  }

  .nav-status-text {
    display: none;
  }

  .nav-sep {
    display: none;
  }
}
