/* Home page schedule block (templates/home.html)
   Keep styles scoped to avoid affecting /schedule/ page.
*/

.home-schedule {
  --home-schedule-accent: var(--home-schedule-accent, var(--accent-secondary, var(--color-primary, #32b8c6)));
  /* Base look: dark + compact (per request) */
  --home-schedule-surface: rgba(0, 0, 0, 0.62);
  --home-schedule-border: rgba(255, 255, 255, 0.10);
  --home-schedule-shadow: 0 18px 46px rgba(0, 0, 0, 0.32);
  --home-schedule-text: #ffffff;
  --home-schedule-muted: rgba(255, 255, 255, 0.72);
  --home-schedule-item-bg: rgba(0, 0, 0, 0.34);
  --home-schedule-item-border: rgba(255, 255, 255, 0.12);
}

/* Light themes: make schedule cards light (per request) */
html[data-theme="light"] .home-schedule,
html[data-theme="light_japan"] .home-schedule {
  --home-schedule-surface: rgba(255, 255, 255, 0.92);
  --home-schedule-border: rgba(0, 0, 0, 0.12);
  --home-schedule-shadow: 0 18px 46px rgba(0, 0, 0, 0.12);
  --home-schedule-text: #0b1220;
  --home-schedule-muted: rgba(11, 18, 32, 0.70);
  --home-schedule-item-bg: rgba(255, 255, 255, 0.92);
  --home-schedule-item-border: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .home-schedule,
html[data-theme="light_japan"] .home-schedule{
  color: var(--home-schedule-text);
}

/* Light theme tabs: light surfaces, dark text */
html[data-theme="light"] .home-schedule a.schedule-day-link.home-schedule__tab,
html[data-theme="light_japan"] .home-schedule a.schedule-day-link.home-schedule__tab{
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.12);
}
html[data-theme="light"] .home-schedule a.schedule-day-link.home-schedule__tab.active,
html[data-theme="light_japan"] .home-schedule a.schedule-day-link.home-schedule__tab.active{
  background: color-mix(in srgb, var(--home-schedule-accent) 16%, rgba(255, 255, 255, 0.92));
  border-color: color-mix(in srgb, var(--home-schedule-accent) 55%, rgba(0, 0, 0, 0.12));
}

html[data-theme="neon"] .home-schedule,
html[data-theme="hard_japan"] .home-schedule {
  --home-schedule-border: rgba(255, 255, 255, 0.16);
  --home-schedule-shadow: 0 18px 46px rgba(0, 0, 0, 0.42);
  --home-schedule-muted: rgba(255, 255, 255, 0.72);
  --home-schedule-item-bg: rgba(0, 0, 0, 0.42);
  --home-schedule-item-border: rgba(255, 255, 255, 0.14);
}

.home-schedule .heading.style-1 h2.home-schedule__title {
  color: var(--home-schedule-text) !important;
  font-size: 26px !important;
  font-weight: 900 !important;
  letter-spacing: 0.02em !important;
  margin: 0 !important;
}

.home-schedule .schedule-box {
  position: relative;
  width: 100%;
}

.home-schedule .card.home-schedule__card {
  position: relative;
  overflow: visible;
  border-radius: 16px;
  /* No "big background" behind schedule - only floating blocks */
  background: transparent;
  border: none;
  box-shadow: none;
}

.home-schedule__bg-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  background: var(--home-schedule-bg-color, transparent);
}

.home-schedule__bg-item {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}

.home-schedule__bg-item.is-active {
  opacity: 1;
}

.home-schedule__bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /*
    Управляется из "Редактора сайта" через CSS vars:
      --home-schedule-bg-blur: 0..100 (превращаем в 0..20px через *0.2)
      --home-schedule-bg-dim:  0..100 (превращаем в brightness 1..0)
  */
  filter:
    blur(calc(var(--home-schedule-bg-blur, 20) * 0.2px))
    brightness(calc(1 - (var(--home-schedule-bg-dim, 20) / 100)));
  transform: scale(1.06);
}

html[data-theme="neon"] .home-schedule__bg-img,
html[data-theme="hard_japan"] .home-schedule__bg-img {
  filter:
    blur(calc(var(--home-schedule-bg-blur, 20) * 0.2px))
    brightness(calc(1 - (var(--home-schedule-bg-dim, 35) / 100)));
}

.home-schedule__inner {
  position: relative;
  z-index: 1;
  padding: 18px 16px;
  background: transparent;
}

html[data-theme="neon"] .home-schedule__inner,
html[data-theme="hard_japan"] .home-schedule__inner {
  background: transparent;
}

/* Tabs */
.home-schedule .card-header.home-schedule__header {
  background: transparent;
  border-bottom: 1px solid var(--home-schedule-border);
  padding: 0;
}

/* Cancel global "always dark" schedule header from themes/base.css */
.home-schedule .schedule-box .card-header,
.home-schedule .schedule-box .card-header-tabs,
.home-schedule .schedule-box .nav-tabs {
  background: transparent !important;
  backdrop-filter: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

.home-schedule .date-slider.home-schedule__tabs {
  border: none;
  margin: 0;
  display: flex;
  justify-content: flex-start;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 8px;
  padding: 12px 6px;
}
.home-schedule .date-slider.home-schedule__tabs::-webkit-scrollbar { display: none; }

.home-schedule .date-slider.home-schedule__tabs {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 992px){
  .home-schedule .date-slider.home-schedule__tabs {
    justify-content: center;
  }
}

.home-schedule .home-schedule__tabs .nav-item {
  flex: 0 0 auto;
  min-width: 84px;
}

.home-schedule a.schedule-day-link.home-schedule__tab {
  border: 1px solid var(--home-schedule-border);
  border-radius: 12px;
  padding: 7px 9px;
  /* Tabs should match the dark schedule card */
  background: rgba(0, 0, 0, 0.34);
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

/* Today/tomorrow slightly larger */
.home-schedule a.home-schedule__tab[data-day-offset="0"],
.home-schedule a.home-schedule__tab[data-day-offset="1"] {
  min-width: 96px;
}

html[data-theme="neon"] .home-schedule a.schedule-day-link.home-schedule__tab,
html[data-theme="hard_japan"] .home-schedule a.schedule-day-link.home-schedule__tab {
  background: rgba(0, 0, 0, 0.34);
}

.home-schedule a.schedule-day-link.home-schedule__tab:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--home-schedule-accent) 35%, var(--home-schedule-border));
}

.home-schedule a.schedule-day-link.home-schedule__tab.active {
  background: color-mix(in srgb, var(--home-schedule-accent) 18%, rgba(0, 0, 0, 0.34));
  border-color: color-mix(in srgb, var(--home-schedule-accent) 55%, var(--home-schedule-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--home-schedule-accent) 18%, transparent);
}

html[data-theme="neon"] .home-schedule a.schedule-day-link.home-schedule__tab.active,
html[data-theme="hard_japan"] .home-schedule a.schedule-day-link.home-schedule__tab.active {
  background: color-mix(in srgb, var(--home-schedule-accent) 18%, rgba(0, 0, 0, 0.20));
}

.home-schedule__tab-date {
  font-size: 11px;
  margin: 0;
  white-space: nowrap;
  color: var(--home-schedule-muted);
  font-weight: 800;
}

.home-schedule__tab-label {
  font-size: 13px;
  font-weight: 900;
  margin: 6px 0 0 0;
  white-space: nowrap;
  color: var(--home-schedule-text);
}

/* Body list */
.home-schedule .card-body.home-schedule__body {
  padding: 12px !important;
  background: transparent !important;
}

/* ui.css has a global `.tab-content { display:none; }` for custom tabs.
   This block uses Bootstrap tabs, so we must force it visible here. */
.home-schedule .tab-content {
  display: block !important;
}

/* Ensure tab panes actually take space (some bootstrap overrides can collapse them) */
.home-schedule .tab-content > .tab-pane {
  display: none;
}
.home-schedule .tab-content > .active {
  display: block;
}
.home-schedule .tab-pane.fade {
  opacity: 1;
}

/* Schedule list (2 columns on desktop, 1 on mobile) */
.home-schedule__lists{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
  max-height: min(480px, 58vh);
  overflow: auto;
  padding-right: 4px; /* room for scrollbar */
  overscroll-behavior: contain;
  max-width: 1200px;
  margin: 0 auto;
}

.home-schedule__lists > *{
  min-width: 0;
}

@media (min-width: 992px){
  .home-schedule__lists{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
  }
}

.home-schedule__col{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 991px){
  .home-schedule__lists{
    max-height: min(520px, 62vh);
  }
}

.home-schedule__lists::-webkit-scrollbar{
  width: 8px;
}
.home-schedule__lists::-webkit-scrollbar-thumb{
  background: color-mix(in srgb, var(--home-schedule-accent) 40%, rgba(255,255,255,0.18));
  border-radius: 999px;
}
.home-schedule__lists::-webkit-scrollbar-track{
  background: rgba(0,0,0,0.20);
  border-radius: 999px;
}

.home-schedule__item {
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--home-schedule-item-bg);
  border: 1px solid var(--home-schedule-item-border);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  position: relative;
  overflow: hidden;
  /* Center all inner content vertically to avoid "big bottom gap" */
  display: flex;
  align-items: center;
}

.home-schedule__item{
  min-height: 118px;
}

@media (min-width: 992px){
  /* Make cards visually uniform in the 2-col grid */
  .home-schedule__item{
    height: 124px;
  }
}

.home-schedule__item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--home-schedule-accent) 35%, var(--home-schedule-item-border));
  background: color-mix(in srgb, var(--home-schedule-accent) 10%, var(--home-schedule-item-bg));
}

.home-schedule__episode{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--home-schedule-text) !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--home-schedule-item-border);
  background: color-mix(in srgb, var(--home-schedule-accent) 18%, rgba(0,0,0,0.24));
  width: auto !important;
  min-width: 0 !important;
  max-width: 160px;
  position: static;
}

.home-schedule__episode--center{
  justify-self: center;
}

.home-schedule__row{
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 116px;
  grid-template-rows: auto auto;
  gap: 8px 12px;
  align-items: center;
  width: 100%;
}

.home-schedule__poster-wrap{
  grid-column: 1;
  grid-row: 1 / span 2;
}

.home-schedule__poster {
  width: 56px;
  height: 80px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--home-schedule-item-border);
  background: rgba(0, 0, 0, 0.12);
}

.home-schedule__meta{
  min-width: 0;
  grid-column: 2;
  grid-row: 1 / span 2;
  text-align: left;
}
.home-schedule__meta-top{
  display:flex;
  align-items:center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.home-schedule__content-title{
  margin: 0 !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  line-height: 1.15 !important;
  color: var(--home-schedule-text) !important;
  text-transform: none !important;
  letter-spacing: 0.01em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.home-schedule__chips{
  display:flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-right: 0;
  justify-content: flex-start;
  /* Keep height stable across cards */
  max-height: 44px;
  overflow: hidden;
}

.home-schedule__chips .schedule-button{
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Right-side badges column */
.home-schedule__episode{
  grid-column: 3;
  grid-row: 1 / span 2;
  justify-self: center;
  align-self: center;
}

/* smaller chips (type/voiceover) + avoid hover overlay glitches */
.home-schedule .schedule-button{
  font-size: 10px !important;
  padding: 5px 8px !important;
  line-height: 1 !important;
  position: relative;
  z-index: 2;
  color: #fff !important;
  background: rgba(0,0,0,0.18);
  border-color: var(--home-schedule-item-border) !important;
}
.home-schedule .schedule-button:hover{
  /* Don't change stacking/size on hover to avoid "underlapping" the title row */
  z-index: 2;
  transform: none !important;
  box-shadow: none !important;
}
.home-schedule .btn-tag.btn-tag--voice.schedule-button{
  padding: 4px 7px !important;
  font-size: 9px !important;
}

/* Colorful chips on home schedule */
.home-schedule .btn-toggle.btn-toggle--status.schedule-button{
  border-color: rgba(76, 175, 80, 0.40) !important;
  background: rgba(76, 175, 80, 0.14) !important;
  color: #eafff0 !important;
}
.home-schedule .type-button.schedule-button{
  border-color: rgba(76, 175, 80, 0.40) !important;
  background: rgba(76, 175, 80, 0.14) !important;
  color: #eafff0 !important;
}
.home-schedule .btn-tag.btn-tag--voice.schedule-button{
  border-color: rgba(99, 102, 241, 0.42) !important;
  background: rgba(99, 102, 241, 0.14) !important;
  color: #eef2ff !important;
}

/* Light theme chips: dark text on light cards */
html[data-theme="light"] .home-schedule .schedule-button,
html[data-theme="light_japan"] .home-schedule .schedule-button{
  color: var(--home-schedule-text) !important;
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(0, 0, 0, 0.14) !important;
}

html[data-theme="light"] .home-schedule .type-button.schedule-button,
html[data-theme="light_japan"] .home-schedule .type-button.schedule-button{
  background: rgba(76, 175, 80, 0.14) !important;
  border-color: rgba(46, 125, 50, 0.35) !important;
  color: #2e7d32 !important;
}
html[data-theme="light"] .home-schedule .btn-toggle.btn-toggle--status.schedule-button,
html[data-theme="light_japan"] .home-schedule .btn-toggle.btn-toggle--status.schedule-button{
  background: rgba(76, 175, 80, 0.14) !important;
  border-color: rgba(46, 125, 50, 0.35) !important;
  color: #2e7d32 !important;
}
html[data-theme="light"] .home-schedule .btn-tag.btn-tag--voice.schedule-button,
html[data-theme="light_japan"] .home-schedule .btn-tag.btn-tag--voice.schedule-button{
  background: rgba(99, 102, 241, 0.12) !important;
  border-color: rgba(79, 70, 229, 0.35) !important;
  color: #4f46e5 !important;
}

/* Responsive: on small screens, don't force an extra column for the episode badge */
@media (max-width: 520px){
  .home-schedule__row{
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 10px;
  }
  .home-schedule__poster-wrap{
    grid-row: 1 / span 3;
  }
  .home-schedule__meta{
    grid-column: 2;
    grid-row: 1 / span 2;
    text-align: left;
  }
  .home-schedule__meta-top,
  .home-schedule__chips{
    justify-content: flex-start;
  }
  .home-schedule__episode{
    grid-column: 2;
    grid-row: 3;
    justify-self: center;
  }
}

.home-schedule__divider {
  display: none !important;
}

.home-schedule__empty {
  color: var(--home-schedule-muted);
  text-align: center;
  padding: 22px 12px;
  margin: 0;
  font-weight: 700;
}

@media (max-width: 768px) {
  .home-schedule .heading.style-1 h2.home-schedule__title {
    font-size: 22px !important;
  }
  .home-schedule__inner {
    padding: 18px 14px;
  }
  .home-schedule .home-schedule__tabs .nav-item {
    min-width: 86px;
  }
}


