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

body {
  font-family: "Inter", sans-serif;
  background-color: #111827;
  color: #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background-color: #111827;
}

.background-blur {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;

  background-image: url("images/background.jpg");
  background-size: cover;
  background-position: center center;

  filter: blur(2.5px);
}

.container {
  width: 100%;
  max-width: 60rem;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 2rem;
  margin-top: 0.55rem;
}

header h1 {
  position: relative;
  font-size: clamp(1.8rem, 5vw, 2.25rem);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.025em;
}

header h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #3b82f6, transparent);
  animation: trail 4s infinite linear;
}

@keyframes trail {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 200% 0;
  }
}

main {
  background-color: #1f2937;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  min-height: 24rem;
}

#error-message {
  background-color: rgba(127, 29, 29, 0.2);
}
#error-message p {
  color: #f87171;
  text-align: center;
  margin-top: 1rem;
}
#error-details {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.5rem;
}

#error-icon {
  width: 48px;
  height: 48px;
  border: 3px solid #f87171;
  border-radius: 50%;
  position: relative;
}
#error-icon::before,
#error-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 3px;
  background-color: #f87171;
  transform-origin: center;
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(45deg);
}
#error-icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 4px solid #374151;
  border-top-color: #3b82f6;
  margin-bottom: 1rem;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#content-wrapper {
  display: block;
}
.content-padding {
  padding: clamp(1rem, 4vw, 1.5rem);
}

.media-container {
  background-color: #111827;
  aspect-ratio: 16 / 9;
  margin: 1rem;
  padding: 0.25rem;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

#apod-image,
#apod-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#text-content {
  padding: 1.5rem;
}
#apod-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
}
#apod-date {
  font-size: 0.875rem;
  color: #9ca3af;
  margin: 0.25rem 0 1rem;
}

#apod-explanation {
  line-height: 1.625;
  max-height: 15rem;
  overflow-y: auto;
  padding-right: 0.75rem;

  scrollbar-width: thin;
  scrollbar-color: #4b5563 #1f2937;
}

#navigation {
  background-color: rgba(31, 41, 55, 0.5);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid #374151;
}

.nav-btn {
  background-color: #3b82f6;
  color: #ffffff;
  font-weight: 700;
  position: relative;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  overflow: hidden;
  z-index: 1;
  transition: color 200ms ease;
}

.nav-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background-color: #1e40af;
  transition: left 200ms ease;
  z-index: -1;
}
.nav-btn:not(:disabled):hover::before {
  left: 0;
}

.nav-btn:not(:disabled):hover {
  color: #ffffff;
}

#today-btn::before {
  display: none;
}

#today-btn {
  background: transparent;
  border: 1px solid #4f8ff7;
  color: #a5c8fa;
}

#today-btn:hover:not(:disabled) {
  background-color: rgba(59, 130, 246, 0.2);
  color: #ffffff;
}

.nav-btn:disabled {
  background-color: #6b7280;
  cursor: not-allowed;
  opacity: 0.7;
}

.nav-btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
