/* Base Styles and Variables */
:root {
  /* Modern Color Palette */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border: rgba(203, 213, 225, 0.4);
  --error: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  
  /* Dark Mode Colors */
  --dark-surface: #0f172a;
  --dark-surface-alt: #1e293b;
  --dark-text-primary: #f8fafc;
  --dark-text-secondary: #cbd5e1;
  --dark-border: rgba(71, 85, 105, 0.4);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0px 4px 6px rgba(0, 0, 0, 0.05), 0px 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0px 10px 15px rgba(0, 0, 0, 0.05), 0px 4px 6px rgba(0, 0, 0, 0.05);
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Animation */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.3s ease, color 0.3s ease;
  padding: 16px;
}

/* Container Styles */
.container {
  width: 100%;
  max-width: 420px;
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 0;
}

/* Header Styles */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  height: 28px;
  width: auto;
}

h1 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* Password Display */
.password-display {
  padding: 24px;
  position: relative;
}

.password-field {
  background-color: var(--surface-alt);
  color: var(--text-primary);
  font-family: 'Inter', monospace;
  letter-spacing: 1px;
  padding: 20px 16px;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 1.125rem;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  word-break: break-all;
  position: relative;
  border: 1px solid var(--border);
}

.password-actions {
  position: absolute;
  right: 38px;
  bottom: 38px;
  display: flex;
  gap: 8px;
}

.icon-button {
  background-color: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.icon-button:hover {
  background-color: var(--primary-light);
  color: white;
  transform: translateY(-2px);
}

/* Strength Indicator */
#strength-indicator {
  padding: 0 24px 24px;
}

.strength-wrapper {
  height: 8px;
  background-color: var(--surface-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}

#strength-bar {
  height: 100%;
  width: 0;
  border-radius: var(--radius-full);
  transition: width 0.6s ease, background-color 0.6s ease;
}

#strength-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: block;
  text-align: center;
}

/* Controls Section */
.controls {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-top: 1px solid var(--border);
}

.controls-section {
  display: flex;
  flex-direction: column;
}

/* Character Type Options */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Toggle Button Styles */
.toggle-button {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: var(--surface-alt);
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background-color var(--transition-normal);
}

.toggle-button::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  background-color: white;
  border-radius: var(--radius-full);
  top: 2px;
  left: 3px;
  transition: transform var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.toggle-button.active {
  background-color: var(--primary);
  border-color: var(--primary);
}

.toggle-button.active::before {
  transform: translateX(20px);
}

/* Length Control */
.length-control {
  display: flex;
  align-items: center;
  gap: 16px;
}

#lengthInput {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--surface-alt);
  border-radius: var(--radius-full);
  outline: none;
}

#lengthInput::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

#lengthInput::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

#lengthInput::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

#lengthInput::-moz-range-thumb:hover {
  transform: scale(1.15);
}

#length-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--surface-alt);
  min-width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Button Styles */
.primary-button {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.primary-button i {
  font-size: 1rem;
}

/* Theme Toggle */
#theme-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 8px;
  border-radius: var(--radius-full);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

#theme-toggle:hover {
  color: var(--primary);
  background-color: var(--surface-alt);
}

#sun-icon {
  display: none;
}

/* Footer */
footer {
  padding: 16px 24px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.tag-line {
  font-size: 0.875rem;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

/* Notification */
#notification-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
}

.custom-notification {
  background-color: var(--primary);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: fadeInOut 2s forwards;
  text-align: center;
  font-size: 0.9rem;
}

/* Responsive Styles */
@media (max-width: 480px) {
  h1 {
    font-size: 1.25rem;
  }
  
  .options-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .password-field {
    font-size: 1rem;
    padding: 16px 12px;
  }
  
  .primary-button {
    padding: 12px;
  }
  
  .password-actions {
    bottom: 34px;
    right: 34px;
  }
}

/* Animation */
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateY(-20px); }
  10% { opacity: 1; transform: translateY(0); }
  90% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-20px); }
}

/* Dark Mode */
body.dark {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: var(--dark-text-primary);
}

.dark .container {
  background-color: var(--dark-surface);
  border-color: var(--dark-border);
}

.dark header {
  border-color: var(--dark-border);
}

.dark h1, .dark h2 {
  color: var(--dark-text-primary);
}

.dark .password-field {
  background-color: var(--dark-surface-alt);
  color: var(--dark-text-primary);
  border-color: var(--dark-border);
}

.dark .toggle-label {
  color: var(--dark-text-secondary);
}

.dark .toggle-button {
  background-color: var(--dark-surface-alt);
  border-color: var(--dark-border);
}

.dark #length-value {
  background: var(--dark-surface-alt);
  color: var(--primary-light);
}

.dark #lengthInput {
  background: var(--dark-surface-alt);
}

.dark .icon-button {
  background-color: var(--dark-surface-alt);
  border-color: var(--dark-border);
  color: var(--primary-light);
}

.dark #strength-text {
  color: var(--dark-text-secondary);
}

.dark .strength-wrapper {
  background-color: var(--dark-surface-alt);
}

.dark .controls {
  border-color: var(--dark-border);
}

.dark footer {
  border-color: var(--dark-border);
}

.dark .tag-line {
  color: var(--dark-text-secondary);
}

.dark #theme-toggle {
  color: var(--dark-text-secondary);
}

.dark #theme-toggle:hover {
  color: var(--primary-light);
  background-color: var(--dark-surface-alt);
}

.dark #moon-icon {
  display: none;
}

.dark #sun-icon {
  display: inline;
}