@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Modern Color Palette */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #8b5cf6;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  /* Neutral Colors */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  /* Surface Colors */
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  
  /* Text Colors */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  
  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  color: var(--text-primary);
  overflow-x: hidden;
}

.main-container {
  min-height: 100vh;
  position: relative;
}

/* Animated Background */
.main-container::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  z-index: -1;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Header */
.app-header {
  padding: 2rem 0 1rem;
  text-align: center;
  position: relative;
  z-index: 10;
}

.app-title {
  font-size: 3rem;
  font-weight: 700;
  color: white;
  margin: 0;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  animation: fadeInUp 0.8s ease-out;
}

.app-subtitle {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0.5rem 0 0;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Main Generator Card */
.generator-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  margin-bottom: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: slideInUp 0.8s ease-out 0.4s both;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-content {
  padding: 2.5rem;
}

/* Section Titles */
.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 1.5rem;
}

/* Current Password Section */
.current-password-section {
  margin-bottom: 2.5rem;
}

.password-display {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.password-input {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 500;
  padding: 1rem 1.25rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--primary);
  transition: var(--transition);
  letter-spacing: 0.025em;
}

.password-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.password-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--gray-100);
  color: var(--gray-600);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover:not(:disabled) {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-btn:active {
  transform: translateY(0);
}

/* Strength Section */
.strength-section {
  background: var(--surface-2);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
}

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

.strength-label {
  font-weight: 500;
  color: var(--text-secondary);
}

.strength-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--gray-200);
  color: var(--gray-700);
}

.strength-bar-container {
  height: 8px;
  background: var(--gray-200);
  border-radius: 9999px;
  overflow: hidden;
}

.strength-bar {
  height: 100%;
  width: 0%;
  border-radius: 9999px;
  transition: width 0.5s ease, background-color 0.3s ease;
  background: linear-gradient(90deg, var(--danger), var(--warning), var(--success));
}

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.setting-card {
  background: var(--surface-2);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
}

.setting-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.setting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.setting-label {
  font-weight: 600;
  color: var(--text-primary);
}

.setting-value {
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* Length Controls */
.length-controls {
  space-y: 1rem;
}

.length-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--gray-200);
  outline: none;
  margin-bottom: 1rem;
  -webkit-appearance: none;
}

.length-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.length-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.length-presets {
  display: flex;
  gap: 0.5rem;
}

.preset-btn {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.preset-btn:hover, .preset-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Character Types */
.character-types {
  display: grid;
  gap: 0.75rem;
}

.type-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border: 1px solid transparent;
}

.type-toggle:hover {
  background: rgba(99, 102, 241, 0.05);
  border-color: rgba(99, 102, 241, 0.2);
}

.type-toggle input {
  display: none;
}

.toggle-slider {
  width: 44px;
  height: 24px;
  background: var(--gray-300);
  border-radius: 12px;
  position: relative;
  transition: var(--transition);
  margin-right: 0.75rem;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.type-toggle input:checked + .toggle-slider {
  background: var(--primary);
}

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

.toggle-label {
  font-weight: 500;
  color: var(--text-primary);
}

/* Preset Buttons */
.preset-buttons {
  display: grid;
  gap: 0.75rem;
}

.preset-card {
  padding: 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.preset-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.preset-name {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.preset-desc {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Generate Button */
.generate-section {
  text-align: center;
}

.generate-btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: var(--radius-md);
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
}

.generate-btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

.generate-btn:active {
  transform: translateY(-1px);
}

/* History Section */
.history-section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: slideInUp 0.8s ease-out 0.6s both;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 2.5rem 1rem;
  border-bottom: 1px solid var(--gray-200);
}

.history-actions {
  display: flex;
  gap: 0.75rem;
}

.clear-btn, .export-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.clear-btn:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.export-btn:hover {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.password-grid {
  padding: 2rem 2.5rem;
  display: grid;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
}

.password-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
}

.password-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.password-text {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: var(--primary);
  word-break: break-all;
}

.password-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.password-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.copy-history-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  color: var(--gray-600);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.empty-state small {
  font-size: 0.875rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 1000;
}

.toast-notification {
  background: var(--success);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  opacity: 0;
  transition: var(--transition-slow);
}

.toast-notification.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-title {
    font-size: 2rem;
  }
  
  .card-content {
    padding: 1.5rem;
  }
  
  .settings-grid {
    grid-template-columns: 1fr;
  }
  
  .history-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .password-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .password-meta {
    align-self: stretch;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* Additional CSS for enhanced animations and feedback */

/* Strength badge variations */
.strength-badge.strength-weak {
  background: var(--danger);
  color: white;
}

.strength-badge.strength-fair {
  background: var(--warning);
  color: white;
}

.strength-badge.strength-good {
  background: var(--accent);
  color: white;
}

.strength-badge.strength-excellent {
  background: var(--success);
  color: white;
}

/* Preset card active state */
.preset-card.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.02);
}

.preset-card.active .preset-name {
  color: white;
}

.preset-card.active .preset-desc {
  color: rgba(255, 255, 255, 0.8);
}

/* Enhanced button feedback */
.action-btn.copying {
  background: var(--success) !important;
  color: white !important;
  transform: scale(0.95);
}

.copy-history-btn.copying {
  background: var(--success) !important;
  color: white !important;
  transform: scale(0.9);
}

/* Pulse animation for generate button */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.generate-btn.generating {
  animation: pulse 0.6s ease-in-out;
}

/* Password item entrance animation */
.password-item {
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Smooth scrollbar for history */
.password-grid::-webkit-scrollbar {
  width: 6px;
}

.password-grid::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 3px;
}

.password-grid::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
  transition: var(--transition);
}

.password-grid::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Focus states for accessibility */
.generate-btn:focus,
.action-btn:focus,
.preset-btn:focus,
.preset-card:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Loading state for generate button */
.generate-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.generate-btn.loading svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Enhanced hover effects */
.setting-card:hover .setting-value {
  transform: scale(1.1);
}

.password-item:hover .password-text {
  color: var(--primary-dark);
}

/* Mobile enhancements */
@media (max-width: 640px) {
  .toast-container {
    top: 1rem;
    right: 1rem;
    left: 1rem;
  }
  
  .toast-notification {
    width: 100%;
  }
  
  .length-presets {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  
  .preset-buttons {
    gap: 0.5rem;
  }
  
  .history-actions {
    width: 100%;
  }
  
  .clear-btn, 
  .export-btn {
    flex: 1;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #1e293b;
    --surface-2: #334155;
    --surface-3: #475569;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
  }
}