/* Film in onda ora — card grid */
.xmltv-fday {
  max-width: 1200px;
  margin: 0 auto 32px;
  padding: 0 4px;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--xmltv-text, #1a2233);
}
.xmltv-channel-page.xmltv-films-page .xmltv-fday {
  margin-left: 16px;
  margin-right: 16px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--xmltv-card, #fff), var(--xmltv-card, #fff)) padding-box,
    linear-gradient(105deg, #0d47a1 0%, #1565c0 42%, #1a237e 72%, #b71c1c 100%) border-box;
  box-shadow: 0 8px 24px rgba(13, 71, 161, 0.08);
}
.xmltv-fday-head {
  margin-bottom: 18px;
}
.xmltv-fday-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  color: var(--xmltv-text, #1a2233);
  line-height: 1.25;
}
.xmltv-fday-sub {
  margin: 0;
  font-size: 14px;
  color: var(--xmltv-muted, #6b7684);
  line-height: 1.4;
}
.xmltv-fday-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  align-items: stretch;
}
@media (min-width: 700px) {
  .xmltv-fday-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 18px;
  }
}
@media (max-width: 420px) {
  .xmltv-fday-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

/* Card */
.xmltv-fday-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--xmltv-card, #fff);
  border: 1px solid var(--xmltv-border, #e2e8f0);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.xmltv-fday-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(13, 71, 161, 0.16);
}

/* Poster area */
.xmltv-fday-poster {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  background-size: cover;
  background-position: center top;
  background-color: #1a237e;
  text-decoration: none;
  overflow: hidden;
}
.xmltv-fday-poster::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 45%;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Badge IN ONDA / A BREVE */
.xmltv-fday-live,
.xmltv-fday-soon,
.xmltv-fday-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 52px);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.xmltv-fday-live,
.xmltv-fday-card.is-onair .xmltv-fday-badge {
  background: #b71c1c;
}
.xmltv-fday-soon,
.xmltv-fday-card.is-soon .xmltv-fday-badge,
.xmltv-fday-card.is-soon .xmltv-fday-soon {
  background: #1565c0;
}
.xmltv-fday-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45);
  animation: xmltv-fday-pulse 1.3s ease-in-out infinite;
}
@keyframes xmltv-fday-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.45); }
  50% { opacity: 0.55; box-shadow: 0 0 0 6px rgba(255, 82, 82, 0); }
}

/* Channel chip */
.xmltv-fday-ch {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 20px);
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xmltv-fday-ch img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
  background: #fff;
  flex-shrink: 0;
}
.xmltv-fday-ch-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Info button */
.xmltv-fday-info,
button.xmltv-fday-info {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 32px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: background 0.15s ease, transform 0.15s ease;
}
.xmltv-fday-info:hover,
button.xmltv-fday-info:hover {
  background: #1565c0;
  transform: scale(1.05);
}

/* Meta sotto poster */
.xmltv-fday-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  padding: 10px 12px 12px;
  min-width: 0;
  background: var(--xmltv-card, #fff);
}
.xmltv-fday-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--xmltv-text, #1a2233);
  text-decoration: none;
  word-break: break-word;
}
.xmltv-fday-name:hover {
  color: #1565c0;
}
.xmltv-fday-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--xmltv-muted, #6b7684);
  line-height: 1.3;
}
.xmltv-fday-genre {
  font-size: 11px;
  font-weight: 600;
  color: #ff7a2f;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xmltv-fday-empty {
  margin: 16px 0 0;
  padding: 16px;
  text-align: center;
  color: var(--xmltv-muted, #6b7684);
  font-size: 14px;
}

/* Load more */
.xmltv-fday-loader {
  text-align: center;
  padding: 22px 12px 8px;
}
.xmltv-fday-loader.is-done {
  display: none;
}
.xmltv-fday-load-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 12px 22px !important;
  border-radius: 999px !important;
  border: none !important;
  background: linear-gradient(105deg, #0d47a1 0%, #1565c0 50%, #b71c1c 100%) !important;
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(13, 71, 161, 0.3);
}
.xmltv-fday-load-btn:hover {
  filter: brightness(1.06);
}
.xmltv-fday-load-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}
.xmltv-fday-load-status {
  display: block;
  margin-top: 10px;
  font-size: 13px;
}

/* Dark theme */
.xmltv-theme-dark .xmltv-fday-card,
.xmltv-theme-dark .xmltv-fday-meta {
  background: var(--xmltv-card, #1a2332);
  border-color: var(--xmltv-border, #2a3548);
}
.xmltv-theme-dark .xmltv-fday-name {
  color: var(--xmltv-text, #e8eef7);
}
.xmltv-theme-dark .xmltv-fday-time {
  color: var(--xmltv-muted, #9aa8bc);
}
.xmltv-theme-dark .xmltv-channel-page.xmltv-films-page .xmltv-fday {
  background:
    linear-gradient(var(--xmltv-card, #1a2332), var(--xmltv-card, #1a2332)) padding-box,
    linear-gradient(105deg, #0d47a1 0%, #1565c0 42%, #1a237e 72%, #b71c1c 100%) border-box;
}

/* -------------------------------------------------------------------------
   Pagina /film-in-onda-ora/ — header + griglia centrata
   ------------------------------------------------------------------------- */
.xmltv-channel-page.xmltv-films-page {
  max-width: 1200px;
  margin: 0 auto 40px;
  padding: 0 16px;
  box-sizing: border-box;
}

/* Torna alla guida TV */
.xmltv-films-page .xmltv-back-link {
  margin: 8px 0 18px;
  text-align: center;
}
.xmltv-films-page .xmltv-back-link a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(21, 101, 192, 0.25);
  background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
  color: #0d47a1 !important;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(13, 71, 161, 0.1);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.xmltv-films-page .xmltv-back-link a:hover {
  background: linear-gradient(105deg, #0d47a1 0%, #1565c0 55%, #b71c1c 100%);
  color: #fff !important;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(13, 71, 161, 0.25);
}

/* Titolo + sottotitolo */
.xmltv-films-page .xmltv-channel-page-title {
  text-align: center;
  margin: 0 auto 22px;
  max-width: 720px;
  padding: 0 8px;
}
.xmltv-films-page .xmltv-channel-page-title h1 {
  margin: 0 0 10px;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--xmltv-text, #1a2233);
  background: linear-gradient(105deg, #0d47a1 0%, #1565c0 45%, #b71c1c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
/* Fallback se background-clip non supportato */
@supports not (background-clip: text) {
  .xmltv-films-page .xmltv-channel-page-title h1 {
    color: #0d47a1;
    -webkit-text-fill-color: #0d47a1;
    background: none;
  }
}
.xmltv-films-page .xmltv-channel-page-title .description,
.xmltv-films-page .xmltv-channel-page-title p.description {
  margin: 0 auto !important;
  max-width: 560px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--xmltv-muted, #6b7684) !important;
  opacity: 1 !important;
}

/* Box griglia centrato */
.xmltv-films-page .xmltv-fday {
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: 1100px;
}
.xmltv-films-page .xmltv-fday-head {
  text-align: center;
}
.xmltv-films-page .xmltv-fday-title {
  text-align: center;
}
.xmltv-films-page .xmltv-fday-sub {
  text-align: center;
}
.xmltv-films-page .xmltv-fday-grid {
  justify-content: center;
  margin: 0 auto;
}

/* Mobile */
@media (max-width: 560px) {
  .xmltv-channel-page.xmltv-films-page {
    padding: 0 10px;
  }
  .xmltv-films-page .xmltv-back-link a {
    width: 100%;
    max-width: 320px;
    justify-content: center;
  }
  .xmltv-channel-page.xmltv-films-page .xmltv-fday {
    margin-left: 0;
    margin-right: 0;
    padding: 14px 12px 16px;
  }
}

/* Dark */
.xmltv-theme-dark .xmltv-films-page .xmltv-back-link a {
  background: #1a2332;
  border-color: #2a3548;
  color: #90caf9 !important;
}
.xmltv-theme-dark .xmltv-films-page .xmltv-back-link a:hover {
  color: #fff !important;
}
.xmltv-theme-dark .xmltv-films-page .xmltv-channel-page-title .description {
  color: var(--xmltv-muted, #9aa8bc) !important;
}
