/* ──────────────────────────────────────────────
   NKCalendar — Dark-themed date picker
   Nielsen Korea Ratings Page
   ────────────────────────────────────────────── */

/* ── Wrapper ── */
.nk-cal-wrap {
  position: relative;
  display: inline-flex;
}

/* ── Trigger button ── */
.nk-cal-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.08);
  color: var(--artifact-white, #FFF);
  border: 1px solid var(--artifact-line-dark, rgba(255,255,255,0.24));
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-family: inherit;
  min-height: 40px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 24px;
  transition: border-color 0.2s, background 0.2s;
}
.nk-cal-trigger::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.45;
  transition: transform 0.15s, opacity 0.15s;
  flex-shrink: 0;
}
.nk-cal-wrap:has(.is-open) .nk-cal-trigger::after {
  transform: rotate(180deg);
  opacity: 0.7;
}
.nk-cal-trigger:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.36);
}
.nk-cal-trigger:focus-visible {
  border-color: var(--artifact-aqua, #32BBB9);
  outline: 2px solid var(--artifact-aqua, #32BBB9);
  outline-offset: 2px;
}

/* ── Popup ── */
.nk-cal-popup {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  background: var(--artifact-ink, #00162D);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  padding: 16px;
  width: 308px;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255,255,255,0.04);

  /* Hidden by default */
  opacity: 0;
  transform: scale(0.96) translateY(-6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.nk-cal-popup.is-open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* ── Header ── */
.nk-cal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 2px;
}

.nk-cal-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: transparent;
  color: var(--artifact-muted-dark, #C1CDDF);
  border: none;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  padding: 0;
}
.nk-cal-nav:hover {
  color: var(--artifact-white, #FFF);
  background: rgba(255,255,255,0.08);
}

.nk-cal-month {
  font-size: 15px;
  font-weight: 600;
  color: var(--artifact-white, #FFF);
  letter-spacing: -0.01em;
  user-select: none;
}

/* ── Day-name row ── */
.nk-cal-dn {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.nk-cal-dn span {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--artifact-muted-dark, #C1CDDF);
  letter-spacing: 0.04em;
}
.nk-cal-dn .nk-cal-sun {
  color: rgba(244, 9, 83, 0.6);
}

/* ── Grid ── */
.nk-cal-grid {
  padding-top: 4px;
  transition: opacity 0.12s ease;
}
.nk-cal-grid.nk-cal-fade {
  opacity: 0;
}

/* ── Week row ── */
.nk-cal-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

/* ── Day cell ── */
.nk-cal-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  background: transparent;
  color: var(--artifact-white, #FFF);
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, color 0.12s;
}
.nk-cal-cell span {
  position: relative;
  z-index: 1;
  line-height: 1;
  pointer-events: none;
}
.nk-cal-cell:hover {
  background: rgba(255,255,255,0.08);
}

/* Sunday column — reddish */
.nk-cal-cell.nk-cal-sun {
  color: rgba(244, 9, 83, 0.75);
}

/* Other month — dimmed */
.nk-cal-cell.nk-cal-dim {
  color: rgba(255,255,255,0.2);
}
.nk-cal-cell.nk-cal-dim.nk-cal-sun {
  color: rgba(244, 9, 83, 0.22);
}

/* Today — aqua dot */
.nk-cal-cell.nk-cal-today::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--artifact-aqua, #32BBB9);
  pointer-events: none;
}

/* ── Daily: selected date ── */
.nk-cal-cell.nk-cal-sel {
  background: var(--artifact-purple, #6E37FA);
  color: #FFF !important;
  font-weight: 600;
}
.nk-cal-cell.nk-cal-sel:hover {
  background: var(--artifact-purple-ink, #4D19C5);
}

/* ── Weekly: selected week band ── */
.nk-cal-cell.nk-cal-wsel {
  background: rgba(110, 55, 250, 0.30);
  color: #FFF;
  border-radius: 0;
}
.nk-cal-cell.nk-cal-wsel.nk-cal-ws {
  border-radius: 6px 0 0 6px;
}
.nk-cal-cell.nk-cal-wsel.nk-cal-we {
  border-radius: 0 6px 6px 0;
}
.nk-cal-cell.nk-cal-wsel:hover {
  background: rgba(110, 55, 250, 0.42);
}

/* ── Weekly: hover week band ── */
.nk-cal-cell.nk-cal-wh {
  background: rgba(255,255,255,0.06);
  border-radius: 0;
}
.nk-cal-cell.nk-cal-wh.nk-cal-whs {
  border-radius: 6px 0 0 6px;
}
.nk-cal-cell.nk-cal-wh.nk-cal-whe {
  border-radius: 0 6px 6px 0;
}

/* Overlap: selected + hover */
.nk-cal-cell.nk-cal-wsel.nk-cal-wh {
  background: rgba(110, 55, 250, 0.42);
}

/* ── Responsive ── */

/* Touch-friendly cells (≤768px) */
@media screen and (max-width: 768px) {
  .nk-cal-cell {
    height: 42px;
  }
  .nk-cal-trigger {
    min-height: 44px;
    font-size: 13px;
  }
}

/* Mobile: full-width popup (≤650px) */
@media screen and (max-width: 650px) {
  .nk-cal-popup {
    position: fixed;
    left: 16px;
    right: 16px;
    top: auto;
    bottom: 16px;
    width: auto;
    max-width: none;
    padding: 16px;
  }
  .nk-cal-trigger {
    width: 100%;
    justify-content: center;
  }
  .nk-cal-cell {
    height: 44px;
    font-size: 14px;
  }
}

/* Very small screens: bottom sheet (≤400px) */
@media screen and (max-width: 400px) {
  .nk-cal-popup {
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px 12px 0 0;
    padding: 16px 12px;
  }
}

/* Small mobile (≤360px) */
@media screen and (max-width: 360px) {
  .nk-cal-trigger {
    font-size: 12px;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
  }
}

/* Galaxy Fold closed (≤280px) */
@media screen and (max-width: 280px) {
  .nk-cal-popup {
    padding: 12px 8px;
  }
  .nk-cal-cell {
    height: 36px;
    font-size: 12px;
  }
  .nk-cal-trigger {
    font-size: 11px;
    min-height: 38px;
    padding: 6px 10px;
  }
  .nk-cal-month {
    font-size: 13px;
  }
  .nk-cal-nav {
    width: 26px;
    height: 26px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .nk-cal-popup {
    transition: none;
  }
  .nk-cal-grid.nk-cal-fade {
    transition: none;
  }
}

/* Print */
@media print {
  .nk-cal-wrap {
    display: none;
  }
}
