:root {
  --primary: #FF6B9D;
  --primary-dark: #FF4D7A;
  --secondary: #A8E6CF;
  --success: #7FCDBB;
  --accent-yellow: #FFE66D;
  --accent-orange: #FFA500;
  --accent-peach: #FFB3A7;
  --bg: #FFF5F0;
  --card-bg: #ffffff;
  --text: #2D1B1E;
  --text-light: #8B6F6F;
  --border: #FFE5D9;
  --workspace: #FFF0E8;
  --shadow: rgba(255, 107, 157, 0.15);
  --shadow-lg: rgba(255, 107, 157, 0.25);
  --body-bg: #FFE5D9;
  --header-bg: rgba(255, 255, 255, 0.95);
  --modal-overlay: rgba(45, 27, 30, 0.6);
  --scrollbar-thumb: #ff6b9d;
  --scrollbar-track: rgba(255, 107, 157, 0.08);
}

/* Theme transition for smooth switching */
*, *::before, *::after {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

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

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--body-bg, #FFE5D9);
  min-height: 100vh;
  padding: 20px;
  color: var(--text);
}

/* Dark theme adjustments */
body.theme-neonNights,
body.theme-midnight {
  color-scheme: dark;
}

/* Ensure inputs and form elements adapt to theme */
input, textarea, select {
  background: var(--card-bg);
  color: var(--text);
  border-color: var(--border);
}

input::placeholder, textarea::placeholder {
  color: var(--text-light);
}

/* Scrollbar styling for the whole page */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track, var(--bg));
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb, var(--primary));
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

.card {
  background: var(--card-bg);
  padding: 30px;
  border-radius: 24px;
  box-shadow: 0 10px 40px var(--shadow-lg);
  margin-bottom: 20px;
}

.logo-container {
  text-align: center;
}

.logo {
  max-width: 300px;
  max-height: 200px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: var(--primary);
  text-align: center;
  font-weight: 700;
}

h2 {
  font-size: 1.75rem;
  margin-bottom: 20px;
  color: var(--text);
}

.subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 30px;
  font-size: 1.1rem;
}

button {
  background: var(--primary);
  border: 0;
  padding: 12px 24px;
  border-radius: 16px;
  color: white;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 107, 157, 0.4);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

button.secondary {
  background: var(--secondary);
  box-shadow: 0 4px 12px rgba(168, 230, 207, 0.3);
}

button.secondary:hover {
  box-shadow: 0 6px 16px rgba(168, 230, 207, 0.4);
}

button.success {
  background: var(--success);
  box-shadow: 0 4px 12px rgba(127, 205, 187, 0.3);
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

.spinner {
  border: 4px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error {
  background: #FFE5E5;
  color: #CC4A4A;
  padding: 15px;
  border-radius: 16px;
  margin: 15px 0;
  border-left: 4px solid #FF6B6B;
}

.success-message {
  background: #E5FFF5;
  color: #2D7A5F;
  padding: 15px;
  border-radius: 16px;
  margin: 15px 0;
  border-left: 4px solid var(--success);
}

/* Dark theme adjustments for messages */
body.theme-neonNights .error,
body.theme-midnight .error {
  background: rgba(255, 107, 107, 0.15);
  color: #FF8A8A;
  border-left-color: #FF6B6B;
}

body.theme-neonNights .success-message,
body.theme-midnight .success-message {
  background: rgba(0, 255, 136, 0.1);
  color: #00FF88;
  border-left-color: #00FF88;
}

/* Button text colors - ensure readable text on colored backgrounds */
button.secondary {
  color: var(--text);
}

/* Primary action buttons with colored backgrounds need contrasting text */
.auth-button,
.auth-submit-btn,
.auth-prompt-btn,
.celebration-button:not(.secondary),
.download-button,
.create-puzzle-btn,
button.success:not(.secondary) {
  color: white !important;
}

/* Dark theme: Primary buttons with cyan/bright colors need dark text */
body.theme-neonNights .auth-button,
body.theme-neonNights .auth-submit-btn,
body.theme-neonNights .auth-prompt-btn,
body.theme-neonNights .celebration-button:not(.secondary),
body.theme-neonNights .download-button,
body.theme-neonNights .create-puzzle-btn,
body.theme-neonNights button.success:not(.secondary) {
  color: #0A0A0F !important;
}

/* Midnight theme: Purple buttons can use white text */
body.theme-midnight .auth-button,
body.theme-midnight .auth-submit-btn,
body.theme-midnight .auth-prompt-btn,
body.theme-midnight .celebration-button:not(.secondary),
body.theme-midnight .download-button,
body.theme-midnight .create-puzzle-btn,
body.theme-midnight button.success:not(.secondary) {
  color: white !important;
}

/* Minimal theme: Black buttons need white text */
body.theme-minimal .auth-button,
body.theme-minimal .auth-submit-btn,
body.theme-minimal .auth-prompt-btn,
body.theme-minimal .celebration-button:not(.secondary),
body.theme-minimal .download-button,
body.theme-minimal .create-puzzle-btn,
body.theme-minimal button.success:not(.secondary) {
  color: white !important;
}

/* Not found page */
.not-found {
  text-align: center;
  padding: 60px 20px;
}

.not-found h2 {
  color: var(--primary);
  font-size: 1.75rem;
  margin-bottom: 15px;
}

.not-found p {
  color: var(--text-light);
  font-size: 1.1rem;
  margin-bottom: 30px;
}

.not-found button {
  padding: 14px 28px;
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .card {
    padding: 20px;
  }

  h1 {
    font-size: 2rem;
  }

  .logo {
    max-width: 150px;
    max-height: 75px;
  }
}

/* Special handling for landscape mode on mobile */
@media (max-width: 768px) and (max-height: 500px) {
  .card {
    padding: 15px;
  }
  
  h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
  }
}

