/* ==========================================================================
   A.E. GO GALAXY — CALENDARIO
   Frontend autosuficiente y responsivo. No modifica la lógica de calendar.js.
   ========================================================================== */

.calendar-app {
  --cal-bg: #120c20;
  --cal-panel: #20152f;
  --cal-card: #291b3c;
  --cal-card-strong: #322047;
  --cal-line: rgba(216, 180, 254, 0.18);
  --cal-line-strong: rgba(216, 180, 254, 0.38);
  --cal-text: #f8fafc;
  --cal-muted: #b9afc7;
  --cal-purple: #d8b4fe;
  --cal-cyan: #67e8f9;
  --cal-green: #86efac;
  --cal-yellow: #fde68a;
  width: 100%;
  max-width: none;
  min-height: auto;
  margin: 0;
  overflow: hidden;
  color: var(--cal-text);
  font-family: inherit;
  border: 1px solid var(--cal-line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 85% 0%, rgba(139, 92, 246, 0.13), transparent 28%),
    linear-gradient(180deg, #1b1229 0%, var(--cal-bg) 100%);
  box-shadow: 0 24px 70px rgba(5, 2, 12, 0.42);
}

.calendar-app,
.calendar-app * {
  box-sizing: border-box;
}

button,
.event-card {
  font: inherit;
}

/* Cabecera --------------------------------------------------------------- */

.calendar-hero {
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: 32px 18px 28px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(192, 132, 252, 0.15), transparent 45%);
}

.calendar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.calendar-brand > span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--cal-purple);
  border: 1px solid var(--cal-line-strong);
  border-radius: 50%;
  background: rgba(192, 132, 252, 0.08);
}

.calendar-brand div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.calendar-brand b {
  color: #ead7ff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.calendar-brand small {
  margin-top: 2px;
  color: var(--cal-muted);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.api-live {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  margin: 16px auto 0;
  padding: 7px 11px;
  color: var(--cal-green);
  font-size: 10px;
  font-weight: 900;
  border: 1px solid rgba(134, 239, 172, 0.25);
  border-radius: 999px;
  background: rgba(22, 101, 52, 0.12);
}

.api-live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cal-green);
  box-shadow: 0 0 9px rgba(134, 239, 172, 0.85);
}

.hero-copy {
  width: 100%;
  padding-top: 25px;
}

.eyebrow {
  color: #f0abfc;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.hero-copy h1 {
  max-width: 850px;
  margin: 10px auto 14px;
  color: #fff;
  font-size: clamp(34px, 9vw, 54px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.045em;
}

.hero-copy h1 em {
  color: var(--cal-purple);
  font-style: normal;
}

.hero-copy p {
  max-width: 720px;
  margin: 0 auto;
  color: #cfc6d8;
  font-size: 14px;
  line-height: 1.65;
}

.live-feature {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  max-width: 780px;
  min-height: 0;
  margin: 25px auto 0;
  padding: 18px;
  text-align: left;
  color: #fff;
  border: 1px solid rgba(103, 232, 249, 0.19);
  border-radius: 18px;
  background:
    linear-gradient(120deg, rgba(8, 47, 73, 0.28), rgba(49, 46, 129, 0.18));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition: transform 160ms ease, border-color 160ms ease;
}

.live-feature:hover {
  transform: translateY(-2px);
  border-color: rgba(103, 232, 249, 0.42);
}

.live-feature span {
  color: var(--cal-cyan);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.live-feature b {
  margin-top: 7px;
  font-size: 18px;
  line-height: 1.25;
}

.live-feature small {
  margin-top: 6px;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.45;
}

/* Contenido -------------------------------------------------------------- */

.calendar-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "filters"
    "month"
    "agenda-head"
    "agenda"
    "note";
  gap: 0;
  align-items: start;
  padding: 20px 14px 44px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 0;
  background: rgba(8, 5, 15, 0.16);
}

/* Filtros */

.category-scroll {
  grid-area: filters;
  display: flex;
  gap: 9px;
  margin: 0 -14px 20px;
  padding: 2px 14px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-scroll::-webkit-scrollbar {
  display: none;
}

.category-scroll button {
  --accent: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 13px;
  color: #ddd6e5;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid var(--cal-line);
  border-radius: 999px;
  background: rgba(76, 53, 112, 0.5);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.category-scroll button:hover {
  transform: translateY(-2px);
  border-color: var(--cal-line-strong);
  background: rgba(100, 71, 145, 0.55);
}

.category-scroll button.active {
  color: #fff;
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.2);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.12);
}

.category-scroll i {
  color: var(--accent);
  font-style: normal;
}

/* Calendario mensual */

.calendar-panel {
  grid-area: month;
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--cal-line);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(48, 31, 67, 0.96), rgba(29, 20, 43, 0.98));
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
}

.calendar-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0 15px;
}

.calendar-panel h2 {
  margin: 0;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: capitalize;
  letter-spacing: -0.02em;
}

.calendar-panel header button {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  color: #fff;
  font-size: 22px;
  border: 1px solid var(--cal-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
}

.calendar-panel header button:hover {
  color: var(--cal-cyan);
  border-color: rgba(103, 232, 249, 0.4);
  background: rgba(103, 232, 249, 0.08);
}

.month-grid {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  gap: 4px;
  width: 100%;
}

.weekday {
  display: block;
  min-width: 0;
  padding: 7px 1px;
  color: #a99db5;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.month-grid button,
.empty-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  padding: 3px 1px;
  color: #e9e2ef;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
}

.month-grid button {
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.month-grid button:hover {
  transform: translateY(-1px);
  border-color: rgba(103, 232, 249, 0.25);
  background: rgba(103, 232, 249, 0.06);
}

.month-grid button.today {
  color: var(--cal-yellow);
  border-color: rgba(253, 230, 138, 0.3);
}

.month-grid button.selected {
  color: #fff;
  border-color: rgba(103, 232, 249, 0.7);
  background: rgba(103, 232, 249, 0.13);
}

.month-grid button b {
  font-size: 12px;
  line-height: 1;
}

.day-dots {
  display: flex;
  gap: 2px;
  height: 5px;
  margin-top: 6px;
}

.day-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

/* Agenda */

.agenda-head {
  grid-area: agenda-head;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 28px 3px 14px;
}

.agenda-head .eyebrow {
  font-size: 10px;
}

.agenda-head h2 {
  margin: 4px 0 0;
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: capitalize;
  letter-spacing: -0.035em;
}

.agenda-head button {
  flex: 0 0 auto;
  padding: 9px 12px;
  color: var(--cal-purple);
  font-size: 11px;
  font-weight: 900;
  border: 1px solid var(--cal-line);
  border-radius: 11px;
  background: rgba(192, 132, 252, 0.06);
  cursor: pointer;
}

.agenda-list {
  grid-area: agenda;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.event-card {
  display: flex !important;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 122px;
  padding: 11px;
  overflow: hidden;
  color: #fff;
  text-align: left;
  border: 1px solid var(--cal-line);
  border-radius: 18px;
  background:
    linear-gradient(120deg, rgba(52, 34, 73, 0.97), rgba(30, 23, 47, 0.98));
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.event-card:hover {
  transform: translateY(-3px);
  border-color: rgba(103, 232, 249, 0.32);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.24);
}

.event-card > img {
  display: block;
  flex: 0 0 92px;
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 15px;
  background: #100a19;
}

.event-info {
  flex: 1 1 auto;
  min-width: 0;
  padding: 2px 10px 2px 13px;
}

.cal-badge {
  --accent: #fff;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 8px;
  overflow: hidden;
  color: var(--accent);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.event-info h3 {
  margin: 8px 0 5px;
  overflow-wrap: anywhere;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
}

.event-info p {
  margin: 0;
  color: #c9bfd2;
  font-size: 11px;
  line-height: 1.45;
}

.event-info > small {
  display: block;
  margin-top: 8px;
  color: #ddd6e5;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.35;
}

.event-info > small.active {
  color: var(--cal-green);
}

.event-info > small.upcoming {
  color: var(--cal-purple);
}

.event-arrow {
  flex: 0 0 auto;
  padding-right: 5px;
  color: #b9acc6;
  font-size: 22px;
}

.calendar-state {
  grid-column: 1 / -1;
  display: grid;
  min-height: 160px;
  place-content: center;
  padding: 35px 15px;
  color: var(--cal-muted);
  font-size: 14px;
  text-align: center;
}

.calendar-note {
  grid-area: note;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(253, 230, 138, 0.16);
  border-radius: 16px;
  background: rgba(253, 230, 138, 0.045);
}

.calendar-note b {
  color: #fff;
  font-size: 13px;
}

.calendar-note p {
  margin: 6px 0 0;
  color: var(--cal-muted);
  font-size: 12px;
  line-height: 1.55;
}

/* Modal de detalles ------------------------------------------------------ */

.cal-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.cal-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(5, 2, 10, 0.88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.cal-sheet {
  position: relative;
  width: 100%;
  max-width: 860px;
  max-height: 94dvh;
  overflow: hidden;
  border: 1px solid rgba(192, 132, 252, 0.28);
  border-radius: 25px 25px 0 0;
  background: #171024;
  box-shadow: 0 -20px 80px rgba(0, 0, 0, 0.66);
}

.cal-sheet > header {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 235px;
  padding: 24px;
  background-color: #342148;
  background-position: center;
  background-size: cover;
}

.cal-sheet > header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 15%, #171024 100%);
}

.cal-sheet > header > button {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  font-size: 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(16, 11, 25, 0.75);
  cursor: pointer;
}

.cal-sheet > header > div {
  position: relative;
  z-index: 2;
}

.cal-sheet h2 {
  max-width: 650px;
  margin: 8px 0 6px;
  color: #fff;
  font-size: clamp(27px, 7vw, 36px);
  font-weight: 900;
  line-height: 1.05;
}

.cal-sheet header p {
  margin: 0;
  color: #ddd5e4;
  font-size: 13px;
  line-height: 1.45;
}

.cal-sheet-body {
  max-height: calc(94dvh - 235px);
  padding: 20px 18px 48px;
  overflow-y: auto;
}

.detail-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px;
  border: 1px solid var(--cal-line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.04);
}

.detail-status span {
  font-size: 11px;
  font-weight: 900;
}

.detail-status span.active {
  color: var(--cal-green);
}

.detail-status span.upcoming {
  color: var(--cal-purple);
}

.detail-status span.past {
  color: #a8a0af;
}

.detail-status b {
  font-size: 12px;
}

.cal-sheet-body section {
  margin-top: 28px;
}

.cal-sheet-body h3 {
  margin: 4px 0 14px;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.pokemon-strip {
  display: flex;
  gap: 10px;
  padding-bottom: 4px;
  overflow-x: auto;
}

.pokemon-strip > div,
.shiny-grid > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--cal-line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.04);
}

.pokemon-strip > div {
  flex: 0 0 120px;
}

.pokemon-strip img {
  width: 82px;
  height: 82px;
  object-fit: contain;
}

.pokemon-strip b,
.shiny-grid b {
  color: #fff;
  font-size: 11px;
  text-align: center;
}

.pokemon-strip small {
  margin-top: 5px;
  color: var(--cal-yellow);
  font-size: 9px;
}

.bonus-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bonus-list > div {
  display: flex;
  align-items: center;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--cal-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.bonus-list img,
.bonus-list i {
  width: 42px;
  height: 42px;
  margin-right: 11px;
  object-fit: contain;
}

.bonus-list i {
  display: grid;
  place-items: center;
  color: var(--cal-yellow);
  font-style: normal;
}

.bonus-list span {
  color: #e8e1ed;
  font-size: 12px;
  line-height: 1.45;
}

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

.shiny-grid img {
  width: 74px;
  height: 74px;
  object-fit: contain;
}

.research-list details {
  margin-bottom: 8px;
  border: 1px solid var(--cal-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.research-list summary {
  padding: 14px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.research-list ul {
  margin: 0;
  padding: 0 14px 14px;
  list-style: none;
}

.research-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  color: #ddd5e4;
  font-size: 11px;
  border-top: 1px solid var(--cal-line);
}

.research-list li b {
  color: var(--cal-purple);
  text-align: right;
}

.source-button {
  display: block;
  margin-top: 25px;
  padding: 14px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  border: 1px solid rgba(216, 180, 254, 0.22);
  border-radius: 14px;
  background: linear-gradient(100deg, #6e4b95, #573879);
}

.empty-detail {
  padding: 28px;
  color: var(--cal-muted);
  font-size: 13px;
  text-align: center;
}

/* Tablet y escritorio ---------------------------------------------------- */

@media (min-width: 640px) {
  .calendar-hero {
    padding: 40px 28px 31px;
  }

  .api-live {
    position: absolute;
    top: 24px;
    right: 25px;
    margin: 0;
  }

  .hero-copy h1 br {
    display: none;
  }

  .hero-copy h1 em::before {
    content: " ";
  }

  .live-feature {
    align-items: center;
    text-align: center;
  }

  .calendar-content {
    padding: 24px 24px 48px;
  }

  .category-scroll {
    justify-content: center;
    flex-wrap: wrap;
    margin: 0 0 25px;
    padding: 0;
    overflow: visible;
  }

  .calendar-panel {
    padding: 19px;
  }

  .month-grid {
    gap: 6px;
  }

  .month-grid button,
  .empty-day {
    min-height: 54px;
  }

  .month-grid button b {
    font-size: 13px;
  }

  .weekday {
    font-size: 11px;
  }

  .event-card {
    padding: 12px;
  }

  .event-card > img {
    flex-basis: 108px;
    width: 108px;
    height: 108px;
  }

  .event-info h3 {
    font-size: 17px;
  }

  .event-info p {
    font-size: 12px;
  }

  .event-info > small {
    font-size: 11px;
  }

  .cal-modal {
    align-items: center;
    padding: 18px;
  }

  .cal-sheet {
    border-radius: 25px;
  }

  .cal-sheet > header {
    min-height: 270px;
    padding: 28px;
  }

  .cal-sheet-body {
    max-height: calc(94dvh - 270px);
    padding: 24px 28px 52px;
  }

  .shiny-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .calendar-content {
    grid-template-columns: minmax(330px, 0.72fr) minmax(0, 1.28fr);
    grid-template-areas:
      "filters filters"
      "month agenda-head"
      "month agenda"
      "note agenda";
    gap: 0 24px;
    padding: 27px 30px 52px;
  }

  .calendar-panel {
    position: sticky;
    top: 18px;
  }

  .agenda-head {
    padding: 2px 3px 16px;
  }

  .agenda-head h2 {
    font-size: 32px;
  }

  .calendar-note {
    margin-top: 15px;
  }
}

@media (min-width: 1120px) {
  .calendar-content {
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 0 30px;
    padding-inline: 34px;
  }

  .calendar-panel {
    padding: 20px;
  }
}

/* Pantallas pequeñas ----------------------------------------------------- */

@media (max-width: 420px) {
  .calendar-app {
    border-radius: 20px;
  }

  .calendar-hero {
    padding-inline: 15px;
  }

  .calendar-brand small {
    display: none;
  }

  .hero-copy h1 {
    font-size: clamp(32px, 11vw, 42px);
  }

  .calendar-content {
    padding-inline: 10px;
  }

  .category-scroll {
    margin-inline: -10px;
    padding-inline: 10px;
  }

  .calendar-panel {
    padding: 11px;
  }

  .calendar-panel h2 {
    font-size: 17px;
  }

  .calendar-panel header button {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
  }

  .month-grid {
    gap: 2px;
  }

  .month-grid button,
  .empty-day {
    min-height: 40px;
    border-radius: 9px;
  }

  .weekday {
    font-size: 9px;
  }

  .event-card > img {
    flex-basis: 78px;
    width: 78px;
    height: 78px;
  }

  .event-info {
    padding-left: 9px;
    padding-right: 4px;
  }

  .event-info h3 {
    font-size: 14px;
  }

  .event-arrow {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .calendar-app *,
  .calendar-app *::before,
  .calendar-app *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
