:root {
  --bg-dark: #050816;
  --header-bg: rgba(11, 15, 26, 0.92);
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.1);
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --accent-warm: #f6c85f;
  --accent-warm-dark: #b87915;
  --text-primary: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.72);
  --danger: #ef6262;
  --transition-smooth: 0.3s ease;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

/* Inicio: base de la landing integrada */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 32%),
    linear-gradient(180deg, #02040d 0%, #050816 48%, #071120 100%);
  color: var(--text-primary);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

img,
iframe {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  background: var(--header-bg);
  border-bottom: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.navbar {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding: 1rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo img {
  width: 46px;
  height: 46px;
}

.logo h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  list-style: none;
}

.hero {
  position: relative;
  min-height: 72vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 120px 24px 80px;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(5, 8, 22, 0.55), rgba(5, 8, 22, 0.86));
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(59, 130, 246, 0.18), transparent 42%),
    rgba(0, 0, 0, 0.5);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 820px;
}

.hero-kicker {
  margin-bottom: 12px;
  color: var(--accent-warm);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-content h1 {
  margin-bottom: 18px;
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  font-weight: 800;
  line-height: 1.05;
}

.hero-content p:last-child {
  max-width: 640px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
}

.search-container,
.apod-result-container,
.favorites-section {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.search-container {
  margin-top: 48px;
  margin-bottom: 24px;
  text-align: center;
}

.section-title {
  margin-bottom: 20px;
  font-size: 1.85rem;
  font-weight: 700;
}

.search-form {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.custom-date-input {
  min-height: 46px;
  padding: 10px 16px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  outline: none;
  transition: border-color var(--transition-smooth);
  color-scheme: dark;
}

.custom-date-input:focus {
  border-color: var(--accent-color);
}

.btn-primary {
  min-height: 46px;
  padding: 10px 24px;
  color: #ffffff;
  background: var(--accent-color);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-smooth), transform 0.1s ease;
}

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

.btn-primary:active {
  transform: scale(0.97);
}

.apod-result-container {
  margin-bottom: 64px;
}

.apod-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1.05fr);
  gap: 30px;
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.apod-image-wrapper {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.media-frame {
  display: grid;
  width: 100%;
  min-height: 320px;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(9, 17, 34, 0.92), rgba(2, 4, 13, 1));
}

.media-frame img,
.media-frame iframe,
.media-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}

.media-frame iframe {
  min-height: 320px;
}

.image-placeholder {
  padding: 20px;
  color: var(--text-muted);
  text-align: center;
}

.apod-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.apod-info__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.apod-date {
  color: var(--accent-color);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.apod-title {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-weight: 700;
  line-height: 1.15;
}

.apod-description {
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.apod-favorite-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  color: #fff1d2;
  background: rgba(246, 200, 95, 0.08);
  border: 1px solid rgba(246, 200, 95, 0.24);
  border-radius: 999px;
  cursor: pointer;
  transition: transform var(--transition-smooth), background-color var(--transition-smooth), border-color var(--transition-smooth), color var(--transition-smooth);
}

.apod-favorite-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.apod-favorite-button:hover {
  background: rgba(246, 200, 95, 0.18);
  border-color: rgba(246, 200, 95, 0.42);
  transform: translateY(-1px);
}

.apod-favorite-button.is-saved {
  color: #ffe29a;
  background: rgba(184, 121, 21, 0.24);
  border-color: rgba(246, 200, 95, 0.56);
}

.footer {
  width: 100%;
  margin-top: 80px;
  padding: 2.5rem 1.5rem;
  background: rgba(6, 9, 22, 0.85);
  border-top: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.footer-container {
  width: min(1200px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  text-align: center;
}

.footer-info p,
.footer-copy p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.footer-info a,
.footer-links a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

.footer-info a:hover,
.footer-links a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
/* Fin: base de la landing integrada */

/* Inicio: sistema de favoritos de Jonathan */
.favorite-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  color: #fff1d2;
  background: rgba(246, 200, 95, 0.12);
  border: 1px solid rgba(246, 200, 95, 0.28);
  border-radius: 999px;
  cursor: pointer;
  transition: transform var(--transition-smooth), background-color var(--transition-smooth), border-color var(--transition-smooth);
}

.favorite-button__icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
}

.favorite-button__icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.favorite-button__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.favorite-button__badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-grid;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  place-items: center;
  color: #ffffff;
  background: #8d2d2d;
  border: 2px solid #fff3de;
  border-radius: 999px;
  font-size: 0.82rem;
  line-height: 1;
}

.favorite-button:hover {
  background: rgba(246, 200, 95, 0.22);
  border-color: rgba(246, 200, 95, 0.48);
  transform: translateY(-1px);
}

.favorite-button.is-saved {
  color: #ffe29a;
  background: rgba(184, 121, 21, 0.26);
  border-color: rgba(246, 200, 95, 0.56);
}

.favorites-section {
  margin-bottom: 48px;
}

.favorites-shell {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.favorites-eyebrow {
  margin-bottom: 6px;
  color: var(--accent-warm);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#favorites-title {
  margin: 0;
  font-size: 2rem;
}

#favorites-count {
  display: inline-grid;
  min-width: 36px;
  min-height: 36px;
  place-items: center;
  color: #1d1604;
  background: var(--accent-warm);
  border-radius: 999px;
  font-weight: 700;
}

.empty-state {
  color: var(--text-muted);
}

.carousel {
  padding: 8px 52px 0;
}

.carousel-indicators {
  position: static;
  margin: 0 0 18px;
}

.carousel-indicators [data-bs-target] {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background-color: rgba(246, 200, 95, 0.5);
}

.carousel-indicators .active {
  background-color: var(--accent-warm);
}

.favorites-slide {
  padding: 4px 0;
}

.favorites-slide__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.favorite-item {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  min-height: 220px;
  padding: 18px;
  background: var(--surface-strong);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}

.favorite-load {
  min-width: 0;
  padding: 0;
  color: var(--text-primary);
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.favorite-load strong,
.favorite-load span {
  display: block;
}

.favorite-load strong {
  margin-bottom: 8px;
  font-size: 1.05rem;
  line-height: 1.25;
}

.favorite-load span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.favorite-summary {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.favorite-delete {
  justify-self: end;
  width: 34px;
  height: 34px;
  color: var(--text-primary);
  background: rgba(239, 98, 98, 0.16);
  border: 1px solid rgba(239, 98, 98, 0.4);
  border-radius: 6px;
  cursor: pointer;
}

.favorite-delete:hover {
  background: rgba(239, 98, 98, 0.28);
}

.carousel-control-prev,
.carousel-control-next {
  width: 40px;
  height: 40px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  opacity: 1;
}

.carousel-control-prev {
  left: 0;
}

.carousel-control-next {
  right: 0;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
  background: rgba(255, 255, 255, 0.16);
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
  width: 1rem;
  height: 1rem;
}
/* Fin: sistema de favoritos de Jonathan */

/* Inicio: responsive */
@media (max-width: 900px) {
  .apod-card {
    grid-template-columns: 1fr;
  }

  .favorites-slide__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .navbar {
    width: calc(100% - 28px);
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-container {
    text-align: left;
    align-items: flex-start;
  }
}

@media (max-width: 620px) {
  .hero {
    min-height: 64vh;
    padding: 110px 16px 64px;
  }

  .search-container,
  .apod-result-container,
  .favorites-section {
    width: calc(100% - 24px);
  }

  .search-form {
    flex-direction: column;
  }

  .favorite-button {
    width: 52px;
  }

  .favorites-shell {
    padding: 20px;
  }

  .carousel {
    padding: 0;
  }

  .carousel-control-prev,
  .carousel-control-next {
    display: none;
  }
}
/* Fin: responsive */
