:root {
  --bg-dark: #0a0a1a;
  --bg-mid: #1a1a3e;
  --bg-light: #0d0d2b;
  
  --primary: #8b5cf6;
  --primary-dark: #7c3aed;
  --accent: #fbbf24;
  --accent-dark: #f59e0b;
  
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-hover: rgba(255, 255, 255, 0.08);
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  
  --success: #10b981;
  --error: #ef4444;
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --border-radius: 16px;
  --transition: all 0.3s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(135deg, var(--bg-dark), var(--bg-mid), var(--bg-light));
  background-size: 200% 200%;
  animation: gradient-shift 15s ease infinite;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

#star-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

#app-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem;
  position: relative;
  z-index: 1;
}

.hidden {
  display: none !important;
}

/* Glass Card */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  transition: var(--transition);
}
.glass-card:hover {
  background: var(--glass-hover);
  box-shadow: 0 8px 32px 0 rgba(124, 58, 237, 0.2);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
}

h1 {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, #fff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* Hero Section */
#hero-section {
  text-align: center;
  padding: 4rem 0;
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: rgba(251, 191, 36, 0.1);
  color: var(--accent);
  border-radius: 20px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.hero-tagline {
  font-size: 1.25rem;
  color: var(--primary);
  margin-bottom: 1rem;
  font-weight: 500;
}

.hero-description {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 500px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(to bottom right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0) 100%);
  transform: rotate(45deg);
  animation: shimmer 3s infinite;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.125rem;
  width: 100%;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: block;
  margin: 1rem auto;
}

.btn-ghost:hover {
  color: var(--text-primary);
}

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

.section-header p {
  color: var(--text-secondary);
}

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

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

input[type="text"],
input[type="date"],
input[type="time"],
input[type="email"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: var(--transition);
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

/* Gender Pills */
.gender-pills {
  display: flex;
  gap: 1rem;
}

.gender-pills input[type="radio"] {
  display: none;
}

.gender-pills .pill {
  flex: 1;
  text-align: center;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.gender-pills input[type="radio"]:checked + .pill {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--primary);
  color: var(--primary);
}

/* Toggle Switch */
.toggle-group {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
}

.toggle-label {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 1rem !important;
  color: var(--text-primary) !important;
}

.toggle-switch {
  position: relative;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  transition: .4s;
  border-radius: 34px;
  border: 1px solid var(--glass-border);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: .4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--primary);
  border-color: var(--primary);
}

input:checked + .toggle-slider:before {
  transform: translateX(24px);
  background-color: white;
}

.toggle-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.precision-fields {
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  max-height: 0;
  opacity: 0;
}
.precision-fields.show {
  max-height: 200px;
  opacity: 1;
}

/* Autocomplete */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-mid);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  margin-top: 4px;
  z-index: 10;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.autocomplete-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.autocomplete-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Loader */
#loading-section {
  text-align: center;
  padding: 4rem 0;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.cosmic-loader {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 2rem;
}

.orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(124, 58, 237, 0.3);
  animation: spin linear infinite;
}

.orbit-1 {
  width: 60px;
  height: 60px;
  animation-duration: 3s;
}

.orbit-2 {
  width: 90px;
  height: 90px;
  border-color: rgba(251, 191, 36, 0.3);
  animation-duration: 5s;
  animation-direction: reverse;
}

.orbit-3 {
  width: 120px;
  height: 120px;
  border-color: rgba(16, 185, 129, 0.3);
  animation-duration: 7s;
}

.planet {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--primary);
}

.planet-2 {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.planet-3 {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.loading-subtitle {
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

/* Results */
.accuracy-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 1rem;
  text-align: center;
}

.accuracy-badge.standard {
  border: 1px solid var(--primary);
  color: var(--primary);
  background: rgba(124, 58, 237, 0.1);
}

.accuracy-badge.precision {
  background: var(--accent);
  color: var(--bg-dark);
  border: 1px solid var(--accent);
}

#results-greeting {
  font-size: 2.5rem;
}

.metrics-bar {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  margin-bottom: 2rem;
}

.metric-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.metric-symbol {
  font-size: 1.5rem;
  color: var(--accent);
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.metric-value {
  font-weight: 600;
  font-size: 0.9rem;
}

.reading-cards {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.reading-card {
  padding: 1.5rem;
  opacity: 0;
  transform: translateY(20px);
}

.reading-card.animate {
  animation: fadeInUp 0.6s ease forwards;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.75rem;
}

.card-icon {
  font-size: 1.5rem;
}

.card-title {
  font-size: 1.2rem;
  color: var(--primary);
  margin: 0;
}

.card-body {
  color: var(--text-primary);
  line-height: 1.6;
}

.upgrade-nudge {
  background: linear-gradient(var(--bg-mid), var(--bg-mid)) padding-box,
              linear-gradient(135deg, var(--primary), var(--accent)) border-box;
  border: 2px solid transparent;
  text-align: center;
  margin-bottom: 2rem;
}

.upgrade-nudge h3 {
  color: var(--accent);
}

.email-optin {
  text-align: center;
}

.optin-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

.optin-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.optin-form input {
  flex: 1;
}

.app-footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4rem;
}

/* Animations */
@keyframes spin {
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes shimmer {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

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

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

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(124, 58, 237, 0.4); }
  50% { box-shadow: 0 0 20px rgba(124, 58, 237, 0.8); }
}

/* House Info (Precision Reading) */
.house-info {
  width: 100%;
  text-align: center;
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px solid var(--glass-border);
  font-size: 0.9rem;
}

.house-label {
  color: var(--accent);
  font-weight: 600;
}

.house-value {
  color: var(--text-primary);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.875rem 1.5rem;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  max-width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

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

.toast-success {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.toast-info {
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(124, 58, 237, 0.4);
  color: #c4b5fd;
}

/* Responsive */
@media (max-width: 768px) {
  h1 { font-size: 2.5rem; }
  .gender-pills { flex-direction: column; gap: 0.5rem; }
  .optin-form { flex-direction: column; }
  .metrics-bar { flex-wrap: wrap; }
  .metric-pill { min-width: 70px; }
  #results-greeting { font-size: 1.8rem; }
  .glass-card { padding: 1.25rem; }
}

@media (max-width: 480px) {
  h1 { font-size: 2rem; }
  #app-container { padding: 1rem 0.75rem; }
  .btn-large { padding: 0.875rem 1.5rem; }
}
