/* Modern CSS Variables for Theme */
:root {
  /* Light theme colors */
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary-color: #10b981;
  --secondary-dark: #059669;
  --accent-color: #f59e0b;
  --background: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --gradient-start: #6366f1;
  --gradient-end: #8b5cf6;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.18);
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #818cf8;
    --primary-dark: #6366f1;
    --primary-light: #a5b4fc;
    --secondary-color: #34d399;
    --secondary-dark: #10b981;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --gradient-start: #818cf8;
    --gradient-end: #a78bfa;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(148, 163, 184, 0.18);
  }
}

/* Modern Reset and Base Styles */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
    sans-serif;
  line-height: 1.6;
  background: var(--background);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Animated Background */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    var(--gradient-start) 0%,
    var(--gradient-end) 100%
  );
  opacity: 0.05;
  z-index: -2;
}

/* Floating Gradient Orbs */
body::after {
  content: "";
  position: fixed;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
  opacity: 0.1;
  animation: float 20s ease-in-out infinite;
  z-index: -1;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
  33% {
    transform: translate(30px, -30px) rotate(120deg);
  }
  66% {
    transform: translate(-20px, 20px) rotate(240deg);
  }
}

/* Container with Glassmorphism */
.container {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  padding: 2.5rem;
  border-radius: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
  width: 100%;
  max-width: 500px;
  margin: 2rem auto;
  position: relative;
  overflow: hidden;
  animation: slideUp 0.6s ease-out;
}

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

/* Header Styles */
header {
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
}

header a {
  display: inline-block;
  transition: transform 0.3s ease;
}

header a:hover {
  transform: scale(1.05);
}

header img {
  max-width: 280px;
  width: 280px;
  height: auto;
  margin-bottom: 1rem;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

header p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-top: 0.5rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.75rem;
  position: relative;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.form-control {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
  transition: all 0.3s ease;
  outline: none;
}

.form-control:hover {
  border-color: var(--primary-light);
  background: var(--surface-hover);
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

/* Generated Password Container */
.generated-password-container {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
}

.generated-password-container input[type="text"] {
  flex: 1;
  background: linear-gradient(
    135deg,
    var(--surface) 0%,
    var(--surface-hover) 100%
  );
  font-family: "Courier New", Courier, monospace;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--primary-dark);
}

/* Modern Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-copy {
  background: linear-gradient(
    135deg,
    var(--secondary-color) 0%,
    var(--secondary-dark) 100%
  );
  color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-copy:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

/* Info Section with Modern Card Design */
.info-section {
  margin-top: 3rem;
  padding: 2rem;
  background: linear-gradient(
    135deg,
    var(--surface) 0%,
    var(--surface-hover) 100%
  );
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
}

.info-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-section h2::before {
  content: "💡";
  font-size: 1.25rem;
}

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

.info-section li {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  padding-left: 2.5rem;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  position: relative;
  transition: all 0.3s ease;
}

.info-section li:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.info-section li::before {
  content: "✨";
  position: absolute;
  left: 0.75rem;
  top: 1.25rem;
  font-size: 1.25rem;
  animation: sparkle 2s ease-in-out infinite;
}

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

.info-section strong {
  color: var(--primary-color);
  font-weight: 700;
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.125rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 2rem;
    margin: 1rem;
    border-radius: 20px;
  }

  header img {
    max-width: 250px;
  }

  .form-group label {
    font-size: 0.8125rem;
  }

  .info-section {
    padding: 1.5rem;
  }

  .info-section li {
    padding: 1rem;
  }

  .info-section li::before {
    content: "";
  }
}

@media (max-width: 480px) {
  body {
    padding: 0.5rem;
  }

  .container {
    padding: 1.5rem;
    border-radius: 16px;
  }

  .generated-password-container {
    flex-direction: column;
    gap: 0.5rem;
  }

  .btn {
    width: 100%;
    padding: 1rem;
  }

  header img {
    max-width: 220px;
  }

  header p {
    font-size: 1rem;
  }

  .info-section h2 {
    font-size: 1.25rem;
  }

  .info-section strong {
    font-size: 1rem;
  }
}

/* Form Hints */
.form-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

/* Button Icon Styles */
.btn-icon {
  margin-left: 0.5rem;
  transition: transform 0.3s ease;
}

.btn:hover .btn-icon {
  transform: translateX(2px);
}

.btn-text {
  display: inline-block;
}

/* Copied State */
.btn-copy.copied {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  animation: successPulse 0.5s ease;
}

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

/* Disabled Button State */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn:disabled:hover {
  transform: none !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  right: 2rem;
  top: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 1000;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

.theme-toggle svg {
  width: 1.5rem;
  height: 1.5rem;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sun-icon {
  position: absolute;
}

.moon-icon {
  position: absolute;
  opacity: 0;
  transform: rotate(180deg);
}

/* Dark theme icon states */
[data-theme="dark"] .sun-icon {
  opacity: 0;
  transform: rotate(-180deg);
}

[data-theme="dark"] .moon-icon {
  opacity: 1;
  transform: rotate(0deg);
}

/* Light theme overrides when data-theme is set */
[data-theme="light"] {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary-color: #10b981;
  --secondary-dark: #059669;
  --background: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --gradient-start: #6366f1;
  --gradient-end: #8b5cf6;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.18);
}

/* Dark theme overrides when data-theme is set */
[data-theme="dark"] {
  --primary-color: #818cf8;
  --primary-dark: #6366f1;
  --primary-light: #a5b4fc;
  --secondary-color: #34d399;
  --secondary-dark: #10b981;
  --background: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --gradient-start: #818cf8;
  --gradient-end: #a78bfa;
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(148, 163, 184, 0.18);
}

/* Mobile adjustments for theme toggle */
@media (max-width: 768px) {
  .theme-toggle {
    top: 1rem;
    width: 2.5rem;
    height: 2.5rem;
  }

  .theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
  }
}

/* Additional mobile optimizations */
@media (max-width: 480px) {
  .btn-icon {
    margin-left: 0.25rem; /* Adjust margin for smaller screens */
  }

  .form-hint {
    font-size: 0.75rem;
  }
}

/* Loading Animation */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

/* Focus Visible for Accessibility */
:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Smooth Transitions for Theme Changes */
* {
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease;
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: black;
  }

  .container {
    box-shadow: none;
    border: 1px solid #000;
  }

  .btn {
    display: none;
  }
}
