/* ============================================
   PASSWORD GENERATOR — additions
      All classes namespaced .pwd-* to match convention.
   ============================================ */

.pwd-generator {
  max-width: 900px;
  margin: 0 auto;
}

/* ===== Password display ===== */
.pwd-display-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  transition: var(--transition);
}

.pwd-display-wrapper:focus-within { border-color: var(--primary); }

.pwd-display {
  flex: 1;
  min-width: 0;
  font-family: 'SF Mono', 'Cascadia Code', 'Roboto Mono', Menlo, Consolas, monospace;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  word-break: break-all;
  overflow-wrap: anywhere;
  user-select: all;
  line-height: 1.5;
}

.pwd-display.pwd-display-active {
  color: var(--text);
  font-weight: 600;
}

.pwd-display-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.pwd-icon-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.pwd-icon-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.06);
}

.pwd-icon-btn.pwd-copied {
  color: var(--success);
  border-color: var(--success);
  background: rgba(var(--success-rgb), 0.1);
}

/* ===== Length slider ===== */
.pwd-length-row {
  margin-bottom: 1.5rem;
}

.pwd-length-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.pwd-length-value {
  font-family: 'SF Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
  padding: 0.15rem 0.6rem;
  border-radius: 6px;
  min-width: 3rem;
  text-align: center;
}

.pwd-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  outline: none;
  cursor: pointer;
}

.pwd-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(var(--shadow-color-rgb), 0.15);
  transition: transform 0.15s ease;
}

.pwd-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }

.pwd-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(var(--shadow-color-rgb), 0.15);
}

/* ===== Charset toggles ===== */
.pwd-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.pwd-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px;
  user-select: none;
}

.pwd-option:hover {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.04);
}

.pwd-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.pwd-option-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.pwd-option-label code {
  font-size: 0.78rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  color: var(--text-muted);
  font-family: 'SF Mono', monospace;
}

/* ===== Custom charset ===== */
.pwd-custom-row {
  margin-bottom: 1.5rem;
}

.pwd-custom-label {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.pwd-custom-label small {
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.4rem;
}

.pwd-custom-input {
  font-family: 'SF Mono', monospace;
  letter-spacing: 0.02em;
}

/* ===== Generate button ===== */
.pwd-generate-btn {
  width: 100%;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  min-height: 52px;
  font-size: 1.05rem;
}

/* ===== Entropy section ===== */
.pwd-entropy {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.pwd-entropy-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.pwd-entropy-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.pwd-entropy-value {
  font-family: 'SF Mono', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}

.pwd-entropy-track {
  position: relative;
  height: 12px;
  background: var(--border);
  border-radius: 999px;
  overflow: visible;
  margin-bottom: 0.5rem;
}

.pwd-entropy-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: 999px;
  width: 0;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
}

.pwd-entropy-marker-quantum {
  position: absolute;
  top: -3px;
  left: 64%; /* 128 bits / 200 = 64% */
  width: 2px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 1px;
  opacity: 0.5;
}

.pwd-entropy-marker-quantum::after {
  content: '128 bits — quantum-ready';
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.pwd-entropy-status {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: right;
  transition: color 0.3s ease;
}

.pwd-entropy-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.pwd-entropy-detail + .pwd-entropy-detail {
  border-left: 1px solid var(--border);
  padding-left: 1.25rem;
}
.pwd-entropy-detail:first-child { padding-right: 1.25rem; }

.pwd-entropy-detail {
  text-align: center;
}

.pwd-entropy-detail-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  align-items: center;
}

.pwd-entropy-detail-label small {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  font-size: 0.65rem;
  opacity: 0.85;
}

.pwd-entropy-detail-value {
  font-family: 'SF Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

/* ===== History ===== */
.pwd-history {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.pwd-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.pwd-history-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  padding: 0.4rem 0;
  min-height: 44px;
}

.pwd-history-toggle-icon {
  display: inline-block;
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.pwd-history-toggle.pwd-history-toggle-open .pwd-history-toggle-icon {
  transform: rotate(90deg);
}

.pwd-history-count {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.85rem;
}

.pwd-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pwd-history-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.pwd-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}

.pwd-history-item:hover { border-color: var(--primary); }

.pwd-history-pwd-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.pwd-history-pwd {
  font-family: 'SF Mono', monospace;
  font-size: 0.9rem;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  padding: 0.2rem 0;
  border-radius: 4px;
  word-break: break-all;
  letter-spacing: 0.02em;
  transition: color 0.15s ease;
  outline: none;
}

.pwd-history-pwd:hover, .pwd-history-pwd:focus { color: var(--primary); }

.pwd-history-pwd[data-revealed="true"] {
  user-select: all;
}

.pwd-history-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pwd-history-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.pwd-history-action {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.pwd-history-action:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.pwd-history-action[data-act="delete"]:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* ===== Mobile (< 600px) ===== */
@media (max-width: 600px) {
  .pwd-display { font-size: 1rem; }
  .pwd-options { grid-template-columns: 1fr; }
  .pwd-entropy-details { grid-template-columns: 1fr; gap: 0.5rem; }
  .pwd-entropy-detail { text-align: left; padding: 0.5rem 0; border-bottom: 1px dashed var(--border); }
  .pwd-entropy-detail:last-child { border-bottom: none; }
  .pwd-entropy-detail-label { flex-direction: row; gap: 0.3rem; }
  .pwd-entropy-marker-quantum::after { font-size: 0.6rem; }
  .pwd-history-item { flex-direction: column; align-items: stretch; }
  .pwd-history-actions { justify-content: flex-end; }
}

.affiliate-section { margin-top: 2rem; }
.affiliate-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.45; margin: 0 0 0.6rem; }

.pwd-sponsored-card {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  display: flex;
  font-size: 0.9rem;
  gap: 0.75rem;
  padding: 1rem;
  text-decoration: none;
  transition: var(--transition);
}

.pwd-sponsored-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.pwd-sponsored-card span:first-child {
  flex-shrink: 0;
  font-size: 1.5rem;
}

.pwd-sponsored-card strong {
  color: var(--text);
  display: block;
  font-weight: 600;
}

.pwd-sponsored-card span:last-child {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Mode tabs */
.pwd-mode-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--input-bg, var(--surface));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem;
  margin-bottom: 1.25rem;
  width: fit-content;
}
.pwd-mode-tab {
  flex: 1;
  padding: 0.45rem 1.25rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.pwd-mode-tab--active {
  background: var(--primary);
  color: var(--on-primary);
}
.pwd-mode-tab:not(.pwd-mode-tab--active):hover { background: var(--border); color: var(--text); }

/* Passphrase options */
.pwd-pp-options { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.75rem; }
/* Analyze mode */
.pwd-analyze-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.pwd-analyze-input {
  flex: 1;
  font-family: monospace;
  font-size: 1rem;
  letter-spacing: 0.05em;
}
.pwd-analyze-tips {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.75rem;
  margin-bottom: 1.5rem;
}
.pwd-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
}
.pwd-tip-icon { font-weight: 700; flex-shrink: 0; width: 1rem; text-align: center; }
.pwd-tip--ok    { background: #dcfce7; color: #166534; }
.pwd-tip--warn  { background: #fef9c3; color: #854d0e; }
.pwd-tip--error { background: #fee2e2; color: #991b1b; }
@media (prefers-color-scheme: dark) {
  .pwd-tip--ok    { background: #14532d; color: #86efac; }
  .pwd-tip--warn  { background: #422006; color: #fde68a; }
  .pwd-tip--error { background: #450a0a; color: #fca5a5; }
}

.pwd-pp-select {
  display: block;
  margin-top: 0.3rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg, var(--surface));
  color: var(--text);
  font-size: 0.875rem;
}
