/* ============================================================
   devbench — cyan / navy "cloud panel" design system
   Dark mode only. 8px spacing grid. Reusable, tokenized.
   Inspired by a deep-navy hosting dashboard with cyan accents.
   ============================================================ */

:root {
  /* ---- palette ---- */
  --black:      #06090F;   /* deepest surface */
  --bg:         #0A0E16;   /* app background (deep navy-black) */
  --bg2:        #070B12;   /* input / output wells */
  --panel:      rgba(255,255,255,.035);
  --panel2:     rgba(255,255,255,.06);

  --primary:    #06B6D4;   /* cyan */
  --accent:     #06B6D4;   /* JS-referenced: primary action / marks */
  --accent2:    #22D3EE;   /* bright cyan accent (gradient end) */
  --hover:      #0891B2;   /* hover cyan */

  /* banner blues */
  --blue1:      #1D4ED8;
  --blue2:      #2563EB;
  --blue3:      #0E7490;

  --txt:        #F1F5F9;
  --muted:      #94A3B8;
  --line:       rgba(255,255,255,.07);
  --line-strong:rgba(255,255,255,.13);

  --good:       #22C55E;
  --bad:        #F87171;
  --warn:       #FBBF24;

  /* ---- spacing (8px grid) ---- */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* ---- radius ---- */
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 18px;

  /* ---- typography ---- */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* ---- shadows & glow ---- */
  --shadow-sm: 0 2px 8px rgba(0,0,0,.45);
  --shadow:    0 12px 40px -14px rgba(0,0,0,.8);
  --shadow-lg: 0 28px 70px -24px rgba(0,0,0,.9);
  --glow:      0 0 24px -6px rgba(6,182,212,.55);
  --ring:      0 0 0 3px rgba(6,182,212,.30);

  /* ---- motion ---- */
  --t:  220ms cubic-bezier(.4, 0, .2, 1);
  --t2: 300ms cubic-bezier(.4, 0, .2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background:
    radial-gradient(900px 600px at 82% -12%, rgba(6,182,212,.16) 0%, transparent 60%),
    radial-gradient(800px 620px at -8% 108%, rgba(37,99,235,.14) 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--txt);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

::selection { background: rgba(6,182,212,.4); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(34,211,238,.4); }

/* ============================================================
   LAYOUT
   ============================================================ */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(6,9,15,.55));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: var(--s5) var(--s3);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  overflow-y: auto;
}

.brand {
  display: flex; align-items: center; gap: var(--s3);
  font-weight: 800; font-size: 20px; letter-spacing: -.02em;
  padding: var(--s2) var(--s3) var(--s6);
}
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--accent2));
  display: grid; place-items: center; color: #04252b;
  box-shadow: 0 6px 18px -8px rgba(6,182,212,.7);
}
.brand .logo .i { width: 22px; height: 22px; stroke-width: 2.4; }
.brand span {
  background: linear-gradient(90deg, #fff, #a5f3fc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---- nav ---- */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  all: unset;
  display: flex; align-items: center; gap: var(--s3);
  padding: 10px var(--s3); border-radius: var(--r-sm);
  color: var(--muted); font-size: 14px; font-weight: 500;
  cursor: pointer; position: relative;
  transition: background var(--t), color var(--t), transform var(--t);
}
.nav button .ic {
  display: grid; place-items: center; width: 22px; height: 22px; opacity: .8;
}
.nav button .ic .i { width: 18px; height: 18px; }
.nav button:hover { background: var(--panel2); color: var(--txt); }
.nav button:hover .ic { opacity: 1; }
.nav button.active {
  background: linear-gradient(90deg, rgba(6,182,212,.22), rgba(34,211,238,.06));
  color: #fff;
}
.nav button.active::before {
  content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 3px;
  background: linear-gradient(var(--primary), var(--accent2));
  box-shadow: 0 0 12px var(--accent2);
}

/* ---- sidebar footer / status indicator ---- */
.side-foot { margin-top: auto; padding: var(--s4) var(--s3) var(--s2); }
.status {
  display: flex; align-items: center; gap: var(--s2);
  font-size: 12.5px; color: var(--muted); font-weight: 500;
}
.status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good); box-shadow: 0 0 0 3px rgba(34,197,94,.18);
  animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.side-foot small { display: block; margin-top: 6px; color: var(--muted); opacity: .6; font-size: 11px; }

/* ============================================================
   MAIN
   ============================================================ */
.main {
  padding: var(--s7) var(--s7) var(--s8);
  max-width: 1140px; width: 100%;
}

/* ---- hero / promo banner ---- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg); margin-bottom: var(--s6);
  padding: var(--s6) var(--s7);
  background:
    radial-gradient(600px 300px at 90% -40%, rgba(34,211,238,.4), transparent 60%),
    linear-gradient(105deg, var(--blue1), var(--blue2) 55%, var(--blue3));
  box-shadow: var(--shadow), 0 0 46px -14px rgba(37,99,235,.6);
  display: flex; align-items: center; gap: var(--s5);
  animation: fade var(--t2) ease;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(400px 200px at 10% 130%, rgba(255,255,255,.12), transparent 60%);
  pointer-events: none;
}
.hero__content { flex: 1 1 auto; position: relative; z-index: 1; }
.hero__badge {
  display: inline-block; margin-bottom: var(--s3);
  padding: 4px 11px; border-radius: 20px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25);
}
.hero__content h2 {
  font-size: 26px; font-weight: 800; letter-spacing: -.025em; color: #fff;
}
.hero__content p {
  margin-top: var(--s2); color: rgba(255,255,255,.82);
  font-size: 14.5px; max-width: 60ch; line-height: 1.55;
}
.hero__cta {
  margin-top: var(--s4);
  background: rgba(255,255,255,.95) !important; color: #0b3a8f !important;
  box-shadow: 0 10px 28px -12px rgba(0,0,0,.5) !important;
}
.hero__cta:hover { filter: brightness(1.03); box-shadow: 0 14px 32px -12px rgba(0,0,0,.55) !important; }
.hero__art {
  flex: 0 0 auto; line-height: 0;
  color: rgba(255,255,255,.92);
  filter: drop-shadow(0 8px 24px rgba(0,0,0,.35));
  position: relative; z-index: 1;
}
.hero__art svg { width: 92px; height: 92px; }
.hero__close {
  all: unset; cursor: pointer; position: absolute; top: 14px; right: 16px;
  width: 26px; height: 26px; border-radius: 8px; z-index: 2;
  display: grid; place-items: center; font-size: 18px; line-height: 1;
  color: rgba(255,255,255,.8); background: rgba(255,255,255,.12);
  transition: background var(--t), color var(--t);
}
.hero__close:hover { background: rgba(255,255,255,.25); color: #fff; }
.hero__dots {
  position: absolute; bottom: 14px; right: 20px; z-index: 2;
  display: flex; gap: 6px;
}
.hero__dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.35); }
.hero__dots i.active { background: #fff; width: 18px; border-radius: 4px; }

.view { display: none; animation: fade var(--t2) ease; }
.view.active { display: block; }
@keyframes fade {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.head { margin-bottom: var(--s5); }
.head h1 {
  font-size: 26px; font-weight: 800; letter-spacing: -.02em;
  display: flex; align-items: center; gap: var(--s3);
}
.h-ic {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center; color: var(--accent2);
  background: linear-gradient(135deg, rgba(6,182,212,.16), rgba(37,99,235,.10));
  border: 1px solid var(--line-strong);
}
.h-ic .i { width: 21px; height: 21px; }
.head p { color: var(--muted); margin-top: var(--s2); font-size: 14.5px; }
.head h1 + p, .head p { margin-left: 54px; }
@media (max-width: 520px) { .head p { margin-left: 0; } }

/* ---- card (glassmorphism, faint blue tint) ---- */
.card {
  background:
    linear-gradient(180deg, rgba(56,130,246,.05), rgba(255,255,255,.012)),
    rgba(255,255,255,.02);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color var(--t), box-shadow var(--t2), transform var(--t2);
}
.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }

label.fld {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--muted);
  margin: 0 0 var(--s2); text-transform: uppercase; letter-spacing: .08em;
}

/* ============================================================
   FORM CONTROLS
   ============================================================ */
input[type=text], input[type=number], input[type=password],
textarea, select {
  width: 100%; padding: 12px 14px; font-size: 14px;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--txt);
  font-family: inherit;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  resize: vertical;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
textarea {
  font-family: var(--mono); min-height: 130px; line-height: 1.6;
}
input:hover, textarea:hover, select:hover { border-color: var(--line-strong); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: var(--ring); background: var(--black);
}
select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px;
}

/* checkboxes */
input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; vertical-align: -2px; cursor: pointer; }
label:has(> input[type=checkbox]) { color: var(--muted); font-size: 13.5px; cursor: pointer; transition: color var(--t); }
label:has(> input[type=checkbox]:checked) { color: var(--txt); }

/* range */
input[type=range] {
  -webkit-appearance: none; appearance: none; height: 6px; border-radius: 6px;
  background: var(--line); cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent2));
  box-shadow: var(--glow); border: 2px solid var(--bg);
}
input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--bg);
  background: var(--accent2); box-shadow: var(--glow);
}
input[type=color] { border: 1px solid var(--line); border-radius: var(--r-sm); }

.row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 0 auto; }
.grow { flex: 1 1 auto !important; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  all: unset; box-sizing: border-box; cursor: pointer; text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: 11px 20px; border-radius: var(--r-sm);
  font-weight: 600; font-size: 14px; line-height: 1;
  color: #04252b; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--accent2));
  box-shadow: 0 8px 22px -10px rgba(6,182,212,.9);
  transition: transform var(--t), box-shadow var(--t2), filter var(--t);
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, #fff4, transparent 60%);
  opacity: 0; transition: opacity var(--t);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px -12px rgba(34,211,238,.7);
  filter: brightness(1.04);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: translateY(0) scale(.98); }
.btn:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* secondary — dark outlined */
.btn.secondary {
  background: transparent; color: var(--txt);
  border: 1px solid var(--line-strong); box-shadow: none;
}
.btn.secondary:hover {
  background: var(--panel2); border-color: var(--accent2);
  box-shadow: var(--glow); filter: none;
}

/* ghost */
.btn.ghost {
  background: var(--panel); color: var(--txt);
  border: 1px solid var(--line); box-shadow: none;
}
.btn.ghost:hover { background: var(--panel2); border-color: var(--line-strong); box-shadow: none; }

/* sizes */
.btn.sm { padding: 8px 14px; font-size: 13px; }

/* disabled */
.btn:disabled, .btn.disabled {
  opacity: .45; cursor: not-allowed; filter: grayscale(.3);
  transform: none !important; box-shadow: none !important;
}

/* loading */
.btn.loading { color: transparent; pointer-events: none; }
.btn.loading::before {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 15px; height: 15px; margin: -8px 0 0 -8px;
  border: 2px solid rgba(4,37,43,.35); border-top-color: #04252b;
  border-radius: 50%; animation: sp .7s linear infinite;
}

/* ============================================================
   OUTPUT / CODE WELLS
   ============================================================ */
.mono { font-family: var(--mono); }
.out {
  margin-top: var(--s4); background: var(--bg2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: var(--s4); font-family: var(--mono);
  font-size: 13px; white-space: pre-wrap; word-break: break-word;
  line-height: 1.6; min-height: 20px; max-height: 440px; overflow: auto;
}
.out:empty { display: none; }

/* ============================================================
   BADGES / STATUS PILLS
   ============================================================ */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  border: 1px solid transparent;
}
.pill.ok  { background: rgba(34,197,94,.14); color: var(--good); border-color: rgba(34,197,94,.25); }
.pill.err { background: rgba(248,113,113,.14); color: var(--bad); border-color: rgba(248,113,113,.25); }

.hint { color: var(--muted); font-size: 12.5px; margin-top: var(--s2); }
.copied { color: var(--good) !important; }

/* JSON syntax colors (cyan-tuned) */
.jkey  { color: #7dd3fc; }
.jstr  { color: #86efac; }
.jnum  { color: #fbbf77; }
.jbool { color: #f0abfc; }
.jnull { color: var(--muted); }

/* ============================================================
   TOAST / ALERT
   ============================================================ */
#toast {
  position: fixed; bottom: var(--s6); left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: rgba(13,18,28,.92); border: 1px solid var(--line-strong);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: var(--txt); padding: 13px 22px; border-radius: var(--r);
  font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg), var(--glow);
  opacity: 0; pointer-events: none; z-index: 99;
  transition: opacity var(--t2), transform var(--t2);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   STRENGTH METER
   ============================================================ */
.meter {
  height: 8px; border-radius: 6px; background: var(--line);
  overflow: hidden; margin-top: var(--s3);
}
.meter > i {
  display: block; height: 100%; width: 0; border-radius: 6px;
  transition: width var(--t2), background var(--t2);
}

/* ============================================================
   COLOR PICKER
   ============================================================ */
.swatch {
  width: 100%; height: 130px; border-radius: var(--r);
  border: 1px solid var(--line); transition: background var(--t);
}
.chips { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }
.chip {
  padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--bg2); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 13px; cursor: pointer;
  transition: border-color var(--t), transform var(--t);
}
.chip:hover { border-color: var(--accent2); transform: translateY(-2px); }

/* ============================================================
   QR
   ============================================================ */
#qrbox {
  display: grid; place-items: center; padding: var(--s5);
  background: #fff; border-radius: var(--r);
  width: fit-content; margin: var(--s4) auto 0;
  box-shadow: var(--shadow);
}

/* ============================================================
   CHEAT SHEET (tables)
   ============================================================ */
.cheat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--s4);
}
.cheat-cat { padding: var(--s5); }
.cheat-cat h3 {
  font-size: 14px; margin-bottom: var(--s3); font-weight: 700;
  color: var(--accent2); display: flex; align-items: center; gap: var(--s2);
}
.cheat-cat table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cheat-cat td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cheat-cat tr:last-child td { border-bottom: none; }
.cheat-cat tr { transition: background var(--t); }
.cheat-cat tr:hover td { background: rgba(255,255,255,.03); }
.cheat-cat td.cmd { font-family: var(--mono); color: var(--accent2); white-space: nowrap; }
.cheat-cat td.desc { color: var(--muted); }

/* ============================================================
   SPINNER / KBD
   ============================================================ */
.spin {
  display: inline-block; width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.25); border-top-color: var(--accent2);
  border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px;
}
@keyframes sp { to { transform: rotate(360deg); } }

kbd {
  background: var(--panel2); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 6px;
  padding: 1px 6px; font-family: var(--mono); font-size: 12px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.foot {
  border-top: 1px solid var(--line); margin-top: var(--s7);
  padding: var(--s5) 0 0; color: var(--muted); font-size: 13px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--s3);
}
.foot a { color: var(--accent2); text-decoration: none; transition: color var(--t); }
.foot a:hover { color: var(--txt); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1000px) {
  .main { padding: var(--s6) var(--s5) var(--s7); }
  .hero { padding: var(--s5) var(--s5); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row;
    align-items: center; flex-wrap: wrap; gap: var(--s2);
    padding: var(--s3) var(--s4);
  }
  .brand { padding: var(--s2); }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  .nav button { transform: none; }
  .nav button:hover { transform: none; }
  .nav button.active::before { display: none; }
  .side-foot { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .hero__art { display: none; }
}
@media (max-width: 520px) {
  .main { padding: var(--s5) var(--s4) var(--s6); }
  .head h1 { font-size: 23px; }
  .card { padding: var(--s4); }
  .hero__content h2 { font-size: 20px; }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}
