/* CSS Reset and Variables */
:root {
  /* Colors - Modern Dark Theme */
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.5);

  --accent: #8b5cf6;
  --success: #10b981;

  /* Strength Colors */
  --strength-1: #ef4444;
  /* Weak */
  --strength-2: #f59e0b;
  /* Fair */
  --strength-3: #eab308;
  /* Good */
  --strength-4: #10b981;
  /* Strong */
  --strength-5: #059669;
  /* Very Strong */

  --border-color: #334155;
  --input-bg: #0f172a;

  /* Radius & Shadows */
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 15px var(--primary-glow);

  /* Background Gradients */
  --grad-1: hsla(253, 16%, 7%, 1);
  --grad-2: hsla(225, 39%, 30%, 0.2);
  --grad-3: hsla(339, 49%, 30%, 0.2);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background-image:
    radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
    radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 0.2) 0, transparent 50%),
    radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 0.2) 0, transparent 50%);
  background-attachment: fixed;
}

.app-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.app-header {
  text-align: center;
}

.app-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Card */
.main-card {
  background-color: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-main);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 24px;
  backdrop-filter: blur(10px);
}

/* Output Section */
.output-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.password-display-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background-color: var(--input-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  transition: all 0.3s ease;
}

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

.password-output {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: 'Inter', monospace;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 8px 0;
  outline: none;
  width: 100%;
  cursor: pointer;
  text-overflow: ellipsis;
}

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

.icon-button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-button:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.1);
}

.copy-button {
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.copy-button:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px var(--primary-glow);
  transform: translateY(-1px);
}

.copy-button:active {
  transform: translateY(0);
}

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

.strength-meter-bar {
  height: 6px;
  background-color: var(--input-bg);
  border-radius: 3px;
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s ease;
}

.strength-fill[data-level="1"] {
  width: 20%;
  background-color: var(--strength-1);
  box-shadow: 0 0 8px var(--strength-1);
}

.strength-fill[data-level="2"] {
  width: 40%;
  background-color: var(--strength-2);
  box-shadow: 0 0 8px var(--strength-2);
}

.strength-fill[data-level="3"] {
  width: 60%;
  background-color: var(--strength-3);
  box-shadow: 0 0 8px var(--strength-3);
}

.strength-fill[data-level="4"] {
  width: 80%;
  background-color: var(--strength-4);
  box-shadow: 0 0 8px var(--strength-4);
}

.strength-fill[data-level="5"] {
  width: 100%;
  background-color: var(--strength-5);
  box-shadow: 0 0 8px var(--strength-5);
}

.strength-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.strength-text {
  font-weight: 600;
}

.strength-fill[data-level="1"]~.strength-label .strength-text {
  color: var(--strength-1);
}

.strength-fill[data-level="2"]~.strength-label .strength-text {
  color: var(--strength-2);
}

.strength-fill[data-level="3"]~.strength-label .strength-text {
  color: var(--strength-3);
}

.strength-fill[data-level="4"]~.strength-label .strength-text {
  color: var(--strength-4);
}

.strength-fill[data-level="5"]~.strength-label .strength-text {
  color: var(--strength-5);
}

/* Dividers */
.settings-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 20px 0;
}

/* Settings */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
}

.length-value {
  background-color: var(--input-bg);
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* Slider */
.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--input-bg);
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
  transition: transform 0.1s;
}

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

/* Checkboxes */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 400px) {
  .options-grid {
    grid-template-columns: 1fr;
  }
}

.custom-checkbox {
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
  gap: 12px;
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  height: 20px;
  width: 20px;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-checkbox:hover input~.checkmark {
  border-color: var(--primary);
}

.custom-checkbox input:checked~.checkmark {
  background-color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

.checkmark:after {
  content: "";
  display: none;
  width: 4px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.custom-checkbox input:checked~.checkmark:after {
  display: block;
}

.advanced-options {
  margin-top: 4px;
}

/* Generate Button */
.action-section {
  margin-top: 24px;
}

.generate-button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.generate-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.generate-button:active {
  transform: translateY(0);
}

/* History Section */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-header h3 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
}

.history-badge {
  font-size: 0.7rem;
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

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

.history-list li {
  background-color: var(--input-bg);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid transparent;
}

.history-list li.history-empty {
  font-family: 'Inter', sans-serif;
  text-align: center;
  justify-content: center;
  font-style: italic;
  opacity: 0.5;
}

.history-item-copy {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
}

.history-list li:hover .history-item-copy {
  opacity: 1;
}

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

/* Demo Reset */
.demo-reset-section {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.reset-button {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.reset-button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

/* Footer */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--success);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 1000;
}

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