/* =============================================================================
   PASSWORD GENERATOR — tool.css
   Desktop-first. Single @media block for mobile (≤850px).
   ============================================================================= */

*, *::before, *::after { box-sizing: border-box !important; }

input, textarea, select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box !important;
}

/* ── TOOL CARD — desktop 2-column grid ──────────────────────────────────── */
.pw-tool {
  display: grid;
  grid-template-columns: minmax(340px, 1.2fr) minmax(300px, 1fr);
  align-items: start;
  gap: 2rem;
  width: 100%;
  max-width: 860px;
  padding: var(--space-3);
  padding-bottom: 3rem;
  margin-bottom: 7rem;
  text-align: left;
}

/* ── OPTIONS PANEL (left) ───────────────────────────────────────────────── */
.pw-options {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pw-options h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 0.75rem 0;
  font-weight: 600;
}

/* Length slider */
.pw-length-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.pw-length-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pw-length-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 2.5ch;
  text-align: right;
}

input[type="range"].pw-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--fill, 28%),
    rgba(255,255,255,0.12) var(--fill, 28%),
    rgba(255,255,255,0.12) 100%
  );
  outline: none;
  cursor: pointer;
  border: none;
  padding: 0;
  margin: 0;
}

input[type="range"].pw-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.25), 0 2px 6px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: box-shadow 0.15s;
}

input[type="range"].pw-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.25), 0 2px 6px rgba(0,0,0,0.4);
  cursor: pointer;
  border: none;
}

input[type="range"].pw-slider:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(139,92,246,0.4), 0 2px 6px rgba(0,0,0,0.4);
}

/* Checkboxes */
.pw-checks {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pw-check-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color 0.15s;
}

.pw-check-label:hover {
  color: var(--text-primary);
}

.pw-check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  border-radius: 4px;
}

.pw-check-mono {
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: auto;
  padding-left: 0.5rem;
}

/* Ambiguous toggle row */
.pw-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin-top: 0.25rem;
}

.pw-toggle-row > label:first-of-type {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.88rem;
  flex: 1;
  line-height: 1.4;
}

/* Toggle switch */
.pw-toggle {
  position: relative;
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  height: 22px;
  flex-shrink: 0;
  flex-grow: 0;
  flex: none;
}

.pw-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.pw-toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background: rgba(255,255,255,0.12);
  transition: background 0.2s;
  cursor: pointer;
}

.pw-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s, background 0.2s;
  pointer-events: none;
}

.pw-toggle input:checked ~ .pw-toggle-track { background: var(--accent); }
.pw-toggle input:checked ~ .pw-toggle-thumb { transform: translateX(18px); background: #fff; }
.pw-toggle input:focus-visible ~ .pw-toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── OUTPUT PANEL (right) ───────────────────────────────────────────────── */
.pw-output {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 5rem;
}

/* Password display */
.pw-display-wrap {
  position: relative;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.1);
  transition: border-color 0.2s;
}

.pw-display-wrap:focus-within {
  border-color: rgba(139,92,246,0.5);
}

.pw-display {
  width: 100%;
  padding: 1rem;
  padding-right: 3rem;
  font-family: var(--font-mono, 'Courier New', monospace);
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  overflow-wrap: break-word;
  word-break: break-all;
  min-height: 4.5rem;
  line-height: 1.5;
  cursor: text;
}

.pw-display::selection {
  background: rgba(139,92,246,0.35);
}

.pw-display-empty {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

/* ── STRENGTH INDICATOR ─────────────────────────────────────────────────── */
.pw-strength {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pw-strength-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  height: 5px;
}

.pw-strength-bar {
  border-radius: 2px;
  background: rgba(255,255,255,0.1);
  transition: background 0.3s;
}

.pw-strength-bar.active-1 { background: #ef4444; }
.pw-strength-bar.active-2 { background: #f97316; }
.pw-strength-bar.active-3 { background: #eab308; }
.pw-strength-bar.active-4 { background: #22c55e; }

.pw-strength-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pw-strength-text {
  font-weight: 600;
  font-size: 0.82rem;
}

.pw-strength-text.level-1 { color: #ef4444; }
.pw-strength-text.level-2 { color: #f97316; }
.pw-strength-text.level-3 { color: #eab308; }
.pw-strength-text.level-4 { color: #22c55e; }

.pw-entropy-text {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ── ACTION BUTTONS ─────────────────────────────────────────────────────── */
.pw-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Copy feedback */
.pw-copy-tick {
  display: none;
  color: #22c55e;
  font-size: 0.8rem;
  text-align: center;
  margin-top: -0.25rem;
  animation: fadeInUp 0.2s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── OPTION DIVIDER ─────────────────────────────────────────────────────── */
.pw-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 0.25rem 0;
}

/* ── NO CHARS WARNING ───────────────────────────────────────────────────── */
.pw-no-chars {
  font-size: 0.82rem;
  color: #f97316;
  padding: 0.5rem;
  border-radius: 6px;
  background: rgba(249,115,22,0.08);
  border: 1px solid rgba(249,115,22,0.2);
  display: none;
}

/* ── MOBILE ─────────────────────────────────────────────────────────────── */
@media (max-width: 850px) {
  .pw-tool {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: var(--space-2);
    padding-bottom: 2rem;
    margin-bottom: 4rem;
    max-width: 100%;
  }

  .pw-output {
    position: static;
  }
}

/* ── USP pills — force single row, no wrap, correct font size ──────────── */
.u-usp-row {
  flex-wrap: nowrap !important;
  gap: 0.35rem !important;
  justify-content: center;
}

.u-usp-pill {
  white-space: nowrap;
  /* font-size intentionally NOT overridden — pills match hero subtitle via --hero-text-size */
  padding: 0.28em 0.75em !important; /* slightly tighter padding to help fit 4 pills */
}

@media (max-width: 600px) {
  .u-usp-row {
    flex-wrap: wrap !important;
  }
}
