/* CSS Custom Properties */
:root {
  --radius: 1rem;
  /* Cosmic Dark Colors */
  --cosmic-purple: #6B46C1;
  --cosmic-deep-purple: #4C1D95;
  --cosmic-midnight: #1E1B4B;
  --cosmic-navy: #0F172A;
  --cosmic-silver: #E2E8F0;
  --cosmic-stardust: #CBD5E1;
  --cosmic-glow: #8B5CF6;
  
  /* Dark theme */
  --background: #0F0F23;
  --foreground: #E2E8F0;
  --card: rgba(30, 27, 75, 0.3);
  --card-foreground: #E2E8F0;
  --primary: #8B5CF6;
  --primary-foreground: #FFFFFF;
  --secondary: rgba(107, 70, 193, 0.2);
  --secondary-foreground: #E2E8F0;
  --muted: rgba(30, 27, 75, 0.5);
  --muted-foreground: #94A3B8;
  --accent: #6B46C1;
  --border: rgba(139, 92, 246, 0.2);
  --input: rgba(30, 27, 75, 0.4);
  --ring: #8B5CF6;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #0F0F23 0%, #1E1B4B 50%, #4C1D95 100%);
  color: var(--foreground);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><circle cx="10" cy="10" r="8" fill="rgba(139,92,246,0.3)" stroke="%23E2E8F0" stroke-width="1"/></svg>'), auto;
}

/* Animated background stars */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, #E2E8F0, transparent),
    radial-gradient(2px 2px at 40px 70px, #CBD5E1, transparent),
    radial-gradient(1px 1px at 90px 40px, #8B5CF6, transparent),
    radial-gradient(1px 1px at 130px 80px, #6B46C1, transparent),
    radial-gradient(2px 2px at 160px 30px, #E2E8F0, transparent);
  background-repeat: repeat;
  background-size: 200px 100px;
  animation: sparkle 20s linear infinite;
  pointer-events: none;
  z-index: -2;
}

/* Aurora effect */
.aurora {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
  animation: aurora 30s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: -1;
}

/* Particles */
#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--cosmic-glow);
  border-radius: 50%;
  animation: particle-float 3s ease-in-out infinite;
}

/* Language Toggle */
.language-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
}

/* Music Control */
.music-control {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
}

.music-control button,
.language-toggle button {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: none;
  color: var(--cosmic-silver);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.music-control button:hover,
.language-toggle button:hover {
  color: var(--cosmic-glow);
  transform: scale(1.1);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2rem;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.title {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 700;
  background: linear-gradient(45deg, var(--cosmic-silver), var(--cosmic-glow));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}

.subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--cosmic-stardust);
  opacity: 0.9;
}

.cosmic-glow {
  color: var(--cosmic-glow);
  font-size: clamp(1.5rem, 3vw, 2rem);
}

/* Glass Card */
.glass-card {
  background: rgba(30, 27, 75, 0.3);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Form Styles */
.form-section {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.form-card {
  padding: 2rem;
}

.card-header {
  text-align: center;
  margin-bottom: 2rem;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--cosmic-silver);
}

.cosmic-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Floating Labels */
.floating-label {
  position: relative;
}

.floating-label input {
  width: 100%;
  padding: 1rem 0.75rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--foreground);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.floating-label input:focus {
  outline: none;
  border-color: var(--cosmic-glow);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.floating-label label {
  position: absolute;
  left: 0.75rem;
  top: 1rem;
  color: var(--muted-foreground);
  font-size: 1rem;
  transition: all 0.3s ease;
  pointer-events: none;
  background: var(--input);
  padding: 0 0.25rem;
}

.floating-label input:focus + label,
.floating-label input:not(:placeholder-shown) + label {
  transform: translateY(-1.5rem) scale(0.8);
  color: var(--cosmic-glow);
}

/* Field Labels */
.field-label {
  display: block;
  color: var(--cosmic-silver);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* Color Picker */
.color-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.color-picker {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  border: 2px solid var(--cosmic-glow);
  cursor: pointer;
  transition: all 0.3s ease;
}

.color-picker-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

.color-value {
  color: var(--cosmic-stardust);
  font-family: monospace;
  font-size: 1rem;
}

/* Select */
.select-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.glass-select {
  width: 100%;
  padding: 1rem 0.75rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--foreground);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.glass-select:focus {
  outline: none;
  border-color: var(--cosmic-glow);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.glass-select option {
  background: var(--cosmic-midnight);
  color: var(--foreground);
}

/* Checkpoints */
.checkpoints-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.checkpoint-item {
  position: relative;
}

.checkpoint-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkpoint-item label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--cosmic-stardust);
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

.checkpoint-item input[type="checkbox"]:checked + label {
  background: var(--secondary);
  border-color: var(--cosmic-glow);
  color: var(--foreground);
  transform: scale(1.02);
}

.checkpoint-item label i {
  color: var(--cosmic-glow);
  width: 1rem;
}

/* Cosmic Button */
.cosmic-button {
  position: relative;
  width: 100%;
  padding: 1rem 2rem;
  background: linear-gradient(45deg, var(--cosmic-purple), var(--cosmic-glow));
  border: none;
  border-radius: 0.5rem;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.cosmic-button:hover::before {
  left: 100%;
}

.cosmic-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(139, 92, 246, 0.4);
}

.cosmic-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.button-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.loading-content {
  display: none;
}

.cosmic-button.loading .button-content {
  display: none;
}

.cosmic-button.loading .loading-content {
  display: flex;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Response Section */
.response-section {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

.response-card {
  padding: 2rem;
}

.response-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.message-card {
  padding: 2rem;
  border-radius: 0.75rem;
}

.guidance-message {
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--cosmic-silver);
  text-align: center;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.info-card {
  padding: 1.5rem;
  border-radius: 0.75rem;
}

.info-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--cosmic-glow);
  margin-bottom: 1rem;
}

.info-content {
  color: var(--cosmic-stardust);
  line-height: 1.6;
}

.song-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.song-name {
  font-weight: 600;
  color: var(--cosmic-silver);
  font-size: 1.1rem;
}

.song-artist {
  color: var(--cosmic-glow);
  font-style: italic;
}

.song-reason {
  color: var(--cosmic-stardust);
  font-size: 0.9rem;
}

.new-reading-btn {
  max-width: 300px;
  margin: 2rem auto 0;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.floating {
  animation: float 6s ease-in-out infinite;
}

.rotating-card {
  animation: rotate 2s ease-in-out;
}

.glow {
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

.particle-trail {
  position: relative;
  overflow: hidden;
}

.particle-trail::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: var(--cosmic-glow);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: particle-float 3s ease-in-out infinite;
}

/* Animations */
@keyframes sparkle {
  from { transform: translateX(0); }
  to { transform: translateX(-200px); }
}

@keyframes aurora {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

@keyframes rotate {
  0% { transform: rotateY(0deg); }
  50% { transform: rotateY(180deg); }
  100% { transform: rotateY(360deg); }
}

@keyframes particle-float {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  50% { transform: translate(-50%, -150%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -250%) scale(0); opacity: 0; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.5); }
  50% { box-shadow: 0 0 40px rgba(139, 92, 246, 0.8); }
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0.5rem;
    gap: 1.5rem;
  }
  
  .form-card,
  .response-card {
    padding: 1.5rem;
  }
  
  .header-content {
    gap: 0.5rem;
  }
  
  .title {
    font-size: 2.5rem;
  }
  
  .checkpoints-grid {
    grid-template-columns: 1fr;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .glass-card {
    backdrop-filter: blur(15px);
  }
  
  body::before {
    background-size: 150px 75px;
  }
  
  .music-control,
  .language-toggle {
    top: 0.5rem;
  }
  
  .music-control {
    left: 0.5rem;
  }
  
  .language-toggle {
    right: 0.5rem;
  }
}

@media (max-width: 480px) {
  .color-picker-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .color-picker {
    width: 3rem;
    height: 3rem;
  }
  
  .cosmic-form {
    gap: 1.25rem;
  }
  
  .title {
    font-size: 2rem;
  }
}

/* Touch Optimizations */
@media (hover: none) and (pointer: coarse) {
  .cosmic-button:hover {
    transform: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  }
  
  .checkpoint-item input[type="checkbox"]:checked + label {
    transform: none;
  }
  
  .music-control button:hover,
  .language-toggle button:hover {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .glass-card {
    background: rgba(30, 27, 75, 0.8);
    border: 2px solid var(--cosmic-glow);
  }
  
  .floating-label input,
  .glass-select {
    background: rgba(15, 15, 35, 0.9);
    border: 2px solid var(--border);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .floating {
    animation: none;
  }
  
  .rotating-card {
    animation: none;
  }
  
  body::before {
    animation: none;
  }
  
  .aurora {
    animation: none;
  }
}
