/* =========================================================
   App Styles – BG Remover (multi-page PWA)
   - Accessible contrast (AA+)
   - Dark & Light themes (+ system auto)
   - Error-free, cross-browser friendly
   - Consistent components across pages
   ========================================================= */

/* -------------------- Design tokens -------------------- */
:root {
  /* Brand hues (edit these to re-skin the app) */
  --brand-h: 190;        /* primary hue (teal/cyan) */
  --brand-s: 100%;
  --brand-l: 50%;

  --brand: hsl(var(--brand-h) var(--brand-s) var(--brand-l));
  --brand-2: hsl(var(--brand-h) 90% 60%);

  /* Elevation / radius */
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-1: 0 10px 30px rgba(0, 0, 0, 0.35);
  --ring: 0 0 0 3px color-mix(in oklab, var(--brand), white 70%);

  /* Typography */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --fs-14: 14px;
  --fs-15: 15px;
  --fs-16: 16px;

  /* Layout widths */
  --container-w: 1020px;
}

/* ----------- Dark & Light theme surfaces/tints ---------- */
:root {
  /* Dark (default) */
  --bg: #0b1620;
  --bg-2: #102636;
  --panel: #0f1e2b;
  --panel-2: #142534;

  --text: #eaf2f7;
  --muted: #a3bfce;
  --border: rgba(255, 255, 255, 0.12);

  --chip-bg: rgba(255, 255, 255, 0.06);
  --tag-bg: rgba(255, 255, 255, 0.08);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6fafc;
    --bg-2: #ecf4f8;
    --panel: #ffffff;
    --panel-2: #f3f8fb;

    --text: #0b1620;
    --muted: #506575;
    --border: rgba(0, 0, 0, 0.12);

    --chip-bg: rgba(0, 0, 0, 0.05);
    --tag-bg: rgba(0, 0, 0, 0.06);
  }
}

/* Force theme via body class if desired */
.theme-dark {
  --bg: #0b1620;
  --bg-2: #102636;
  --panel: #0f1e2b;
  --panel-2: #142534;

  --text: #eaf2f7;
  --muted: #a3bfce;
  --border: rgba(255, 255, 255, 0.12);

  --chip-bg: rgba(255, 255, 255, 0.06);
  --tag-bg: rgba(255, 255, 255, 0.08);
}

.theme-light {
  --bg: #f6fafc;
  --bg-2: #ecf4f8;
  --panel: #ffffff;
  --panel-2: #f3f8fb;

  --text: #0b1620;
  --muted: #506575;
  --border: rgba(0, 0, 0, 0.12);

  --chip-bg: rgba(0, 0, 0, 0.05);
  --tag-bg: rgba(0, 0, 0, 0.06);
}

/* -------------------- Global base ---------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 12% -20%, color-mix(in oklab, var(--brand), transparent 85%) 0%, transparent 60%),
    var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.container {
  width: 100%;
  max-width: var(--container-w);
  padding: 24px 16px;
}

/* Typography */
h1, h2 {
  margin: 0.5rem 0;
  text-shadow: 0 0 10px color-mix(in oklab, var(--brand), transparent 65%);
}
p, ol, li, small { color: var(--muted); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Links that look like buttons */
.link-btn {
  display: inline-block;
  padding: 12px 18px;
  color: #00181d;
  font-weight: 800;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 18px color-mix(in oklab, var(--brand), transparent 55%);
  text-decoration: none;
}

/* Panels / cards */
.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin: 18px 0;
  box-shadow: var(--shadow-1);
}
.center { text-align: center; }

/* Layout helpers */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.header { justify-content: space-between; align-items: center; }

/* -------------------- Controls ------------------------- */
input,
select,
textarea,
button,
a.btn {
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: var(--fs-15);
  border: 1px solid var(--border);
  outline: none;
  background: transparent;
  color: var(--text);
}

button,
a.btn {
  background: linear-gradient(180deg, var(--brand), color-mix(in oklab, var(--brand), black 20%));
  color: #00181d;
  font-weight: 700;
  border: none;
  box-shadow: 0 0 16px color-mix(in oklab, var(--brand), transparent 65%);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

button:hover,
a.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px color-mix(in oklab, var(--brand), transparent 45%);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-secondary:hover {
  background: color-mix(in oklab, var(--panel-2), white 6%);
}

/* Inputs (full width on forms) */
select,
input[type="file"],
textarea,
input[type="text"] {
  width: 100%;
  max-width: 520px;
  background: color-mix(in oklab, var(--panel), white 4%);
}

/* Focus visibility (keyboard-only) */
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------------- Drawer / Hamburger ------------------- */
.hamburger {
  width: 44px; height: 36px;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  cursor: pointer;
}
.hamburger span {
  display: block; height: 3px; background: color-mix(in oklab, var(--text), white 10%); border-radius: 2px;
}

.drawer {
  position: fixed; top: 0; left: -270px;
  width: 250px; height: 100%;
  background: color-mix(in oklab, var(--panel), black 5%);
  border-right: 1px solid var(--border);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.35);
  padding: 20px 16px;
  transition: left 0.25s ease;
  z-index: 1000;
}
.drawer.open { left: 0; }
.drawer .nav-link {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 12px 10px;
  border-radius: 10px;
  margin: 6px 0;
}
.drawer .nav-link:hover {
  background: color-mix(in oklab, var(--panel), white 8%);
}

.backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 900;
}
.backdrop.show { opacity: 1; visibility: visible; }

/* ---------------- Drag & Drop Zone --------------------- */
.drop,
#dropZone {
  border: 2px dashed var(--brand);
  border-radius: var(--radius-lg);
  text-align: center;
  padding: 24px;
  background: color-mix(in oklab, var(--panel), white 3%);
}
.drop:hover,
#dropZone:hover {
  box-shadow: 0 0 22px color-mix(in oklab, var(--brand), transparent 65%);
}
.drop.dragover,
#dropZone.dragover {
  border-color: color-mix(in oklab, var(--brand), white 25%);
  box-shadow: 0 0 28px color-mix(in oklab, var(--brand), transparent 45%);
}
.drop .hint,
#dropZone .hint { color: var(--muted); }
.drop .or,
#dropZone .or { opacity: 0.8; }

/* ---------------- Spinner / Errors / Result ------------ */
.spinner { display: none; text-align: center; margin-top: 12px; }
.spinner svg { width: 56px; height: 56px; }
.spinner p { color: var(--brand); font-weight: 700; margin-top: 8px; }

.error { color: #ff9c9c; margin-top: 8px; }

#resultImage {
  display: none;
  margin-top: 16px;
  max-width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 0 18px color-mix(in oklab, var(--brand), transparent 65%);
}

.controls { margin-top: 10px; }

/* ---------------- Suggestions & Chips ------------------ */
.suggestions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.chip {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
}
.chip:hover {
  box-shadow: 0 0 10px color-mix(in oklab, var(--brand), transparent 70%);
}
.chip.active {
  border-color: var(--brand);
  box-shadow: 0 0 12px color-mix(in oklab, var(--brand), transparent 45%);
}

/* ---------------- Canvas (compositor) ------------------ */
.canvas {
  width: 100%;
  max-width: 900px;
  height: auto;
  margin-top: 12px;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: color-mix(in oklab, var(--panel), white 2%);
  box-shadow: 0 0 14px color-mix(in oklab, var(--brand), transparent 85%);
}

/* ---------------- Gallery ------------------------------ */
#galleryControls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
#tagChips { display: flex; gap: 8px; flex-wrap: wrap; }

#galleryGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-1);
}
.card img {
  width: 100%; height: 160px; object-fit: cover; border-radius: 8px;
}
.card .name {
  font-size: 0.9rem; color: color-mix(in oklab, var(--text), white 8%); word-break: break-all;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 0.75rem; padding: 4px 8px; border-radius: 999px;
  background: var(--tag-bg); border: 1px solid var(--border); color: var(--text);
}

/* ---------------- Footer ------------------------------- */
footer {
  margin: 22px 0;
  color: color-mix(in oklab, var(--muted), white 10%);
  font-size: 0.9rem;
}

/* ------------- Small screen tweaks --------------------- */
@media (max-width: 560px) {
  .container { padding: 18px 12px; }
  .row { gap: 10px; }
  .panel { padding: 16px; }
}
/* Optional: narrow-column grid; otherwise .card grid works too */
#hotGrid.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.hot-item { background: linear-gradient(180deg, var(--panel), var(--panel-2)); border:1px solid var(--border); border-radius:14px; padding:10px; box-shadow: var(--shadow-1); }
.hot-item img { width:100%; height:200px; object-fit:cover; border-radius:10px; }
.hot-meta { display:flex; justify-content:space-between; align-items:center; margin-top:8px; color: var(--muted); }
.hot-actions { display:flex; gap:8px; align-items:center; }
.hot-like { cursor:pointer; }
.hot-like.liked { filter: saturate(1.5);
                 
}
.wa-verified-badge-glow {
  display: inline-block;
  width: 16px;
  height: 16px;
  background-color: #25D366; /* WhatsApp green */
  border-radius: 50%;
  position: relative;
  vertical-align: middle;
  margin-left: 5px;
  animation: glowCycle 2s infinite;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
}

.wa-verified-badge-glow::after {
  content: "✓";
  color: white;
  font-size: 12px;
  font-weight: bold;
  position: absolute;
  top: 1px;
  left: 4px;
}

@keyframes glowCycle {
  0%   { box-shadow: 0 0 6px red; background-color: red; }
  33%  { box-shadow: 0 0 6px black; background-color: black; }
  66%  { box-shadow: 0 0 6px white; background-color: white; color: black; }
  100% { box-shadow: 0 0 6px red; background-color: red; }
}
