/* ============================================================
   BASE & RESET
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  font-size: 10px; /* base: 1rem = 10px */

  /* Paleta azul/fría */
  --color-bg:          #0d1117;
  --color-surface:     #161b22;
  --color-surface-2:   #1c2333;
  --color-border:      #30363d;
  --color-accent:      #3b82f6;
  --color-accent-hover:#2563eb;
  --color-accent-light:#60a5fa;
  --color-text:        #e6edf3;
  --color-text-muted:  #8b949e;
  --color-white:       #ffffff;

  /* Fortaleza */
  --color-weak:    #ef4444;
  --color-fair:    #f97316;
  --color-good:    #eab308;
  --color-strong:  #22c55e;

  /* Espaciado */
  --radius:  1.2rem;
  --radius-sm: 0.8rem;
  --shadow:  0 0.8rem 3.2rem rgba(0, 0, 0, 0.4);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 1.6rem;
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.4rem 1.6rem;
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(96, 165, 250, 0.06) 0%, transparent 60%);
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.main-container {
  width: 100%;
  max-width: 52rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ============================================================
   ENCABEZADO
   ============================================================ */
.app-header {
  text-align: center;
  padding: 0.8rem 0;
}

.app-title {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--color-accent-light), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-subtitle {
  font-size: 1.4rem;
  color: var(--color-text-muted);
  margin-top: 0.4rem;
}

/* ============================================================
   SECCIÓN CONTRASEÑA
   ============================================================ */
.password-section {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2.4rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

/* Display de la contraseña */
.password-display-wrapper {
  display: flex;
  align-items: center;
  background-color: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s;
}

.password-display-wrapper:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.password-output {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text);
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 1.4rem 1.6rem;
  min-width: 0;
}

.password-output::placeholder {
  color: var(--color-text-muted);
  font-weight: 400;
  letter-spacing: normal;
  font-size: 1.5rem;
}

/* Botón ojo */
.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 1.2rem 1.4rem;
  font-size: 1.8rem;
  line-height: 1;
  transition: opacity 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.btn-icon:hover {
  opacity: 0.8;
  transform: scale(1.1);
}

/* Acciones */
.password-actions {
  display: flex;
  gap: 1rem;
}

/* Botones */
.btn {
  flex: 1;
  padding: 1.2rem 2rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
  letter-spacing: 0.02em;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-white);
}

.btn-primary:hover {
  background-color: var(--color-accent-hover);
  box-shadow: 0 0.4rem 1.6rem rgba(59, 130, 246, 0.35);
}

.btn-secondary {
  background-color: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background-color: var(--color-border);
}

/* ============================================================
   INDICADOR DE FORTALEZA
   ============================================================ */
.strength-wrapper {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.strength-bars {
  display: flex;
  gap: 0.5rem;
  flex: 1;
}

.strength-bar {
  flex: 1;
  height: 0.5rem;
  border-radius: 9999px;
  background-color: var(--color-border);
  transition: background-color 0.4s ease;
}

/* Estados activos de las barras */
.strength-bar.active-weak   { background-color: var(--color-weak); }
.strength-bar.active-fair   { background-color: var(--color-fair); }
.strength-bar.active-good   { background-color: var(--color-good); }
.strength-bar.active-strong { background-color: var(--color-strong); }

.strength-label {
  font-size: 1.3rem;
  font-weight: 600;
  min-width: 7rem;
  text-align: right;
  color: var(--color-text-muted);
  transition: color 0.3s;
}

.strength-label.weak   { color: var(--color-weak); }
.strength-label.fair   { color: var(--color-fair); }
.strength-label.good   { color: var(--color-good); }
.strength-label.strong { color: var(--color-strong); }

/* ============================================================
   TOAST / NOTIFICACIÓN
   ============================================================ */
.toast {
  font-size: 1.3rem;
  color: var(--color-strong);
  font-weight: 600;
  text-align: center;
  min-height: 1.8rem;
  opacity: 0;
  transform: translateY(0.4rem);
  transition: opacity 0.3s, transform 0.3s;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   SECCIÓN OPCIONES
   ============================================================ */
.options-section {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2.4rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.option-label {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.option-value {
  color: var(--color-accent-light);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 2.5ch;
  display: inline-block;
}

/* Slider */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.6rem;
  background: var(--color-surface-2);
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid var(--color-border);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  transition: background 0.2s, box-shadow 0.2s;
}

.slider::-webkit-slider-thumb:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.3);
}

.slider::-moz-range-thumb {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
  color: var(--color-text-muted);
}

/* Fieldset */
.option-fieldset {
  border: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.fieldset-legend {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 1rem;
}

/* Toggle labels */
.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s;
  user-select: none;
}

.toggle-label:hover {
  background-color: var(--color-surface-2);
}

.toggle-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.toggle-name {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--color-text);
}

.toggle-example {
  font-size: 1.2rem;
  color: var(--color-text-muted);
  font-family: 'Courier New', monospace;
}

/* Switch toggle */
.toggle-switch {
  position: relative;
  width: 4.8rem;
  height: 2.6rem;
  flex-shrink: 0;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background-color: var(--color-border);
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 0.25s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 2rem;
  height: 2rem;
  left: 0.3rem;
  top: 0.3rem;
  background-color: var(--color-white);
  border-radius: 50%;
  transition: transform 0.25s;
}

.toggle-input:checked + .toggle-slider {
  background-color: var(--color-accent);
}

.toggle-input:checked + .toggle-slider::before {
  transform: translateX(2.2rem);
}

.toggle-input:focus-visible + .toggle-slider {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 2px;
}

/* Advertencia */
.warning-msg {
  font-size: 1.4rem;
  color: var(--color-fair);
  background-color: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: var(--radius-sm);
  padding: 1rem 1.4rem;
  animation: fadeIn 0.3s ease;
}

/* ============================================================
   ANIMACIONES
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-0.4rem); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
  50%       { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.2); }
}

.password-section {
  animation: fadeIn 0.4s ease;
}

.options-section {
  animation: fadeIn 0.5s ease;
}

.btn-primary:focus-visible {
  animation: pulse-glow 1.5s infinite;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .app-title {
    font-size: 2.2rem;
  }

  .password-section,
  .options-section {
    padding: 1.8rem 1.6rem;
  }

  .password-output {
    font-size: 1.4rem;
  }

  .password-actions {
    flex-direction: column;
  }

  .btn {
    padding: 1.4rem 2rem;
  }
}
