/* ============================================================
   styles.css — Gerador de Senhas (Grifo Tools)
   Responsabilidade: Componentes proprios (slider, checkboxes,
     barra de forca, historico, toast) + dark mode
   ============================================================ */

html { scroll-behavior: smooth; }
:focus { outline: 2px solid #802B22; outline-offset: 2px; }

body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── Range slider ─────────────────────────────────────────── */
.pwd-slider {
  --pct: 14.3%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 9999px;
  background: linear-gradient(
    to right,
    #802B22 0%,
    #802B22 var(--pct),
    #e5e5e5 var(--pct),
    #e5e5e5 100%
  );
  outline: none;
  cursor: pointer;
  width: 100%;
}
.pwd-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #802B22;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 0 0 1px #802B22;
  transition: transform 0.1s ease;
}
.pwd-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
.pwd-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #802B22;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 0 0 1px #802B22;
}

/* ── Checkbox cards ───────────────────────────────────────── */
.checkbox-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: 2px solid #e5e5e5;
  border-radius: 0.75rem;
  background-color: #ffffff;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.checkbox-card:hover {
  border-color: #D47A72;
  background-color: #FAF0EF;
}
.checkbox-card:has(input:checked) {
  border-color: #802B22;
  background-color: #FAF0EF;
}

.checkbox-indicator {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid #d4d4d4;
  background-color: white;
  flex-shrink: 0;
  position: relative;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.checkbox-indicator::after {
  content: '';
  display: none;
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.checkbox-card input:checked ~ .checkbox-indicator {
  background-color: #802B22;
  border-color: #802B22;
}
.checkbox-card input:checked ~ .checkbox-indicator::after {
  display: block;
}

/* ── Campo de senha ───────────────────────────────────────── */
.pwd-output {
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 0.05em;
  caret-color: transparent;
}
.pwd-output:focus {
  outline: 2px solid #802B22;
  outline-offset: 0;
  border-color: transparent;
}

/* ── Botão copiar ─────────────────────────────────────────── */
.copy-btn.copy-success {
  background-color: #f0fdf4;
  border-color: #86efac;
  color: #16a34a;
}

/* ── Barra de força ───────────────────────────────────────── */
.strength-bar-track {
  height: 6px;
  border-radius: 9999px;
  background-color: #e5e5e5;
  overflow: hidden;
}
.strength-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.35s ease, background-color 0.35s ease;
}
.strength-bar-fill.strength-weak        { width: 25%;  background-color: #EF4444; }
.strength-bar-fill.strength-medium      { width: 50%;  background-color: #F09702; }
.strength-bar-fill.strength-strong      { width: 75%;  background-color: #22C55E; }
.strength-bar-fill.strength-very-strong { width: 100%; background-color: #16A34A; }

.strength-label { transition: color 0.35s ease; }
.strength-label.strength-weak        { color: #EF4444; }
.strength-label.strength-medium      { color: #F09702; }
.strength-label.strength-strong      { color: #22C55E; }
.strength-label.strength-very-strong { color: #16A34A; }

/* ── Histórico ────────────────────────────────────────────── */
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid #e5e5e5;
  border-radius: 0.625rem;
  background-color: #f9fafb;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.history-item:hover {
  background-color: #FAF0EF;
  border-color: #D47A72;
}
.history-password {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8125rem;
  color: #404040;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-copy-icon {
  color: #a3a3a3;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: color 0.15s ease;
}
.history-item:hover .history-copy-icon {
  color: #802B22;
}

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: #171717;
  color: #f5f5f5;
  padding: 0.5rem 1.25rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

/* ── Dark mode ────────────────────────────────────────────── */
html.dark body { background-color: #0f0f0f; color: #f5f5f5; }

html.dark .bg-white          { background-color: #1a1a1a; }
html.dark .bg-neutral-50     { background-color: #141414; }
html.dark .bg-neutral-100    { background-color: #222222; }

html.dark .border-neutral-200 { border-color: #2a2a2a; }
html.dark .border-neutral-300 { border-color: #333333; }

html.dark .text-neutral-900  { color: #f5f5f5; }
html.dark .text-neutral-800  { color: #e5e5e5; }
html.dark .text-neutral-700  { color: #d4d4d4; }
html.dark .text-neutral-600  { color: #a3a3a3; }
html.dark .text-neutral-500  { color: #a0a0a0; }
html.dark .text-neutral-400  { color: #737373; }

html.dark .pwd-slider {
  background: linear-gradient(
    to right,
    #D47A72 0%,
    #D47A72 var(--pct),
    #333333 var(--pct),
    #333333 100%
  );
}
html.dark .pwd-slider::-webkit-slider-thumb {
  background: #D47A72;
  box-shadow: 0 0 0 1px #D47A72;
}
html.dark .pwd-slider::-moz-range-thumb {
  background: #D47A72;
  box-shadow: 0 0 0 1px #D47A72;
}

html.dark .checkbox-card {
  background-color: #1a1a1a;
  border-color: #2a2a2a;
}
html.dark .checkbox-card:hover {
  border-color: #802B22;
  background-color: #1a0d0b;
}
html.dark .checkbox-card:has(input:checked) {
  border-color: #802B22;
  background-color: #1a0d0b;
}
html.dark .checkbox-card .text-neutral-800 { color: #e5e5e5; }
html.dark .checkbox-card .text-neutral-400 { color: #737373; }
html.dark .checkbox-indicator {
  background-color: #1a1a1a;
  border-color: #3a3a3a;
}
html.dark .checkbox-card input:checked ~ .checkbox-indicator {
  background-color: #D47A72;
  border-color: #D47A72;
}

html.dark .pwd-output {
  background-color: #141414;
  border-color: #2a2a2a;
  color: #f5f5f5;
}

html.dark .copy-btn {
  background-color: #1a1a1a;
  border-color: #2a2a2a;
  color: #d4d4d4;
}
html.dark .copy-btn:hover:not(.copy-success) {
  background-color: #222222;
}
html.dark .copy-btn.copy-success {
  background-color: #052e16;
  border-color: #166534;
  color: #4ade80;
}

html.dark .strength-bar-track {
  background-color: #2a2a2a;
}

html.dark .history-item {
  background-color: #141414;
  border-color: #2a2a2a;
}
html.dark .history-item:hover {
  background-color: #1a0d0b;
  border-color: #802B22;
}
html.dark .history-password {
  color: #d4d4d4;
}
html.dark .history-copy-icon {
  color: #525252;
}
html.dark .history-item:hover .history-copy-icon {
  color: #D47A72;
}
