/* ============================================================
   Pixlit – style.css
   Sections:
   1.  Tokens
   2.  Reset & Base
   3.  Background Orbs
   4.  Header
   5.  Main Layout
   6.  Hero
   7.  Drop zone
   8.  Settings bar
   9.  Format grid pills
   10. Quality slider
   11. Resize inputs
   12. Aspect ratio lock
   13. Action buttons
   14. File list & file cards
   15. Preview images
   16. Progress & status badges
   17. Ad slots
   18. Toast
   19. Animations & Keyframes
   20. Responsive
   ============================================================ */


/* ── 1. Tokens ── */
:root {
  --red:        #e34949;
  --red-dim:    #c93c3c;
  --red-glow:   rgba(227,73,73,0.25);

  --bg:           #f5f5f7;
  --surface:      #ffffff;
  --surface-2:    #fafafa;
  --border:       rgba(0,0,0,0.08);
  --text:         #1d1d1f;
  --text-2:       #6e6e73;
  --text-3:       #aeaeb2;
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.06);
  --shadow-md:    0 8px 32px rgba(0,0,0,0.10);
  --shadow-lg:    0 24px 64px rgba(0,0,0,0.12);
  --glass:        rgba(255,255,255,0.72);
  --glass-border: rgba(255,255,255,0.5);

  --success: #34c759;
  --warning: #f0a500;
}

[data-theme="dark"] {
  --bg:           #000000;
  --surface:      #1c1c1e;
  --surface-2:    #2c2c2e;
  --border:       rgba(255,255,255,0.08);
  --text:         #f5f5f7;
  --text-2:       #aeaeb2;
  --text-3:       #636366;
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:    0 8px 32px rgba(0,0,0,0.5);
  --shadow-lg:    0 24px 64px rgba(0,0,0,0.6);
  --glass:        rgba(28,28,30,0.8);
  --glass-border: rgba(255,255,255,0.08);
}


/* ── 2. Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.35s ease, color 0.35s ease;
}


/* ── 3. Background Orbs ── */
.bg-orbs {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0; overflow: hidden;
}

.orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.18;
  animation: orb-drift 18s ease-in-out infinite alternate;
}

.orb-1 { width: 500px; height: 500px; background: var(--red); top: -120px; right: -100px; }
.orb-2 { width: 350px; height: 350px; background: #1d1d1f; bottom: 100px; left: -80px; animation-delay: -6s; }
[data-theme="dark"] .orb-2 { background: #555; }


/* ── 4. Header ── */
header {
  position: sticky; top: 0; z-index: 100;
  height: 60px; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: var(--glass);
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.35s ease, border-color 0.35s ease;
}

.logo-wrap {
  display: flex; align-items: center; gap: 10px;
  animation: fade-down 0.5s ease both;
}

.logo-icon {
  /* width: 34px; height: 34px; */
  /* background: var(--red); border-radius: 9px; */
  border-radius:100px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px var(--red-glow);
  overflow: hidden; transition: transform 0.2s ease;
  cursor: pointer; flex-shrink: 0;
}

.logo-icon:hover { transform: rotate(-6deg) scale(1.08); }
.logo-icon img { width:auto; height:44px;object-fit:contain;display: block; border-radius:100px}

.logo-name { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; color: var(--text); }
.logo-name span { color: var(--red); }

.theme-toggle {
  position: relative; width: 44px; height: 26px;
  border-radius: 13px; background: var(--surface-2);
  border: 1.5px solid var(--border); cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease;
  animation: fade-down 0.5s 0.1s ease both;
}

.theme-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), background 0.3s ease;
}

[data-theme="dark"] .theme-toggle::after { transform: translateX(18px); background: var(--red); }

.toggle-icons {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 5px; pointer-events: none;
  font-size: 9px; color: var(--text-3);
}


/* ── 5. Main Layout ── */
main {
  position: relative; z-index: 1;
  max-width: 900px; margin: 0 auto;
  padding: 44px 24px 32px;
}


/* ── 6. Hero ── */
.hero {
  text-align: center; margin-bottom: 32px;
  animation: fade-up 0.6s ease both;
}

.hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 3.2rem);
  font-weight: 700; letter-spacing: -0.04em; line-height: 1.1;
}

.hero h1 em { font-style: normal; color: var(--red); }

.hero p {
  margin-top: 10px; font-size: 0.88rem;
  color: var(--text-2); letter-spacing: 0.01em;
}


/* ── 7. Drop zone ── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 20px;
  background: var(--surface);
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  margin-bottom: 16px;
  animation: fade-up 0.6s 0.08s ease both;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--red);
  background: var(--surface-2);
  box-shadow: 0 0 0 5px var(--red-glow);
}

.dropzone.drag-over { transform: scale(1.01); }

.drop-icon {
  font-size: 2.8rem;
  color: var(--red);
  margin-bottom: 14px;
  display: block;
  animation: bounce-soft 2s ease infinite;
}

.drop-title {
  font-size: 1.1rem; font-weight: 600;
  color: var(--text); margin-bottom: 6px;
}

.drop-sub {
  font-size: 0.88rem; color: var(--text-2);
  margin-bottom: 10px;
}

.btn-link {
  background: none; border: none;
  color: var(--red); font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem; font-weight: 600;
  cursor: pointer; text-decoration: underline;
  text-decoration-color: var(--red-glow);
  transition: opacity 0.2s ease;
}

.btn-link:hover { opacity: 0.75; }

.drop-formats {
  font-size: 0.72rem; color: var(--text-3);
  letter-spacing: 0.02em;
}


/* ── 8. Settings bar ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.2s ease;
}

.settings-bar {
  padding: 22px 24px;
  margin-bottom: 16px;
  display: flex; flex-wrap: wrap; gap: 20px;
  align-items: flex-start;
  animation: fade-up 0.4s ease both;
}

.setting-section {
  display: flex; flex-direction: column; gap: 8px;
  min-width: 140px;
}

.setting-section.setting-actions {
  flex-direction: row; align-items: center;
  gap: 8px; flex-wrap: wrap;
  margin-left: auto;
}

.setting-label {
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
}

.setting-label span { color: var(--text-2); font-weight: 500; text-transform: none; letter-spacing: 0; }

.setting-hint {
  font-size: 0.7rem; color: var(--text-3);
}

.settings-divider {
  width: 1px; background: var(--border);
  align-self: stretch; flex-shrink: 0;
}

@media (max-width: 700px) {
  .settings-divider { width: 100%; height: 1px; }
  .setting-section.setting-actions { margin-left: 0; width: 100%; }
}


/* ── 9. Format grid pills ── */
.format-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
}

.format-pill {
  padding: 6px 13px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: 'DM Mono', monospace;
  font-size: 0.76rem; font-weight: 500;
  cursor: pointer; user-select: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.format-pill:hover { transform: translateY(-1px); border-color: var(--red); color: var(--red); }

.format-pill.active {
  background: var(--red); border-color: transparent;
  color: #fff; box-shadow: 0 2px 10px var(--red-glow);
}


/* ── 10. Quality slider ── */
input[type="range"] {
  -webkit-appearance: none; width: 100%;
  height: 4px; border-radius: 2px;
  background: var(--border); outline: none; cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--red);
  box-shadow: 0 2px 8px var(--red-glow);
  transition: transform 0.15s ease;
}

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


/* ── 11. Resize inputs ── */
.resize-row {
  display: flex; align-items: center; gap: 8px;
}

.resize-input-wrap {
  display: flex; align-items: center; gap: 5px;
}

.resize-label {
  font-size: 0.7rem; font-weight: 700;
  color: var(--text-3); letter-spacing: 0.05em;
}

.resize-input {
  width: 76px; padding: 7px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem; color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -moz-appearance: textfield;
}

.resize-input::-webkit-inner-spin-button,
.resize-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.resize-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.resize-x {
  color: var(--text-3); font-size: 0.9rem; font-weight: 500;
}


/* ── 12. Aspect ratio lock ── */
.lock-label {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-3);
  font-size: 0.8rem;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.lock-label:hover { border-color: var(--red); color: var(--red); }

.lock-label.locked {
  border-color: var(--red); color: var(--red);
  background: rgba(227,73,73,0.07);
}


/* ── 13. Action Buttons ── */
.btn-action {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 11px;
  border: 1.5px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, color 0.2s ease;
}

.btn-action:hover { border-color: var(--red); color: var(--red); transform: translateY(-1px); }
.btn-action:active { transform: translateY(0); }

.btn-action.primary {
  background: var(--red); color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px var(--red-glow);
}

.btn-action.primary:hover { background: var(--red-dim); color: #fff; }

.btn-action.primary i { transition: transform 0.4s ease; }
.btn-action.primary:hover i { transform: rotate(180deg); }

.btn-action.danger {
  color: var(--red); border-color: rgba(227,73,73,0.2);
}

.btn-action.danger:hover {
  background: rgba(227,73,73,0.08);
  border-color: var(--red); color: var(--red);
}


/* ── 14. File list & file cards ── */
.file-list {
  display: flex; flex-direction: column; gap: 12px;
}

.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
  animation: card-in 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.file-card:hover { box-shadow: var(--shadow-md); }

.file-card.done   { border-color: var(--success); }
.file-card.error  { border-color: var(--red); }


/* ── 15. Preview images ── */
.preview-wrap {
  position: relative; flex-shrink: 0;
  display: flex; gap: 6px; align-items: center;
}

.preview-img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.preview-arrow {
  color: var(--text-3); font-size: 0.8rem;
}

.preview-out {
  width: 64px; height: 64px;
  border-radius: 10px;
  border: 1.5px dashed var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 0.65rem; font-weight: 500;
  text-align: center; overflow: hidden;
  transition: border-color 0.2s ease;
}

.preview-out img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 8px;
}

/* File info */
.file-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
}

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

.file-meta {
  font-size: 0.72rem; color: var(--text-3);
  font-family: 'DM Mono', monospace;
}

/* File actions */
.file-actions {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}

.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1.5px solid var(--border);
  background: var(--surface-2); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.icon-btn:hover { border-color: var(--red); color: var(--red); transform: scale(1.05); }

.icon-btn.download-btn:hover { background: var(--red); color: #fff; border-color: transparent; }


/* ── 16. Progress & status badges ── */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.7rem; font-weight: 600;
  padding: 3px 9px; border-radius: 20px;
  letter-spacing: 0.03em; white-space: nowrap;
}

.badge-idle    { background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); }
.badge-loading { background: rgba(240,165,0,0.12); color: var(--warning); border: 1px solid rgba(240,165,0,0.3); }
.badge-done    { background: rgba(52,199,89,0.12); color: var(--success); border: 1px solid rgba(52,199,89,0.3); }
.badge-error   { background: var(--red-glow); color: var(--red); border: 1px solid rgba(227,73,73,0.3); }

/* Spinning loader icon */
.spin { animation: spin 0.8s linear infinite; }

/* Progress bar under file card */
.progress-bar-wrap {
  height: 3px; background: var(--border);
  border-radius: 2px; overflow: hidden;
  margin-top: 6px;
}

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


/* ── 17. Ad Slots ── */
.ads-row {
  margin-top: 28px; display: flex; gap: 16px;
  animation: fade-up 0.6s 0.2s ease both;
}

.ad-slot {
  flex: 1; height: 90px; border-radius: 14px;
  border: 1.5px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 0.75rem;
  letter-spacing: 0.05em; text-transform: uppercase;
  font-weight: 500; background: var(--surface);
}


/* ── 18. Toast ── */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text); color: var(--bg);
  padding: 12px 22px; border-radius: 30px;
  font-size: 0.85rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; z-index: 999;
  white-space: nowrap; pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.35s ease;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }


/* ── 19. Animations & Keyframes ── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes fade-down {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0);     }
}

@keyframes orb-drift {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(30px,40px) scale(1.1); }
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bounce-soft {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}


/* ── 20. Responsive ── */
@media (max-width: 600px) {
  header { padding: 0 16px; }
  main   { padding: 28px 14px 24px; }
  .dropzone { padding: 36px 16px; }
  .settings-bar { gap: 14px; padding: 16px; }
  .btn-action { padding: 9px 13px; font-size: 0.8rem; }
  .resize-input { width: 64px; }
  .file-card { flex-wrap: wrap; }
  .ads-row { flex-direction: column; }
  .ad-slot { height: 60px; }
  .hero h1 { font-size: 1.8rem; }
}

@media (max-width: 420px) {
  .hero h1 { font-size: 1.5rem; }
  .hero p  { font-size: 0.78rem; }
  .logo-name { font-size: 0.95rem; }
  /* .logo-icon { width: 28px; height: 28px; } */
  .logo-icon img { width: 18px; height: 18px; }
  .preview-img, .preview-out { width: 50px; height: 50px; }
  .file-name { font-size: 0.78rem; }
  .resize-input { width: 54px; font-size: 0.75rem; }
}

@media (max-width: 300px) {
  header { padding: 0 10px; height: 52px; }
  main   { padding: 20px 10px 16px; }
  .hero h1 { font-size: 1.25rem; letter-spacing: -0.02em; }
  .hero p  { font-size: 0.72rem; }
  .dropzone { padding: 24px 10px; border-radius: 14px; }
  .drop-icon { font-size: 2rem; }
  .drop-title { font-size: 0.9rem; }
  .drop-sub, .drop-formats { font-size: 0.7rem; }
  .settings-bar { padding: 12px 10px; gap: 10px; border-radius: 14px; }
  .format-pill { padding: 5px 9px; font-size: 0.68rem; }
  .btn-action { padding: 7px 9px; font-size: 0.72rem; gap: 4px; border-radius: 9px; }
  .logo-name { font-size: 0.82rem; }
  /* .logo-icon { width: 26px; height: 26px; border-radius: 7px; } */
  .logo-icon img { width: 16px; height: 16px; }
  .theme-toggle { width: 38px; height: 22px; }
  .theme-toggle::after { width: 15px; height: 15px; }
  [data-theme="dark"] .theme-toggle::after { transform: translateX(13px); }
  .preview-img, .preview-out { width: 40px; height: 40px; border-radius: 7px; }
  .file-card { padding: 12px 10px; border-radius: 12px; }
  .resize-input { width: 48px; padding: 5px 6px; font-size: 0.7rem; }
  .toast { font-size: 0.7rem; padding: 8px 12px; white-space: normal; text-align: center; max-width: 90vw; border-radius: 18px; }
  .ad-slot { display: none; }
  .ads-row { margin-top: 12px; }
}
