/* ==========================================================================
   imUrl AI — Design System
   Concept: "the compress" — a long URL visually distills into a short,
   glowing pill. Palette draws from the Indian Ocean coastline off
   Mogadishu at dusk: deep tidal teal, warm sand, and a coral wayfinding
   accent used only for the single most important action on any screen.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* --- Light theme ("Sand") --- */
  --bg: #F4EFE4;
  --bg-alt: #ECE5D4;
  --surface: rgba(255, 255, 255, 0.6);
  --surface-solid: #FFFFFF;
  --border: rgba(15, 30, 34, 0.10);
  --ink: #101A1B;
  --ink-soft: #4B5A5B;
  --ink-faint: #7C8A8B;

  --teal-900: #063A3A;
  --teal-700: #0B6E63;
  --teal-500: #0EA89A;
  --teal-300: #6BD4C4;
  --teal-100: #DAF3EC;

  --coral: #FF6B4A;
  --coral-dark: #E24E2F;
  --amber: #F0A93B;

  --danger: #E5484D;
  --success: #2FAE6E;

  --shadow-soft: 0 8px 30px rgba(6, 58, 58, 0.08);
  --shadow-lift: 0 20px 60px rgba(6, 58, 58, 0.16);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --font-display: 'Manrope', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0A1414;
  --bg-alt: #0E1B1B;
  --surface: rgba(16, 34, 34, 0.55);
  --surface-solid: #102222;
  --border: rgba(230, 240, 238, 0.10);
  --ink: #F2F7F5;
  --ink-soft: #AEC2BF;
  --ink-faint: #74908C;

  --teal-900: #DAF3EC;
  --teal-700: #6BD4C4;
  --teal-500: #21C7B3;
  --teal-300: #0B6E63;
  --teal-100: #0F2B29;

  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 24px 70px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 900px 500px at 10% -10%, var(--teal-100), transparent 60%),
    radial-gradient(ellipse 700px 500px at 110% 10%, rgba(255, 107, 74, 0.08), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease, color .35s ease;
}

h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 .4em;
}

a { color: inherit; text-decoration: none; }
code, .mono { font-family: var(--font-mono); }

:focus-visible {
  outline: 2px solid var(--teal-500);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* --- Layout shells --------------------------------------------------- */
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 24px; }
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  padding: 24px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.main { flex: 1; min-width: 0; padding: 28px 32px 80px; }

@media (max-width: 880px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; overflow-x: auto; }
  .main { padding: 20px 16px 60px; }
}

/* --- Brand ------------------------------------------------------------ */
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 20px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-900));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 15px;
  box-shadow: var(--shadow-soft);
}
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 16.5px; }
.brand-name .ai-tag {
  font-size: 10px; font-weight: 700; color: var(--teal-700);
  background: var(--teal-100); padding: 2px 6px; border-radius: 6px; margin-left: 6px; vertical-align: middle;
}

/* --- Glass surfaces ----------------------------------------------------- */
.glass {
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.card { padding: 22px; }
.card + .card { margin-top: 16px; }

/* --- Nav items ----------------------------------------------------------- */
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-weight: 600; font-size: 14px;
  transition: background .18s ease, color .18s ease;
  white-space: nowrap;
}
.nav-item:hover { background: var(--teal-100); color: var(--teal-900); }
.nav-item.active { background: var(--teal-500); color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  padding: 11px 20px; border-radius: var(--radius-pill);
  border: 1px solid transparent; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease;
  line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--coral), var(--coral-dark)); color: #fff; box-shadow: 0 10px 24px rgba(226, 78, 47, 0.32); }
.btn-primary:hover { box-shadow: 0 14px 30px rgba(226, 78, 47, 0.42); }
.btn-teal { background: var(--teal-500); color: #fff; box-shadow: 0 10px 24px rgba(14, 168, 154, 0.3); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-solid); }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-icon { padding: 9px; border-radius: 50%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* --- Forms ------------------------------------------------------------------ */
.field { margin-bottom: 16px; }
.label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.input, .textarea, select.input {
  width: 100%; padding: 12px 14px; font-size: 14.5px; font-family: var(--font-body);
  background: var(--surface-solid); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .textarea:focus { border-color: var(--teal-500); box-shadow: 0 0 0 4px var(--teal-100); outline: none; }
.input.mono { font-family: var(--font-mono); }
.hint { font-size: 12.5px; color: var(--ink-faint); margin-top: 5px; }
.input-group { display: flex; gap: 10px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-soft); }

/* --- Alerts / flash ----------------------------------------------------------- */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500; margin-bottom: 18px; display: flex; gap: 10px; align-items: flex-start; }
.alert-error { background: rgba(229, 72, 77, .1); color: var(--danger); border: 1px solid rgba(229, 72, 77, .25); }
.alert-success { background: rgba(47, 174, 110, .1); color: var(--success); border: 1px solid rgba(47, 174, 110, .25); }

/* --- Stat cards -------------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { padding: 20px; }
.stat-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); }
.stat-value { font-family: var(--font-display); font-size: 32px; font-weight: 800; margin-top: 6px; }
.stat-value.teal { color: var(--teal-500); }
.stat-value.coral { color: var(--coral); }

/* --- Table ---------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.8px; }
table.data th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border); }
table.data td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--teal-100); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 700; }
.badge-on { background: rgba(47, 174, 110, .12); color: var(--success); }
.badge-off { background: rgba(229, 72, 77, .12); color: var(--danger); }
.badge-lock { background: rgba(240, 169, 59, .15); color: var(--amber); }

.slug-pill {
  font-family: var(--font-mono); font-weight: 600; font-size: 13.5px;
  background: var(--teal-100); color: var(--teal-900); padding: 4px 10px; border-radius: var(--radius-sm);
}

/* --- Topbar --------------------------------------------------------------------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; gap: 16px; flex-wrap: wrap; }
.topbar h1 { font-size: 24px; }
.search-box { position: relative; }
.search-box input { padding-left: 38px; min-width: 240px; }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-faint); }

/* --- Theme toggle ------------------------------------------------------------------ */
.theme-toggle {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface-solid); display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink-soft);
}
.theme-toggle svg { width: 18px; height: 18px; }

/* --- Avatar ------------------------------------------------------------------------- */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 13.5px; flex-shrink: 0;
}

/* --- Landing / hero (marketing page) --------------------------------------------------- */
.nav-public { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; }
.hero { padding: 72px 0 40px; text-align: center; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700;
  color: var(--teal-700); background: var(--teal-100); padding: 6px 14px; border-radius: var(--radius-pill); margin-bottom: 22px;
}
.hero h1 { font-size: clamp(34px, 5.5vw, 62px); line-height: 1.06; max-width: 820px; margin-inline: auto 18px; }
.hero p.lede { font-size: 17.5px; color: var(--ink-soft); max-width: 560px; margin: 0 auto 34px; }

/* The signature "compress" demo: a long URL animates down into a short pill */
.compress-demo { max-width: 640px; margin: 0 auto; padding: 10px; }
.compress-track {
  position: relative; height: 64px; display: flex; align-items: center; justify-content: center;
}
.compress-long, .compress-short {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); border-radius: var(--radius-pill); border: 1.5px solid var(--border);
  background: var(--surface-solid); padding: 0 22px; font-size: 14px; color: var(--ink-soft);
  animation-duration: 3.2s; animation-iteration-count: infinite; animation-timing-function: cubic-bezier(.65,0,.35,1);
}
.compress-long { animation-name: compressLongCycle; }
.compress-short {
  animation-name: compressShortCycle; color: var(--teal-900); font-weight: 700; border-color: var(--teal-500);
  box-shadow: 0 0 0 5px var(--teal-100);
}
@keyframes compressLongCycle {
  0%, 8% { opacity: 1; transform: scaleX(1); filter: blur(0); }
  32%, 100% { opacity: 0; transform: scaleX(.4); filter: blur(3px); }
}
@keyframes compressShortCycle {
  0%, 30% { opacity: 0; transform: scale(.7); }
  46%, 90% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.06); }
}

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin-top: 60px; }
.feature-card { padding: 24px; text-align: left; }
.feature-icon {
  width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--teal-100); color: var(--teal-700); margin-bottom: 14px;
}
.feature-icon svg { width: 20px; height: 20px; }
.feature-card h3 { font-size: 16px; margin-bottom: 6px; }
.feature-card p { font-size: 13.8px; color: var(--ink-soft); margin: 0; }

/* --- Auth pages --------------------------------------------------------------------------- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; padding: 36px 32px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-sub { color: var(--ink-soft); font-size: 13.8px; margin-bottom: 26px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 13.8px; color: var(--ink-soft); }
.auth-switch a { color: var(--teal-500); font-weight: 700; }

/* --- Empty state -------------------------------------------------------------------------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty-state svg { width: 46px; height: 46px; color: var(--ink-faint); margin-bottom: 14px; }

/* --- Utility ------------------------------------------------------------------------------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-16 { gap: 16px; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.text-faint { color: var(--ink-faint); }
.text-soft { color: var(--ink-soft); }
.text-sm { font-size: 13px; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* --- Fade/slide-in for cards on load ---------------------------------------------------------- */
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.rise-in { animation: riseIn .5s cubic-bezier(.2,.8,.2,1) both; }
