/* Catronics Lab — Tools UI Kit
   SPECULATIVE: the engineering-tools surface is described in the brief but
   NOT present in the production codebase. Visual foundations follow the
   marketing site exactly. */
@import url("../colors_and_type.css");

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
button, input, select { font-family: inherit; }

.noise {
  position: fixed; inset: 0; pointer-events: none; opacity: 0.06; mix-blend-mode: overlay; z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.6'/></svg>");
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 2;
}

/* ------- SIDEBAR ------- */
.side {
  border-right: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(15,23,42,0.4), rgba(0,0,0,0.55));
  padding: 24px 1px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side-head { display: flex; align-items: center; gap: 10px; padding-bottom: 18px; border-bottom: 1px dashed rgba(255,255,255,0.12); margin-bottom: 18px; }
.side-mark { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, rgba(106,13,173,0.35), rgba(106,13,173,0.10)); border: 1px solid rgba(106,13,173,0.5); box-shadow: 0 0 20px rgba(106,13,173,0.35); }
.side-mark img { width: 22px; filter: drop-shadow(0 0 6px rgba(106,13,173,0.6)); }
.side-wm { font-family: var(--font-display); font-weight: 900; font-size: 14px; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1; }
.side-wm .dot { color: var(--primary); }
.side-tag { font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.22em; color: var(--ink-dim); margin-top: 3px; text-transform: uppercase; }

.side-section { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-dim); padding: 14px 6px 8px; }

.side-mark-link, .side-wm-link { text-decoration: none; color: inherit; display: block; }
.side-back {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 6px;
  border: 1px dashed rgba(154,100,230,0.35);
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--primary-2);
  transition: background .2s ease, color .2s ease, border-color .2s ease;
  cursor: pointer;
  text-decoration: none;
}
.side-back:hover { background: rgba(106,13,173,0.10); color: #fff; border-color: var(--primary-2); }
.side-back span:first-child { font-size: 13px; }
.side-link {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 10px; border: 1px solid transparent; cursor: pointer; position: relative;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.10em;
  color: var(--ink-dim); text-transform: uppercase;
  transition: background .25s, color .25s, border-color .25s;
}
.side-link .gly { font-family: var(--font-mono); color: var(--primary-2); font-size: 14px; text-align: center; }
.side-link .arr { color: var(--ink-faint); opacity: 0; transition: opacity .25s, transform .25s; }
.side-link:hover { background: rgba(106,13,173,0.08); color: #fff; }
.side-link:hover .arr { opacity: 1; transform: translateX(2px); }
.side-link.active { background: rgba(106,13,173,0.18); border-color: rgba(106,13,173,0.55); color: #fff; box-shadow: inset 2px 0 0 var(--primary-2); }
.side-link.active .gly { color: #fff; }
.side-link.active .arr { color: var(--primary-2); opacity: 1; }

.side-foot { margin-top: auto; padding-top: 18px; border-top: 1px dashed rgba(255,255,255,0.12); font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.22em; color: var(--ink-faint); text-transform: uppercase; }

/* ------- MAIN ------- */
.main { padding: 32px 40px 48px; min-width: 0; position: relative; overflow: hidden; }
.main::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 90% -10%, rgba(106,13,173,0.18), transparent 50%); }

.tool-head {
  display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: end;
  padding-bottom: 22px; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 32px;
  position: relative; z-index: 1;
}
.tool-head .id { color: var(--primary-2); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.20em; border-top: 1px solid var(--primary-2); padding-top: 8px; min-width: 110px; }
.tool-head h1 { font-family: var(--font-display); font-weight: 900; font-size: clamp(40px, 5vw, 64px); line-height: 1; margin: 0; text-transform: uppercase; letter-spacing: 0.02em; white-space: pre-line; }
.tool-head .meta { color: var(--ink-dim); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.20em; text-transform: uppercase; text-align: right; }

.tool-sub {
  color: var(--ink-dim); font-size: 14px; line-height: 1.55; max-width: 620px;
  margin: -20px 0 26px; padding-left: 12px; border-left: 1px solid var(--line-strong);
  position: relative; z-index: 1;
}

.panels {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 28px;
  position: relative; z-index: 1;
}

.panel {
  position: relative; border: 1px solid rgba(255,255,255,0.10);
  background: radial-gradient(ellipse at top right, rgba(106,13,173,0.14), transparent 60%), linear-gradient(180deg, rgba(15,23,42,0.5), rgba(0,0,0,0.55));
  padding: 24px 26px; overflow: hidden;
}
.panel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(to right, rgba(154,100,230,0.06) 1px, transparent 1px),
                    linear-gradient(to bottom, rgba(154,100,230,0.06) 1px, transparent 1px);
  background-size: 28px 28px; mask-image: radial-gradient(ellipse at top right, #000, transparent 70%);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px dashed rgba(255,255,255,0.18); padding-bottom: 12px; margin-bottom: 18px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  position: relative; z-index: 1;
}
.panel-head .left  { color: var(--ink-dim); }
.panel-head .right { color: var(--primary-2); display: flex; align-items: center; gap: 8px; }
.panel-head .right .ddd { width: 6px; height: 6px; border-radius: 50%; background: #7CFFB2; box-shadow: 0 0 10px #7CFFB2; }
.panel-body { position: relative; z-index: 1; }

/* Inputs */
.field {
  display: grid; grid-template-columns: 110px 1fr 60px;
  gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px dashed rgba(255,255,255,0.10);
}
.field:last-child { border-bottom: none; }
.field-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.20em; color: var(--ink-dim); text-transform: uppercase; }
.field-input {
  background: transparent; border: 0; outline: 0;
  border-bottom: 1px solid rgba(255,255,255,0.18); padding: 8px 2px;
  color: #fff; font-family: var(--font-mono); font-size: 16px; letter-spacing: 0.02em;
  width: 100%; text-align: right; transition: border-color .25s;
}
.field-input:focus { border-bottom-color: var(--primary-2); }
.field-unit { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.10em; color: var(--primary-2); text-align: right; text-transform: uppercase; }
.field.locked .field-input { color: var(--primary-2); border-bottom-style: dashed; }
.field.locked .field-label { color: var(--primary-2); }

/* Result row big number */
.result {
  display: flex; align-items: end; justify-content: space-between;
  margin-top: 18px; padding: 18px 22px;
  background: linear-gradient(180deg, rgba(106,13,173,0.10), transparent 90%);
  border: 1px solid rgba(106,13,173,0.55);
}
.result .lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; color: var(--ink-dim); text-transform: uppercase; }
.result .v {
  font-family: var(--font-display); font-weight: 900;
  font-size: 48px; letter-spacing: 0.02em; line-height: 1;
}
.result .v small { color: var(--primary-2); font-size: 0.45em; vertical-align: super; margin-left: 6px; }

/* Spec panel mini */
.spec-row {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim);
}
.spec-row b { color: #fff; font-weight: 500; }

/* CTA / button */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  background: var(--primary); color: #fff; border: 1px solid rgba(255,255,255,0.08);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  box-shadow: 0 0 0 1px rgba(106,13,173,0.6), 0 8px 30px rgba(106,13,173,0.35);
  cursor: pointer; transition: background .2s, transform .2s;
}
.btn:hover { background: var(--primary-2); transform: translateY(-1px); }
.btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,0.18); box-shadow: none; color: #fff; }
.btn.ghost:hover { background: rgba(106,13,173,0.18); }

/* Lock toggles */
.field-actions { display: flex; gap: 6px; justify-content: center; }
.lockbtn {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.18);
  background: transparent; color: var(--ink-dim);
  font-family: var(--font-mono); font-size: 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.lockbtn.on { border-color: var(--primary-2); color: var(--primary-2); background: rgba(106,13,173,0.16); }

/* Resistor calculator-specific */
.resistor-svg-wrap {
  display: flex; justify-content: center; padding: 32px 0 20px;
}
.bands-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px;
}
.band-select {
  display: flex; flex-direction: column; gap: 6px;
}
.band-select label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.20em; color: var(--ink-dim); text-transform: uppercase; }
.band-select select {
  background: rgba(0,0,0,0.4); color: #fff; border: 1px solid rgba(255,255,255,0.14);
  padding: 8px 10px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  appearance: none; -webkit-appearance: none;
}
.band-select select:focus { outline: none; border-color: var(--primary-2); }
.swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; vertical-align: middle; margin-right: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,0.10); }

/* Conversion grid */
.conv {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 8px;
}
.conv-card {
  border: 1px solid rgba(255,255,255,0.10);
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(15,23,42,0.4), rgba(0,0,0,0.45));
}
.conv-card .h {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.22em;
  color: var(--ink-dim); text-transform: uppercase; margin-bottom: 8px;
}
.conv-card .v {
  font-family: var(--font-display); font-weight: 700;
  font-size: 26px; letter-spacing: 0.02em; line-height: 1; color: #fff;
}
.conv-card .v small { color: var(--primary-2); font-size: 0.5em; margin-left: 6px; }

/* Empty-state placeholder used by unbuilt tools */
.placeholder {
  border: 1px dashed rgba(255,255,255,0.18); padding: 28px;
  text-align: center;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.22em;
  color: var(--ink-dim); text-transform: uppercase;
}
.placeholder .glyph {
  width: 48px; height: 48px; border-radius: 8px;
  border: 1px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center;
  color: var(--primary-2); font-size: 18px; margin-bottom: 14px;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  /* Sidebar collapses to a horizontal strip on tablet/mobile */
  .side {
    position: relative; height: auto;
    border-right: none; border-bottom: 1px solid var(--hairline);
    padding: 16px 14px;
    overflow-x: auto; overflow-y: hidden;
  }
  .side-head { padding-bottom: 12px; margin-bottom: 12px; }
  .side-back { display: inline-flex; padding: 8px 12px; margin: 0 0 12px; font-size: 9px; }
  .side-section { padding: 8px 4px 6px; font-size: 8px; }
  .side-link { padding: 8px 10px; font-size: 10px; grid-template-columns: 22px 1fr auto; gap: 8px; }
  .side-link .gly { font-size: 12px; }
  .side-foot { display: none; }

  /* Main pane */
  .main { padding: 24px 18px 36px; }
  .tool-head { grid-template-columns: 1fr; gap: 8px; padding-bottom: 16px; margin-bottom: 22px; }
  .tool-head h1 { font-size: clamp(28px, 7vw, 40px); }
  .tool-head .meta { text-align: left; }
  .tool-sub { margin: 8px 0 22px; }

  .panels { grid-template-columns: 1fr; gap: 18px; }
  .panel { padding: 18px 16px; }
  .field { grid-template-columns: 100px 1fr 44px; gap: 8px; padding: 10px 0; }
  .field-label { font-size: 9px; letter-spacing: 0.16em; }
  .field-input { font-size: 14px; }
  .result .v { font-size: 36px; }

  /* Resistor color-code bands wrap */
  .bands-row { grid-template-columns: 1fr 1fr !important; }
  .resistor-svg-wrap svg { max-width: 100%; height: auto; }

  /* Conversion cards 2-up */
  .conv { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .side { padding: 12px 10px; }
  .side-head { gap: 10px; }
  .side-mark { width: 28px; height: 28px; }
  .side-mark img { width: 18px; }
  .side-wm { font-size: 12px; }
  .side-tag { font-size: 7px; }

  .main { padding: 20px 14px 32px; }
  .tool-head h1 { font-size: clamp(24px, 8vw, 32px); }
  .tool-sub { font-size: 13px; padding-left: 10px; }

  .panel { padding: 16px 14px; }
  .field { grid-template-columns: 1fr; gap: 4px; }   /* stack label / input / unit on tiny screens */
  .field-label { font-size: 9px; }
  .field-input { font-size: 14px; text-align: left; }
  .field-unit { text-align: left; }
  .field-actions { grid-column: 1 / 2 !important; justify-content: flex-start !important; }
  .result .v { font-size: 28px; }

  .bands-row { grid-template-columns: 1fr !important; }
  .conv { grid-template-columns: 1fr; }
}

/* --- PERSONALIZACIÓN DEL SCROLLBAR --- */

/* 1. Para navegadores como Chrome, Edge y Safari */
::-webkit-scrollbar {
  width: 8px; /* Ancho de la barra vertical */
  height: 8px; /* Alto de la barra horizontal (si la hay) */
}

/* El "carril" por donde se mueve la barra */
::-webkit-scrollbar-track {
  background: #09090b; /* El mismo fondo oscuro de tu sitio */
  border-left: 1px solid #1f1f1f; /* Una línea sutil para separarlo */
}

/* La barra deslizable en sí */
::-webkit-scrollbar-thumb {
  background: #333333; /* Un gris oscuro por defecto */
  border-radius: 4px; /* Bordes ligeramente redondeados */
}

/* El efecto al pasar el mouse sobre la barra */
::-webkit-scrollbar-thumb:hover {
  background: #9d4edd; /* Tu color morado neón brillante */
}

/* 2. Soporte básico para Firefox (usa reglas diferentes) */
* {
  scrollbar-width: thin; /* Hace la barra más delgada */
  scrollbar-color: #333333 #09090b; /* color-barra color-fondo */
}