/* Toolbox page — layout + widgets shared by every tool panel.
   Colour tokens, .btn, .panel and .result-box all come from styles.css. */

.app-wide { max-width: 1180px; }

.tools-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
}

/* Grid items default to min-width:auto, which lets the scrolling chip strip
   and wide code/textarea content blow the columns past the viewport. */
.tool-sidebar,
.tool-stage {
  min-width: 0;
}

@media (max-width: 880px) {
  .tools-layout { grid-template-columns: 1fr; }
}

/* ---------- Sidebar ---------- */
.tool-sidebar {
  position: sticky;
  top: 96px;
  background: rgba(23, 26, 33, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}


.tool-search {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  margin-bottom: 10px;
}

.tool-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tool-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tool-link:hover { background: var(--panel-2); }

.tool-link.active {
  background: var(--panel-2);
  border-color: rgba(94, 234, 212, 0.35);
}

.tool-link.active strong { color: var(--accent); }

.tool-emoji { font-size: 19px; line-height: 1; }
.tool-link strong { display: block; font-size: 13.5px; font-weight: 600; }
.tool-link em {
  display: block;
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.tool-group {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 12px 0 4px;
  padding-left: 10px;
  opacity: 0.75;
}

.tool-group:first-child { margin-top: 2px; }

/* Marks the tools that must contact a public service to do their job. */
.ext-badge {
  display: inline-block;
  vertical-align: middle;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fbbf24;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}

/* Big pass/fail result blocks used by the security tools. */
.verdict {
  border-radius: 10px;
  padding: 14px 16px;
  margin: 4px 0 16px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.verdict.good {
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
}

.verdict.bad {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}

.verdict.warn {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fcd34d;
}

.verdict-big {
  display: block;
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* Findings lists — used by every analyzer that returns level/title/detail. */
.finding-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 0;
}

.finding-list:not(:empty) { margin-bottom: 16px; }

.finding {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 10px;
  padding: 11px 14px;
}

.finding strong {
  display: block;
  font-size: 13.5px;
  margin-bottom: 3px;
}

.finding span {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.finding.danger, .finding.bad { border-left-color: var(--danger); }
.finding.danger strong, .finding.bad strong { color: #fca5a5; }
.finding.warn { border-left-color: #fbbf24; }
.finding.warn strong { color: #fcd34d; }
.finding.good { border-left-color: var(--accent-2); }
.finding.good strong { color: #6ee7b7; }
.finding.info { border-left-color: var(--muted); }

/* Letter grade for the security-header report. */
.grade-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.grade-box span:first-child {
  font-family: "Space Grotesk", sans-serif;
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
  min-width: 54px;
  text-align: center;
}

.grade-box span:last-child {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
}

.grade-box.grade-a span:first-child { color: var(--accent-2); }
.grade-box.grade-b span:first-child { color: var(--accent); }
.grade-box.grade-c span:first-child { color: #fbbf24; }
.grade-box.grade-d span:first-child,
.grade-box.grade-f span:first-child { color: var(--danger); }

/* Live TOTP display. */
.totp-display {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
}

.totp-code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--accent);
  line-height: 1;
}

.totp-ring { flex: 1; min-width: 120px; }

.totp-bar {
  height: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.totp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.95s linear;
}

.totp-fill.expiring { background: linear-gradient(90deg, #fbbf24, var(--danger)); }

.totp-seconds {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.breach-item .meta-line {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 5px;
}

.data-classes {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.data-class {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #fca5a5;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
}

.data-class.mild {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.3);
  color: var(--muted);
}

.warn-list {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.warn-list li { margin-bottom: 2px; }

code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}

.kv-row.head {
  background: transparent;
  border-color: transparent;
  padding-bottom: 2px;
}

.no-match {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 10px 0 4px;
  margin: 0;
}

/* ---------- Panels ---------- */
.tool-panel { padding: 24px; }
.tool-panel h2 { margin: 0 0 6px; font-size: 20px; }

.tool-desc {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 20px;
  line-height: 1.6;
}

.grid-2, .grid-3 { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 620px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Form controls ---------- */
textarea,
input[type="text"],
input[type="search"],
input[type="number"],
input[type="file"],
input[type="datetime-local"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: rgba(94, 234, 212, 0.5);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.1);
}

input[readonly], textarea[readonly] { color: var(--accent); }

.mono {
  font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}

.big { font-size: 16px !important; font-weight: 600; }

input[type="color"] {
  width: 100%;
  height: 42px;
  padding: 3px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.color-big { height: 64px; }

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
}

.check-grid input { accent-color: var(--accent); }

.btn-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.btn-row.wrap { flex-wrap: wrap; }

.btn-ghost.inline, .btn-row .btn {
  width: auto;
  margin-top: 0;
  padding: 10px 16px;
  font-size: 14px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 0 0 0 6px;
  text-decoration: underline;
}

.output-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 8px;
}

.output-row input { flex: 1; }
.output-row .btn { width: auto; margin-top: 0; white-space: nowrap; }

.hint {
  color: var(--muted);
  font-size: 12.5px;
  margin: 6px 0 16px;
  line-height: 1.5;
}

.hint.error { color: var(--danger); }
.hint.ok { color: var(--accent-2); }

/* ---------- Key/value result lists ---------- */
.kv-list { display: flex; flex-direction: column; gap: 8px; }

.kv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.kv-key {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  min-width: 92px;
  flex-shrink: 0;
}

.kv-val {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  word-break: break-all;
  flex: 1;
}

.kv-row .link-btn { flex-shrink: 0; }

/* ---------- Tool-specific bits ---------- */
.dropzone.compact { padding: 30px 20px; margin-bottom: 20px; }
.dropzone.compact .dropzone-icon { font-size: 34px; }
.dropzone.compact .dropzone-sub { margin-bottom: 0; }

.img-preview {
  display: block;
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  border-radius: 10px;
  background: #000;
  margin-bottom: 14px;
}

.qr-canvas {
  display: block;
  width: 260px;
  max-width: 100%;
  height: auto;
  margin: 0 auto 14px;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.strength {
  height: 6px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 4px;
}

.strength-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease, background 0.25s ease;
}

.diff-out {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.diff-line {
  display: flex;
  gap: 10px;
  padding: 3px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-line .gutter {
  color: var(--muted);
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.diff-add { background: rgba(52, 211, 153, 0.12); color: #86efac; }
.diff-del { background: rgba(248, 113, 113, 0.12); color: #fca5a5; }
.diff-same { color: var(--muted); }

.diff-summary {
  padding: 10px 12px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  font-family: "Inter", sans-serif;
  font-size: 12.5px;
  color: var(--muted);
}

.regex-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.regex-row .slash { color: var(--muted); font-size: 18px; }
.regex-row input { flex: 1; }
.regex-row .flags { max-width: 90px; flex: none; }

.highlight-box {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  min-height: 60px;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 14px;
  line-height: 1.6;
}

.highlight-box mark {
  background: rgba(94, 234, 212, 0.25);
  color: var(--accent);
  border-radius: 3px;
  padding: 1px 2px;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 8px;
  margin: 10px 0 4px;
}

.swatch {
  height: 56px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 5px;
  font-size: 10px;
  font-family: Menlo, Consolas, monospace;
  cursor: pointer;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  color: #fff;
}

#textStats { flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--panel-2);
  border: 1px solid rgba(94, 234, 212, 0.4);
  color: var(--accent);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Mobile ----------
   Kept last in the file on purpose: these override base rules of equal
   specificity, so source order is what decides the winner. */
@media (max-width: 880px) {
  /* A stacked list would push the actual tool a full screen down, so the
     picker collapses into a horizontally scrollable strip of chips. */
  .tool-sidebar {
    position: sticky;
    top: 58px;
    max-height: none;
    overflow: visible;
    padding: 10px;
    z-index: 20;
  }

  .tool-list {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .tool-list::-webkit-scrollbar { display: none; }

  .tool-link {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    width: auto;
    min-width: 76px;
    padding: 8px 10px;
    text-align: center;
  }

  .tool-link em { display: none; }
  .tool-link strong { font-size: 11px; white-space: nowrap; }

  .tool-panel { padding: 18px; }
  .app-wide { padding-top: 84px; }
}
