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

:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-input: #ffffff;
  --text-primary: #2d3748;
  --text-secondary: #718096;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--text-primary);
  min-height: 100vh;
}

.page-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* Main Content */
.main-content {
  width: 100%;
  max-width: 600px;
  animation: fadeInUp 0.6s ease-out backwards;
}

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

.card-container {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  border-top: 4px solid transparent;
  border-image: var(--primary-gradient) 1;
}

.form {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideIn 0.4s ease-out backwards;
}

.input-group:nth-child(1) { animation-delay: 0.3s; }
.input-group:nth-child(2) { animation-delay: 0.4s; }
.input-group:nth-child(3) { animation-delay: 0.5s; }
.input-group:nth-child(4) { animation-delay: 0.6s; }

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

label svg {
  color: var(--text-secondary);
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-input);
  transition: all 0.3s ease;
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  display: none;
  margin-top: -10px;
  padding-top: 10px;
}

.autocomplete-dropdown.show {
  display: block;
  animation: dropdownSlide 0.2s ease-out;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.autocomplete-item {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: linear-gradient(90deg, rgba(102, 126, 234, 0.05) 0%, transparent 100%);
  border-left-color: #667eea;
}

.autocomplete-item-text {
  flex: 1;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.autocomplete-item-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  opacity: 0;
}

.autocomplete-item:hover .autocomplete-item-delete,
.autocomplete-item.selected .autocomplete-item-delete {
  opacity: 1;
}

.autocomplete-item-delete:hover {
  background: rgba(245, 87, 108, 0.1);
  color: #f5576c;
  transform: scale(1.1);
}

.autocomplete-item-delete:active {
  transform: scale(0.95);
}

.autocomplete-item mark {
  background: rgba(102, 126, 234, 0.2);
  color: #667eea;
  font-weight: 600;
  padding: 0 2px;
  border-radius: 2px;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper input {
  flex: 1;
  padding-right: 48px;
}

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.toggle-password:hover {
  color: #667eea;
  background: rgba(102, 126, 234, 0.1);
}

.toggle-password:active {
  transform: scale(0.95);
}

.hidden {
  display: none !important;
}

.generated-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(102, 126, 234, 0.1);
  position: relative;
  overflow: hidden;
}

.generated-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.5s ease;
}

.generated-section.flash::before {
  left: 100%;
}

.generated-password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

#generated-password {
  flex: 1;
  font-family: 'Courier New', Courier, monospace;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  background: white;
  color: #667eea;
  border: 2px solid rgba(102, 126, 234, 0.2);
  cursor: pointer;
}

#generated-password:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#generated-password::selection {
  background: rgba(102, 126, 234, 0.3);
}

.copy-button {
  padding: 14px;
  background: var(--primary-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  min-width: 48px;
  height: 48px;
}

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

.copy-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.copy-button.copied {
  background: var(--success-gradient);
  animation: successPulse 0.6s ease;
}

@keyframes successPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.copy-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: var(--success-gradient);
  color: white;
  padding: 20px 32px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 16px;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
  transition: all 0.3s ease;
}

.copy-notification.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: notificationBounce 0.6s ease;
}

@keyframes notificationBounce {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.05);
  }
}

/* Info Box */
.info-box {
  padding: 20px 32px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
  border-top: 1px solid rgba(102, 126, 234, 0.1);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.info-box svg {
  color: #667eea;
  flex-shrink: 0;
  margin-top: 2px;
}

.info-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.info-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-box li {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  padding-left: 16px;
  position: relative;
}

.info-box li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #667eea;
  font-weight: bold;
}


/* Scrollbar */
.autocomplete-dropdown::-webkit-scrollbar {
  width: 6px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.3);
  border-radius: 3px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
  .page-container {
    padding: 16px;
  }

  .form {
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .form {
    padding: 20px;
  }

  .info-box {
    flex-direction: column;
    padding: 16px 20px;
  }
}

