/* ==========================================================================
   Clean Minimal Light Theme - Password Generator Stylesheet
   Pure CSS - Zero external dependencies, Neutral Monochrome/Grayscale
   ========================================================================== */

:root {
  /* Clean Light Monochrome / Grayscale Palette */
  --bg-color: #f8fafc;
  --bg-gradient: radial-gradient(circle at 50% 0%, #ffffff 0%, #f1f5f9 100%);
  
  --card-bg: #ffffff;
  --card-surface: #f8fafc;
  --card-sub-bg: #f1f5f9;
  --card-sub-bg-hover: #e2e8f0;
  
  --card-border: #e2e8f0;
  --card-border-subtle: rgba(0, 0, 0, 0.05);
  --card-border-hover: #cbd5e1;
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02), 0 0 0 1px rgba(0, 0, 0, 0.04);
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-dark: #94a3b8;
  
  /* Neutral Charcoal / Slate Monochrome Primary */
  --primary: #1e293b;
  --primary-light: #334155;
  --primary-accent: #0f172a;
  --primary-hover: #0f172a;
  --primary-glow: rgba(15, 23, 42, 0.12);
  
  /* Neutral Monochrome Strength Indicators */
  --strength-very-weak: #64748b;
  --strength-weak: #475569;
  --strength-medium: #334155;
  --strength-strong: #1e293b;
  --strength-very-strong: #0f172a;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-pill: 9999px;
  
  --transition: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 32px 16px 48px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header Section */
.app-header {
  text-align: center;
  padding: 8px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: var(--radius-md);
  color: #ffffff;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
  transition: transform var(--transition);
}

.logo-wrapper:hover {
  transform: scale(1.04);
}

.logo-wrapper svg {
  width: 24px;
  height: 24px;
}

.app-title {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.app-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.security-badge .dot {
  width: 6px;
  height: 6px;
  background-color: var(--text-secondary);
  border-radius: 50%;
}

/* Main Generator Card */
.generator-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: relative;
}

@media (max-width: 480px) {
  .generator-card {
    padding: 18px 16px;
    gap: 18px;
  }
}

/* Display Section */
.display-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.password-display-wrapper {
  position: relative;
  background: var(--card-surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all var(--transition);
  cursor: pointer;
}

.password-display-wrapper:hover {
  border-color: var(--card-border-hover);
  background: #ffffff;
}

.password-display-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.password-text-container {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--card-border) transparent;
  padding-bottom: 2px;
}

.password-text-container::-webkit-scrollbar {
  height: 4px;
}

.password-text-container::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 4px;
}

.password-text {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  white-space: nowrap;
  user-select: all;
  -webkit-user-select: all;
  transition: color var(--transition);
}

.password-text.is-masked {
  letter-spacing: 0.18em;
  color: var(--text-muted);
}

.display-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Action Buttons (Grey Minimalist Buttons) */
.btn-icon {
  background: var(--card-sub-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--card-sub-bg-hover);
  color: var(--text-primary);
  border-color: var(--card-border-hover);
}

.btn-icon:active {
  transform: scale(0.96);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.btn-copy-main {
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  color: var(--text-primary);
  padding: 0 16px;
  height: 40px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-copy-main:hover {
  background: #cbd5e1;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-copy-main:active {
  background: #94a3b8;
  transform: scale(0.97);
}

.btn-copy-main svg {
  width: 16px;
  height: 16px;
}

/* Strength Meter */
.strength-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strength-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.strength-title {
  color: var(--text-muted);
  font-weight: 600;
}

.strength-value {
  font-weight: 700;
  color: var(--text-primary);
  transition: color var(--transition);
}

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

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

.strength-bar-segment {
  height: 100%;
  border-radius: 9999px;
  background-color: var(--card-border);
  transition: background-color 0.28s ease, transform 0.28s ease;
}

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

.crack-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.crack-time strong {
  color: var(--text-secondary);
}

/* Slider Section */
.control-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.length-badge {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--card-sub-bg);
  border: 1px solid var(--card-border);
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  min-width: 42px;
  text-align: center;
}

.range-slider-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  padding: 6px 0;
}

.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  background: var(--card-border);
  outline: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #334155;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  cursor: grab;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #0f172a;
}

.range-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.05);
}

.range-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #334155;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  cursor: grab;
}

.range-presets {
  display: flex;
  gap: 6px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.preset-btn {
  background: var(--card-sub-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 5px 12px;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
}

.preset-btn:hover {
  background: var(--card-sub-bg-hover);
  color: var(--text-primary);
  border-color: var(--card-border-hover);
}

.preset-btn.active {
  background: #334155;
  border-color: #334155;
  color: #ffffff;
  font-weight: 600;
}

/* Options / Switches Section */
.options-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.options-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-row {
  background: var(--card-sub-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  min-height: 48px;
}

.option-row:hover {
  border-color: var(--card-border-hover);
  background: var(--card-sub-bg-hover);
}

.option-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.option-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

.option-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Modern Minimalist Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 9999px;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #334155;
}

.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid #64748b;
  outline-offset: 2px;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* Category Warning */
.category-warning {
  display: none;
  background: #f8fafc;
  border: 1px solid #94a3b8;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.8rem;
  color: #334155;
  align-items: center;
  gap: 8px;
  animation: shake 0.3s ease;
}

.category-warning.is-visible {
  display: flex;
}

.category-warning svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Main Generate Button (Grey Layout) */
.btn-generate {
  width: 100%;
  background: #334155;
  border: 1px solid #1e293b;
  color: #ffffff;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  transition: all var(--transition);
  min-height: 50px;
}

.btn-generate:hover {
  background: #1e293b;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2);
  transform: translateY(-1px);
}

.btn-generate:active {
  background: #0f172a;
  transform: translateY(0);
}

.btn-generate svg {
  width: 18px;
  height: 18px;
  transition: transform 0.4s ease;
}

.btn-generate.is-spinning svg {
  transform: rotate(360deg);
}

/* History Section */
.history-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (max-width: 480px) {
  .history-card {
    padding: 16px 14px;
  }
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.history-badge {
  background: var(--card-sub-bg);
  border: 1px solid var(--card-border);
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.btn-clear-history {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.btn-clear-history:hover {
  color: var(--text-primary);
  background: var(--card-sub-bg-hover);
}

.btn-clear-history svg {
  width: 13px;
  height: 13px;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-empty {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
}

.history-item {
  background: var(--card-sub-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all var(--transition);
}

.history-item:hover {
  border-color: var(--card-border-hover);
  background: var(--card-sub-bg-hover);
}

.history-pass-text {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: all;
  flex: 1;
  cursor: pointer;
}

.history-pass-text:hover {
  color: var(--text-primary);
}

.history-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.history-strength-tag {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-transform: capitalize;
  background-color: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn-copy-history {
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-copy-history:hover {
  background: #cbd5e1;
  color: var(--text-primary);
}

.btn-copy-history svg {
  width: 13px;
  height: 13px;
}

.history-notice {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

/* Footer Section */
.app-footer {
  text-align: center;
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-meta {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.footer-privacy-text {
  color: var(--text-muted);
  font-size: 0.75rem;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.4;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  border: 1px solid #334155;
  color: #f8fafc;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease;
}

.toast-container.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-container svg {
  width: 15px;
  height: 15px;
  color: #e2e8f0;
}

/* Focus and accessibility styles */
:focus-visible {
  outline: 2px solid #334155;
  outline-offset: 2px;
}

/* Custom Selection */
::selection {
  background: #cbd5e1;
  color: #0f172a;
}
