@import url("./cinema-tabs-shared.css?v=1");

/* Randomizer refresh/session + idle/loading presentation. */

/* Healthy catalogue counts are implementation detail. Keep only states that need attention. */
.cinema-randomizer-page [data-randomizer-source-health] {
  display: none !important;
}

.cinema-randomizer-page [data-randomizer-source-health][data-tone="warning"],
.cinema-randomizer-page [data-randomizer-source-health][data-tone="error"] {
  display: grid !important;
}

.cinema-randomizer-page [data-randomizer-status][hidden] {
  display: none !important;
}

.randomizer-genre-match-mode {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -4px -2px 9px;
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px;
  background: rgba(12,15,24,.96);
  backdrop-filter: blur(8px);
}

.randomizer-genre-match-mode[hidden] {
  display: none !important;
}

.randomizer-genre-match-mode > span {
  color: #85899a;
  font-size: .66rem;
  font-weight: 750;
}

.randomizer-genre-match-mode > div {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 7px;
  background: rgba(255,255,255,.04);
}

.randomizer-genre-match-mode button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #8f93a2;
  font: inherit;
  font-size: .64rem;
  font-weight: 800;
  cursor: pointer;
}

.randomizer-genre-match-mode button.is-active {
  border-color: rgba(155,92,255,.38);
  background: rgba(120,62,190,.28);
  color: #eadcff;
}

.cinema-randomizer-idle,
.cinema-randomizer-loading,
.cinema-randomizer-no-match {
  grid-column: 1 / -1;
  width: min(100%, 520px);
  min-height: 390px;
  padding: 24px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  overflow: hidden;
  border: 1px solid rgba(155,92,255,.22);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 38%, rgba(124,67,198,.16), transparent 42%),
    #0d101a;
  text-align: center;
}

.cinema-randomizer-idle > img,
.cinema-randomizer-loading-mascot img,
.cinema-randomizer-no-match > img {
  width: min(100%, 300px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 14px;
  filter: drop-shadow(0 18px 34px rgba(0,0,0,.26));
}

.cinema-randomizer-idle strong,
.cinema-randomizer-loading strong,
.cinema-randomizer-no-match strong {
  color: #f1eef6;
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: -.01em;
}

.cinema-randomizer-no-match span {
  margin-top: -7px;
  color: #818596;
  font-size: .72rem;
  font-weight: 650;
}

.cinema-randomizer-loading-mascot {
  display: grid;
  place-items: center;
  animation: comrade-randomizer-loading-pulse 1.8s ease-in-out infinite;
}

@keyframes comrade-randomizer-loading-pulse {
  0%, 100% { transform: translateY(0) scale(1); opacity: .94; }
  50% { transform: translateY(-5px) scale(1.02); opacity: 1; }
}

html[data-comrade-theme="light"] .randomizer-genre-match-mode {
  border-color: rgba(24,28,39,.09);
  background: rgba(255,255,255,.96);
}

html[data-comrade-theme="light"] .randomizer-genre-match-mode > div {
  background: rgba(24,28,39,.04);
}

html[data-comrade-theme="light"] .randomizer-genre-match-mode button.is-active {
  border-color: rgba(119,65,204,.25);
  background: rgba(119,65,204,.1);
  color: #6735a9;
}

html[data-comrade-theme="light"] .cinema-randomizer-idle,
html[data-comrade-theme="light"] .cinema-randomizer-loading,
html[data-comrade-theme="light"] .cinema-randomizer-no-match {
  border-color: rgba(119,65,204,.16);
  background:
    radial-gradient(circle at 50% 38%, rgba(126,69,203,.10), transparent 42%),
    #ffffff;
}

html[data-comrade-theme="light"] .cinema-randomizer-idle strong,
html[data-comrade-theme="light"] .cinema-randomizer-loading strong,
html[data-comrade-theme="light"] .cinema-randomizer-no-match strong {
  color: #242733;
}

html[data-comrade-theme="light"] .cinema-randomizer-no-match span {
  color: #6c7280;
}

@media (max-width: 760px) {
  .cinema-randomizer-idle,
  .cinema-randomizer-loading,
  .cinema-randomizer-no-match {
    width: 100%;
    min-height: 310px;
    padding: 18px;
  }

  .cinema-randomizer-idle > img,
  .cinema-randomizer-loading-mascot img,
  .cinema-randomizer-no-match > img {
    width: min(100%, 238px);
  }

  .randomizer-genre-match-mode {
    align-items: stretch;
  }

  .randomizer-genre-match-mode > div {
    flex: 1;
  }

  .randomizer-genre-match-mode button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cinema-randomizer-loading-mascot { animation: none; }
}

/* Final Randomizer tab geometry must match Search exactly. */
body.cinema-v2.cinema-randomizer-page .cinema-primary-tabs {
  min-height: 48px !important;
  height: 48px !important;
  max-height: 48px !important;
  padding: 0 !important;
  justify-content: flex-start !important;
  gap: 22px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

body.cinema-v2.cinema-randomizer-page .cinema-primary-tabs > a {
  min-height: 46px !important;
  height: 46px !important;
  max-height: 46px !important;
  padding: 0 11px !important;
  gap: 8px !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  font-size: .92rem !important;
  font-weight: 400 !important;
  line-height: 1 !important;
}

body.cinema-v2.cinema-randomizer-page .cinema-primary-tabs > a.is-active,
body.cinema-v2.cinema-randomizer-page .cinema-primary-tabs > a[aria-current="page"] {
  border-bottom-color: #b05cff !important;
  background: transparent !important;
}

body.cinema-v2.cinema-randomizer-page .cinema-primary-tabs > a > svg {
  width: 19px !important;
  min-width: 19px !important;
  height: 19px !important;
  min-height: 19px !important;
  flex: 0 0 19px !important;
}
