:root {
  /* SpaceTech Theme Palette */
  --bg-space: #03030b;
  --bg-nebula: radial-gradient(circle at 50% 50%, rgba(76, 29, 149, 0.15), transparent 60%);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  --accent-gradient: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));

  --glass-bg: rgba(15, 15, 30, 0.8);
  --glass-border: rgba(148, 163, 184, 0.1);
  --glass-highlight: rgba(255, 255, 255, 0.05);

  --font-main: 'Inter', sans-serif;
  --font-display: 'Orbitron', 'Inter', sans-serif;

  --container-width: 85%;
  --radius-md: 8px;
  --radius-lg: 16px;

  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease-out;
}

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

html {
  scroll-behavior: smooth;
  font-family: var(--font-main);
  background-color: var(--bg-space);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-y: scroll;
  /* Force scrollbar to prevent layout shift */
}

body {
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Star Canvas */
#star-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: radial-gradient(circle at bottom left, rgba(6, 182, 212, 0.05), transparent 40%),
    radial-gradient(circle at top right, rgba(139, 92, 246, 0.05), transparent 40%);
  pointer-events: none;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition-fast);
}

ul {
  list-style: none;
}

.container {
  max-width: var(--container-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 2;
}

/* Typography */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
}

h1 {
  font-size: 4rem;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
}

p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  max-width: 65ch;
  line-height: 1.7;
}

/* Utilities */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
  cursor: pointer;
  transition: var(--transition-fast);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-md);
}

.btn:hover {
  background: var(--accent-cyan);
  color: #000;
  box-shadow: 0 0 20px var(--accent-cyan);
}

.btn-primary {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
  font-weight: 700;
}

.btn-primary:hover {
  background: transparent;
  color: var(--accent-cyan);
}

.section {
  padding: 8rem 0;
  position: relative;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  /* Lower than modal/wrapper stacking contexts */
  padding: 1.5rem 0;
  background: linear-gradient(to bottom, rgba(3, 3, 11, 0.95), transparent);
}

nav {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff;
}

/* System Status Animation */
.animation-wrapper {
  display: flex !important;
  align-items: flex-end;
  justify-content: center;
}

.system-status {
  font-size: 3.5rem;
  color: var(--accent-purple);
  margin: 0;
  display: inline-block;
  letter-spacing: 0.1em;
  text-shadow: 0 0 30px rgba(139, 92, 246, 0.4);

  /* Typewriter effect */
  overflow: hidden;
  border-right: 3px solid var(--accent-purple);
  white-space: nowrap;
  width: 0;
  max-width: fit-content;
  /* Ensure it doesn't grow beyond content */
  /* Ensure it doesn't grow beyond content */
  animation:
    typing 3.5s steps(30, end) forwards,
    blink-caret .75s step-end 5 forwards;
}

.dots {
  font-size: 3.5rem;
  color: var(--accent-purple);
  letter-spacing: 0.1em;
  text-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
  font-family: var(--font-display);
  font-weight: 700;
}

.dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
  animation-delay: 3.5s;
  text-shadow: 0 0 30px rgba(139, 92, 246, 0.8), 0 0 60px rgba(139, 92, 246, 0.4);
}

/* Booking Text Override */
#booking .container div p {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

@keyframes dots {

  0%,
  20% {
    content: '';
  }

  40% {
    content: '.';
  }

  60% {
    content: '..';
  }

  80%,
  100% {
    content: '...';
  }
}

/* Removed ::after logic */

@keyframes typing {
  from {
    width: 0
  }

  to {
    width: 100%
  }
}

@keyframes blink-caret {

  0%,
  100% {
    border-color: transparent
  }

  50% {
    border-color: var(--accent-purple)
  }
}


/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

.animate-fade-in {
  animation: fadeIn 1s ease forwards;
}

/* -------------------------------------------------------------------------- */
/* CALENDAR & BOOKING STYLES
/* -------------------------------------------------------------------------- */

/* Calendar Wrapper */
.calendar-wrapper {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-lg);
  padding: 2rem;
  backdrop-filter: blur(12px);
  width: 60%;
  margin: 0 auto;
  position: relative;
  z-index: 100;
  /* Stays above header but below modal inside it */
}

/* Calendar Header */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  position: relative;
}

.calendar-header h3 {
  font-size: 1.25rem;
  margin: 0;
  text-align: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
  /* Let clicks pass through if overlapping (optional safety) */
}

.calendar-header button {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font-display);
  font-weight: bold;
}

.calendar-header button:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.calendar-header .today-btn {
  width: auto;
  border-radius: var(--radius-md);
  padding: 0 1rem;
  font-size: 0.8rem;
}

/* Calendar Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  text-align: center;
}

.calendar-day-header {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.5rem 0;
  text-transform: uppercase;
}

.calendar-day {
  padding: 1rem 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--text-primary);
  border: 1px solid transparent;
  min-height: 3.5rem;
  /* Ensure consistent height for empty cells */
  display: flex;
  /* Help align content if needed */
  align-items: center;
  justify-content: center;
}

.calendar-day:hover:not(.empty):not(.past):not(.weekend) {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--glass-highlight);
}

.calendar-day.selected {
  background: var(--accent-cyan);
  color: #000;
  font-weight: bold;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.calendar-day.today {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
}

.calendar-day.today.selected {
  color: #000;
}

.calendar-day.past,
.calendar-day.weekend,
.calendar-day.empty,
.calendar-day.disabled,
.calendar-day.blocked {
  color: rgba(255, 255, 255, 0.1);
  cursor: default;
  background: transparent;
}

/* Loader Overlay */
.calendar-loader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 3, 11, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  border-radius: var(--radius-lg);
  animation: fadeIn 0.2s ease-out;
}

/* Refined Satellite Spinner */
.satellite-loader {
  --loader-size: 40px;
  --icon-size: 28px;
  --radius: calc(var(--loader-size) / 2);
  --half-icon: calc(var(--icon-size) / 2);
  --v-offset: 60px;
  /* Sinks the satellite onto the track line */

  position: relative;
  width: var(--loader-size);
  height: var(--loader-size);
  display: flex;
  justify-content: center;
  align-items: center;
}

.satellite-track {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(6, 182, 212, 0.15);
  border-radius: 50%;
}

.satellite-icon-wrapper {
  position: absolute;
  width: var(--icon-size);
  height: var(--icon-size);
  color: var(--accent-cyan);
  /* Position on the track - centered vertically */
  top: calc(-1 * var(--half-icon) + var(--v-offset));
  left: calc(50% - var(--half-icon));
  /* Animation: rotation around the track center */
  transform-origin: var(--half-icon) calc(var(--radius) + var(--half-icon) - var(--v-offset));
  animation: satellite-slide 4s linear infinite;
}

.satellite-icon-wrapper svg {
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
  /* Face dish towards center of orbit (geostationary) */
  filter: drop-shadow(0 0 5px var(--accent-cyan));
}

@keyframes satellite-slide {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Time Slots */
.time-slots {
  margin-top: 2rem;
  border-top: 1px solid var(--glass-border);
  padding-top: 2rem;
  animation: fadeIn 0.3s ease-out;
}

.time-slots h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
  text-align: center;
}

.slots-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.time-slot-btn {
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--accent-purple);
  background: rgba(139, 92, 246, 0.1);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-main);
  transition: var(--transition-fast);
}

.time-slot-btn:hover {
  background: var(--accent-purple);
  color: #fff;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.hidden {
  display: none !important;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 9999;
  /* Ensure it's above everything including fixed header */
  display: flex;
  align-items: center;
  /* Perfect vertical centering */
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
  padding: 1rem;
  /* Let flexbox handle centering */
  overflow-y: auto;
  /* Allow scrolling if screen is short */
}

.modal.form-mode {
  align-items: flex-start;
  /* Form is taller, align to top to avoid clipping header */
  padding-top: 8rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.modal-content {
  background: rgba(15, 17, 26, 0.98);
  border: 1px solid var(--accent-cyan);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  /* Prevent overflowing viewport height */
  overflow-y: auto;
  /* Allow scrolling if content is too long */
  position: relative;
  box-shadow: 0 0 50px rgba(6, 182, 212, 0.15);
}

/* Success Mode for Box */
.modal-content.success-modal-layout {
  max-width: 400px;
  /* Narrower for just text */
  padding: 1.5rem;
  /* Less padding so it isn't as tall */
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: 0.2s;
}

.close-modal:hover {
  color: #fff;
}

.modal-content h3 {
  margin-bottom: 0.5rem;
  color: var(--accent-cyan);
}

#booking-details-summary {
  margin-bottom: 2rem;
  font-style: italic;
  color: var(--text-primary);
  opacity: 0.8;
}

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

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

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-main);
  font-size: 1rem;
  transition: 0.2s;
}

.form-group input.error,
.form-group textarea.error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5) !important;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-purple);
  background: rgba(255, 255, 255, 0.05);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.loader {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-style: italic;
}

/* Month Names Default */
.month-short {
  display: none;
}

.month-long {
  display: inline-block;
}

/* Mobile */
@media (max-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }

  .section {
    padding: 3rem 0;
  }

  #booking.section {
    padding-top: 8rem;
  }

  .system-status {
    font-size: 1.5rem;
  }

  .dots {
    font-size: 1.5rem;
  }

  .container {
    padding: 0 1rem;
  }

  /* Calendar Mobile */
  .calendar-wrapper {
    width: 100%;
    padding: 1rem;
  }

  .calendar-grid {
    gap: 2px;
  }

  .calendar-day {
    height: 3rem;
    /* Shorter cells for mobile */
    font-size: 0.9rem;
  }

  .calendar-header {
    margin-bottom: 1rem;
  }

  /* Release the title from absolute positioning on small screens to prevent overlap */
  .calendar-header h3 {
    position: static;
    transform: none;
    font-size: 1rem;
    flex: 1;
    /* Take up available space */
    white-space: normal;
    /* Allow wrapping if really needed */
  }

  .calendar-header button {
    width: 32px;
    height: 32px;
  }

  .calendar-header .today-btn {
    padding: 0 0.5rem;
    font-size: 0.7rem;
  }

  /* Header Scrolls on Mobile */
  header {
    position: absolute;
    /* Allows it to scroll away */
    background: transparent;
    /* Cleaner look */
    z-index: 100;
    /* Lower than modal */
  }

  /* Abbreviated Month Names */
  .month-long {
    display: none;
  }

  .month-short {
    display: inline-block;
  }
}

/* Fix "Blackspace" below footer - Ensure canvas/background covers full scroll height */
#star-canvas {
  position: fixed;
  height: 100vh;
  /* Viewport height */
  width: 100vw;
  z-index: 0;
}

body {
  background-color: var(--bg-space);
  /* Ensure background color persists even if canvas doesn't cover */
  min-height: 100vh;
}