/* ══════════════════════════════════════════════════
   XENREV TOOLS — Unified Design System
   Dark / Light mode support on ALL pages
   ══════════════════════════════════════════════════ */

/* ── GOOGLE FONTS (loaded via HTML) ── */
/* Syne 700,800 | DM Sans 300,400,500,600 */

/* ── CSS VARIABLES ── */
:root {
  --brand: #3FA9F5;
  --brand-dark: #1A8DE0;
  --brand-light: #7FCBFF;
  --brand-glow: rgba(63,169,245,0.30);
  --brand-dim: rgba(63,169,245,0.12);
  --radius: 18px;
  --radius-sm: 10px;
  --tr: 0.3s cubic-bezier(.4,0,.2,1);
  --success: #34D399;
  --error: #F87171;
}

/* ── LIGHT MODE (default) ── */
[data-theme="light"], :root {
  --bg: #F0F7FF;
  --bg2: #E6F3FD;
  --surface: #FFFFFF;
  --surface2: #EBF5FF;
  --border: rgba(63,169,245,0.18);
  --border-s: rgba(63,169,245,0.38);
  --text: #0A1F33;
  --text-muted: #527A96;
  --faint: #A0C4DE;
  --white: #0A1F33;
  --shadow: 0 4px 24px rgba(63,169,245,0.10);
  --shadow-lg: 0 16px 56px rgba(63,169,245,0.16);
  --nav-bg: rgba(240,247,255,0.92);
  --grid-color: rgba(63,169,245,0.055);
}

/* ── DARK MODE ── */
[data-theme="dark"] {
  --bg: #050A12;
  --bg2: #090F1A;
  --surface: #0D1526;
  --surface2: #111D33;
  --border: rgba(63,169,245,0.15);
  --border-s: rgba(63,169,245,0.32);
  --text: #E8F0FC;
  --text-muted: #7A8FAD;
  --faint: #2E4460;
  --white: #ffffff;
  --shadow: 0 4px 24px rgba(0,0,0,0.32);
  --shadow-lg: 0 16px 56px rgba(0,0,0,0.44);
  --nav-bg: rgba(5,10,18,0.92);
  --grid-color: rgba(63,169,245,0.038);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', 'Outfit', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: auto;
  transition: background var(--tr), color var(--tr);
}

/* Grid background */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  z-index: 0;
}

/* Noise overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
  opacity: 0.35;
}

/* ── CURSOR ── */
.cursor {
  width: 11px; height: 11px;
  background: var(--brand);
  border-radius: 50%;
  position: fixed; top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%,-50%);
  transition: width .25s, height .25s;
  mix-blend-mode: multiply;
}
[data-theme="dark"] .cursor { mix-blend-mode: screen; }
.cursor-ring {
  width: 36px; height: 36px;
  border: 1.5px solid var(--brand);
  border-radius: 50%;
  position: fixed; top: 0; left: 0;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%,-50%);
  opacity: .5;
  transition: width .3s, height .3s, opacity .3s;
}
.cursor.hovered { width: 20px; height: 20px; }
.cursor-ring.hovered { width: 58px; height: 58px; opacity: .18; }

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 500;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  background: var(--nav-bg);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  transition: background var(--tr), border-color var(--tr);
}
.logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}
.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 19px; color: white;
  font-family: 'Syne', sans-serif;
  box-shadow: 0 0 20px var(--brand-glow);
}
.logo-text {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 20px;
  color: var(--text);
  letter-spacing: -.5px;
  transition: color var(--tr);
}
.logo-text span, .logo-text em { color: var(--brand); font-style: normal; }
.nav-links {
  display: flex; align-items: center; gap: 28px;
  list-style: none;
}
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: color .2s;
}
.nav-links a:hover { color: var(--brand); }

/* Nav right section */
.nav-r {
  display: flex; align-items: center; gap: 10px;
}
.nav-back {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-muted); text-decoration: none;
  font-size: 14px; font-weight: 500;
  border: 1px solid var(--border);
  padding: 7px 16px; border-radius: 8px;
  transition: all .2s;
}
.nav-back:hover { color: var(--brand); border-color: var(--brand); }

/* ── THEME TOGGLE ── */
.theme-toggle {
  width: 50px; height: 26px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  position: relative;
  cursor: none;
  transition: all .3s;
  flex-shrink: 0;
}
.theme-toggle::before {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: var(--brand);
  border-radius: 50%;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 0 8px var(--brand-glow);
}
[data-theme="dark"] .theme-toggle::before { transform: translateX(24px); }
.theme-toggle-icons {
  position: absolute; inset: 0;
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  pointer-events: none;
  font-size: 10px;
}

/* ── TOOL HERO ── */
section { position: relative; z-index: 1; }
.tool-hero {
  padding: 120px 5% 60px;
  text-align: center;
}
.tool-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand-dim);
  border: 1px solid var(--border);
  padding: 6px 16px; border-radius: 100px;
  font-size: 13px; color: var(--brand);
  margin-bottom: 24px;
}
.badge-dot {
  width: 6px; height: 6px;
  background: var(--brand);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(63,169,245,.4); }
  50% { box-shadow: 0 0 0 6px rgba(63,169,245,0); }
}
.tool-hero h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(32px, 5vw, 60px);
  font-weight: 800;
  letter-spacing: -1.5px;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.1;
  transition: color var(--tr);
}
.tool-hero h1 span { color: var(--brand); }
.tool-hero p { color: var(--text-muted); max-width: 520px; margin: 0 auto; font-size: 16px; }

/* ── TOOL AREA ── */
.tool-area {
  padding: 0 5% 80px;
  max-width: 900px;
  margin: 0 auto;
}
.tool-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px;
  position: relative;
  overflow: hidden;
  transition: background var(--tr), border-color var(--tr);
  box-shadow: var(--shadow);
}
.tool-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
}

/* ── DROP ZONE ── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  transition: all .3s;
  cursor: none;
  position: relative;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--brand);
  background: var(--brand-dim);
}
.drop-icon { font-size: 48px; margin-bottom: 16px; }
.drop-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px; font-weight: 700;
  color: var(--text); margin-bottom: 8px;
  transition: color var(--tr);
}
.drop-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }

/* ── BUTTONS ── */
.btn {
  background: var(--brand);
  border: none;
  padding: 12px 28px;
  border-radius: 12px;
  color: white;
  font-size: 15px;
  font-weight: 600;
  font-family: 'DM Sans', 'Outfit', sans-serif;
  cursor: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .2s;
}
.btn:hover {
  background: var(--brand-dark);
  box-shadow: 0 0 30px var(--brand-glow);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; transform: none; cursor: not-allowed; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}
.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-dim);
  box-shadow: none;
}
.btn-success { background: var(--success); color: #0a2a1a; }
.btn-success:hover { background: #5ee8b5; box-shadow: 0 0 30px rgba(52,211,153,.3); }

/* ── PROGRESS BAR ── */
.progress-bar {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
  margin: 16px 0;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-dark));
  border-radius: 3px;
  width: 0;
  transition: width .4s ease;
}

/* ── FILE LIST ── */
.file-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 12px;
  transition: background var(--tr), border-color var(--tr);
}
.file-icon { font-size: 20px; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 14px; color: var(--text);
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color var(--tr);
}
.file-size { font-size: 12px; color: var(--text-muted); }
.file-remove {
  background: transparent; border: none;
  color: var(--text-muted); font-size: 18px;
  cursor: none; transition: color .2s; flex-shrink: 0;
}
.file-remove:hover { color: var(--error); }

/* ── RESULT BOX ── */
.result-box {
  background: var(--surface2);
  border: 1px solid rgba(52,211,153,.2);
  border-radius: 16px;
  padding: 28px;
  margin-top: 24px;
  text-align: center;
  display: none;
  transition: background var(--tr);
}
.result-box.show { display: block; animation: fadeUp .4s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-icon { font-size: 48px; margin-bottom: 12px; }
.result-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px; font-weight: 700;
  color: var(--success); margin-bottom: 8px;
}
.result-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; }

/* ── OPTIONS ROW ── */
.options-row {
  display: flex; gap: 12px;
  flex-wrap: wrap; margin: 20px 0;
  align-items: center;
}
.option-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.select-input {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: 'DM Sans', 'Outfit', sans-serif;
  cursor: none; outline: none;
  transition: border-color .2s, background var(--tr), color var(--tr);
}
.select-input:focus { border-color: var(--brand); }
.range-input {
  -webkit-appearance: none;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  outline: none;
  width: 200px; cursor: none;
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--brand);
  border-radius: 50%; cursor: none;
  box-shadow: 0 0 10px var(--brand-glow);
}

/* ── INFO CHIPS ── */
.info-chips {
  display: flex; gap: 10px;
  flex-wrap: wrap; margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.chip {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
}
.chip-dot {
  width: 6px; height: 6px;
  background: var(--success);
  border-radius: 50%; flex-shrink: 0;
}

/* ── RELATED TOOLS ── */
.related-tools { padding: 60px 5%; max-width: 900px; margin: 0 auto; }
.related-title {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 700;
  color: var(--text); margin-bottom: 20px;
  transition: color var(--tr);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
  text-decoration: none;
  transition: all .2s;
  display: flex; align-items: center; gap: 10px;
}
.related-card:hover {
  border-color: rgba(63,169,245,.4);
  transform: translateY(-2px);
  background: var(--surface2);
}
.related-card-icon { font-size: 22px; flex-shrink: 0; }
.related-card-title { font-size: 13px; font-weight: 600; color: var(--text); transition: color var(--tr); }

/* ── AD SLOT ── */
.ad-slot {
  background: var(--surface2);
  border: 1px dashed var(--border);
  border-radius: 12px; padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  max-width: 728px;
  margin: 32px auto;
  transition: background var(--tr), border-color var(--tr);
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 5%;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--surface);
  transition: background var(--tr), border-color var(--tr);
}
footer a { color: var(--brand); text-decoration: none; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 32px; right: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 14px; color: var(--text);
  z-index: 9999;
  transform: translateY(20px); opacity: 0;
  transition: all .3s;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ── UTILITIES ── */
.hidden { display: none !important; }
input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: none; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-s); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }

/* ── COMPARE GRID ── */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.compare-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 16px; text-align: center;
  transition: background var(--tr), border-color var(--tr);
}
.compare-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px; }
.compare-size { font-family: 'Syne', sans-serif; font-size: 24px; font-weight: 700; color: var(--text); transition: color var(--tr); }
.compare-size.reduced { color: var(--success); }
.saving-badge {
  display: inline-block;
  background: rgba(52,211,153,.15);
  color: var(--success);
  padding: 4px 12px; border-radius: 100px;
  font-size: 13px; font-weight: 600; margin-top: 8px;
}

/* ── DRAG HANDLE ── */
.file-item { cursor: grab; }
.file-item.dragging { opacity: .4; background: var(--brand-dim); border-color: var(--brand); }
.drag-handle { color: var(--text-muted); margin-right: 8px; font-size: 16px; cursor: grab; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .tool-box { padding: 24px 16px; }
  .drop-zone { padding: 40px 20px; }
  .nav-links { display: none; }
  .compare-grid { grid-template-columns: 1fr; }
}
