/* CSS Variables */
:root {
  --color-background: #0a0a0f;
  --color-foreground: #f5f5f7;
  --color-card: #141418;
  --color-card-hover: #1c1c22;
  --color-primary: #8b8adc;
  --color-primary-hover: #a5a4e8;
  --color-accent: #4ade80;
  --color-border: #27272a;
  --color-muted: #a1a1aa;
  --color-input-bg: #18181b;
  --color-danger: #ef4444;
  --color-success: #22c55e;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif;

  --radius: 0.75rem;
  --radius-lg: 1rem;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(139, 138, 220, 0.15);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--color-background);
  color: var(--color-foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-primary-hover);
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* Navbar */
.nav-bar {
  background-color: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-bar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.025em;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  color: var(--color-muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-foreground);
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 101;
  animation: slideIn 0.2s ease-out;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-content a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--color-muted);
  transition: background-color 0.2s;
}

.dropdown-content a:hover {
  background-color: var(--color-card-hover);
  color: var(--color-foreground);
}

/* Hero Section */
.hero-section {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--color-border);
  min-height: 90vh;
  display: flex;
  align-items: center;
}

.hero-bg-gradient {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gradient-1 {
  background: radial-gradient(circle at 30% 20%, rgba(139, 138, 220, 0.15), transparent 60%);
}

.gradient-2 {
  background: radial-gradient(circle at 70% 80%, rgba(74, 222, 128, 0.1), transparent 60%);
}

.hero-content {
  position: relative;
  padding: 4rem 0;
  text-align: center;
}

.hero-text {
  max-width: 64rem;
  margin: 0 auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(139, 138, 220, 0.3);
  background: rgba(139, 138, 220, 0.1);
  border-radius: 9999px;
  color: var(--color-primary);
  font-size: 0.875rem;
  font-weight: 500;
}

.hero-title {
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 800;
  margin-bottom: 1.5rem;
  letter-spacing: -0.025em;
  line-height: 1.1;
  background: linear-gradient(to bottom right, #fff, #a1a1aa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  margin-bottom: 1rem;
  color: var(--color-foreground);
  font-weight: 500;
}

.hero-description {
  font-size: 1.125rem;
  margin-bottom: 3rem;
  color: var(--color-muted);
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #000;
  box-shadow: 0 0 15px rgba(139, 138, 220, 0.3);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(139, 138, 220, 0.5);
}

.btn-outline {
  background: transparent;
  color: var(--color-foreground);
  border: 1px solid var(--color-border);
}

.btn-outline:hover {
  background: var(--color-card);
  border-color: var(--color-primary);
}

.btn-large {
  padding: 1rem 2.5rem;
  font-size: 1.125rem;
}

/* Features Section */
.features-section {
  padding: 8rem 0;
}

.features-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.feature-card {
  padding: 2.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-card);
  transition: all 0.3s;
}

.feature-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-5px);
  box-shadow: var(--shadow-glow);
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
  background: rgba(139, 138, 220, 0.1);
  color: var(--color-primary);
}

.feature-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--color-foreground);
}

.feature-description {
  color: var(--color-muted);
  line-height: 1.7;
}

/* Auth Pages */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 80px);
  /* Adjust for navbar */
  padding: 2rem;
}

.auth-box {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 3rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}

.auth-box h1 {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 2rem;
  font-weight: 700;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--color-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-foreground);
  font-size: 1rem;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(139, 138, 220, 0.2);
}

.form-group.checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.form-group.checkbox input {
  width: auto;
}

.form-group.checkbox label {
  margin-bottom: 0;
}

.auth-links {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.error-message,
.success-message {
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.success-message {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #86efac;
}

/* Draw Page */
.draw-page {
  padding: 2rem 0;
}

.draw-container {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .draw-container {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.panel-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 1.25rem;
  font-weight: 600;
}

.setting-group {
  margin-bottom: 1.25rem;
}

.setting-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.setting-group input,
.setting-group select {
  width: 100%;
  padding: 0.6rem;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-foreground);
}

.seed-container {
  display: flex;
  gap: 0.5rem;
}

.seed-container input {
  flex: 1;
}

.btn-secondary {
  background: var(--color-card-hover);
  color: var(--color-foreground);
  border: 1px solid var(--color-border);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--color-border);
}

.result-area {
  min-height: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

#result-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.placeholder-state {
  text-align: center;
  color: var(--color-muted);
}

.placeholder-icon {
  width: 4rem;
  height: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Thank You Section */
.thank-you-section {
  padding: 8rem 0;
  border-top: 1px solid var(--color-border);
  position: relative;
  overflow: hidden;
}

.thank-you-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 800px;
  height: 100%;
  background: radial-gradient(ellipse at center, rgba(139, 138, 220, 0.05), transparent 70%);
  pointer-events: none;
}

.thank-you-header {
  text-align: center;
  margin-bottom: 4rem;
}

.thank-you-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.thank-you-description {
  font-size: 1.125rem;
  color: var(--color-muted);
}

.thank-you-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.thank-you-card {
  padding: 2rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-card);
  text-align: center;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.thank-you-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.thank-you-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1.5rem;
  border-radius: 50%;
  background: rgba(139, 138, 220, 0.1);
  color: var(--color-primary);
}

.thank-you-role {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.thank-you-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-foreground);
}

/* CTA Section */
.cta-section {
  padding: 8rem 0;
  background: linear-gradient(to bottom, transparent, rgba(139, 138, 220, 0.05));
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.cta-content {
  max-width: 48rem;
  margin: 0 auto;
}

.cta-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.cta-description {
  font-size: 1.25rem;
  margin-bottom: 2.5rem;
  color: var(--color-muted);
}

/* Footer */
.footer {
  margin-top: auto;
  padding: 3rem 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* Icons */
.icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* History Page */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.history-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s;
}

.history-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.history-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--color-border);
}

.history-info {
  padding: 1rem;
}

.history-prompt {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--color-foreground);
}

.history-meta {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
}

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

.history-actions .btn {
  flex: 1;
  font-size: 0.8rem;
  padding: 0.5rem;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 3rem;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-muted);
  text-decoration: none;
  transition: all 0.2s;
}

.pagination a:hover {
  background: var(--color-card-hover);
  color: var(--color-foreground);
  border-color: var(--color-primary);
}

.pagination .active {
  background: var(--color-primary);
  color: #000;
  border-color: var(--color-primary);
  font-weight: 600;
}

/* Utilities */
.text-center {
  text-align: center;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mt-4 {
  margin-top: 1rem;
}

.w-full {
  width: 100%;
}

.hidden {
  display: none !important;
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(139, 138, 220, 0.1);
  border-radius: 50%;
  border-top-color: var(--color-primary);
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 1rem;
}

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