/* kalender-dayview.css v2 — Day view event redesign
   FullCalendar 6.1.11 — SkrivSikkert Calendar
   Target: Danish school children 10-16, many with dyslexia
   Brand: Encouraging, playful, smart
   ──────────────────────────────────────────────────── */

/* ════════════════════════════════════════════════════
   1. EVENT BLOCKS — Colorful cards with left accent
   ════════════════════════════════════════════════════ */

/* Event cards: colorful cards with left accent + gaps between columns */
.fc-view-harness .fc-timeGridDay-view .fc-timegrid-event {
  /* Gaps: shrink inset so adjacent cards never touch */
  left: 4px !important;
  right: 4px !important;
  top: 3px !important;
  bottom: 3px !important;
  /* Card style */
  border: none !important;
  border-left: 5px solid var(--cat-color, var(--color-text-primary)) !important;
  border-radius: 0 8px 8px 0 !important;
  background: var(--cat-bg, rgba(0, 0, 0, 0.08)) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07), 0 0 0 1px rgba(0, 0, 0, 0.03);
  padding: 5px 10px !important;
  font-family: 'Nunito Sans', sans-serif !important;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  overflow: hidden !important;
}

.fc-view-harness .fc-timeGridDay-view .fc-timegrid-event .fc-event-main {
  padding: 0 !important;
  color: var(--cat-text, rgb(19, 19, 19));
  overflow: hidden;
}

/* Hover: lift right + deeper shadow */
.fc-view-harness .fc-timeGridDay-view .fc-timegrid-event:hover {
  transform: translateX(2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10), 0 1px 4px rgba(0, 0, 0, 0.06);
  background: var(--cat-bg-hover, rgba(0, 0, 0, 0.15)) !important;
  z-index: 10 !important;
}

/* Active/press */
.fc-view-harness .fc-timeGridDay-view .fc-timegrid-event:active {
  transform: scale(0.98);
  transition-duration: 0.08s;
}

/* Focus ring for keyboard nav */
.fc-view-harness .fc-timeGridDay-view .fc-timegrid-event:focus-visible {
  outline: 2px solid rgba(31, 31, 30, 0.3);
  outline-offset: 2px;
}

/* Overlapping events: slight opacity to distinguish layers */
.fc-view-harness .fc-timeGridDay-view .fc-timegrid-event-harness-inset .fc-timegrid-event {
  opacity: 0.92;
  box-shadow: -2px 0 6px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.05);
}
.fc-view-harness .fc-timeGridDay-view .fc-timegrid-event-harness-inset .fc-timegrid-event:hover {
  opacity: 1;
}


/* ════════════════════════════════════════════════════
   2. CUSTOM EVENT CONTENT — dot + time + title
   ════════════════════════════════════════════════════ */

/* Container */
.cal-tg-event {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  height: 100%;
  font-family: 'Nunito Sans', sans-serif;
}

/* Short: horizontal single-line */
.cal-tg-event--short {
  flex-direction: row;
  align-items: center;
}

/* Line (holds dot + time in a row) */
.cal-tg-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

/* Category color dot */
.cal-tg-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
}

/* Time text */
.cal-tg-time {
  font-size: 12px;
  font-weight: 650;
  opacity: 0.65;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}

/* Event title */
.cal-tg-title {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Short: title sits next to time */
.cal-tg-event--short .cal-tg-title {
  margin-left: 4px;
  font-size: 13px;
}

/* Long: title can wrap */
.cal-tg-event--long .cal-tg-title {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}


/* ════════════════════════════════════════════════════
   3. "+N MERE" OVERFLOW — Prominent pill badge
   ════════════════════════════════════════════════════ */

.fc-view-harness .fc-timeGridDay-view .fc-timegrid-more-link {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 44px;
  padding: 4px 12px;
  font-size: 13px !important;
  font-weight: 650 !important;
  color: #fff !important;
  background: var(--color-text-primary) !important;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-decoration: none !important;
  line-height: 1.2;
  z-index: 5;
}

.fc-view-harness .fc-timeGridDay-view .fc-timegrid-more-link:hover {
  background: rgb(50, 50, 48) !important;
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.fc-view-harness .fc-timeGridDay-view .fc-timegrid-more-link:active {
  transform: scale(0.95);
  transition-duration: 0.08s;
}

/* Week view: gaps between event columns */
.fc-view-harness .fc-timeGridWeek-view .fc-timegrid-event {
  left: 2px !important;
  right: 2px !important;
  top: 1px !important;
  bottom: 1px !important;
}

/* Week view: same treatment */
.fc-view-harness .fc-timeGridWeek-view .fc-timegrid-more-link {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 8px;
  font-size: 11px !important;
  font-weight: 650 !important;
  color: #fff !important;
  background: var(--color-text-primary) !important;
  border-radius: 11px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  text-decoration: none !important;
}


/* ════════════════════════════════════════════════════
   4. POPOVER — Styled floating card
   ════════════════════════════════════════════════════ */

.fc-popover.fc-more-popover {
  border: 0.5px solid rgba(0, 0, 0, 0.08) !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.06) !important;
  overflow: hidden;
  min-width: 240px;
  max-width: 340px;
  font-family: 'Nunito Sans', sans-serif;
  animation: cal-popover-in 0.18s ease;
  z-index: 100 !important;
}

@keyframes cal-popover-in {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.fc-popover.fc-more-popover .fc-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px !important;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
  background: #f8f8f6 !important;
}

.fc-popover.fc-more-popover .fc-popover-title {
  font-size: 15px !important;
  font-weight: 650 !important;
  color: var(--color-text-primary);
}

.fc-popover.fc-more-popover .fc-popover-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--color-text-tertiary);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.fc-popover.fc-more-popover .fc-popover-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--color-text-primary);
}

.fc-popover.fc-more-popover .fc-popover-body {
  padding: 8px 10px 10px !important;
  max-height: 320px;
  overflow-y: auto;
}

/* Custom scrollbar */
.fc-popover.fc-more-popover .fc-popover-body::-webkit-scrollbar { width: 4px; }
.fc-popover.fc-more-popover .fc-popover-body::-webkit-scrollbar-track { background: transparent; }
.fc-popover.fc-more-popover .fc-popover-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.10);
  border-radius: 6px;
}

/* Events inside popover: mini-cards */
.fc-popover.fc-more-popover .fc-event {
  border: none !important;
  border-left: 4px solid var(--cat-color, var(--color-text-primary)) !important;
  border-radius: 6px !important;
  background: var(--cat-bg, rgba(0, 0, 0, 0.08)) !important;
  padding: 6px 10px !important;
  margin: 4px 0 !important;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
  display: block !important;
  min-height: 32px;
}

.fc-popover.fc-more-popover .fc-event:hover {
  background: var(--cat-bg-hover, rgba(0, 0, 0, 0.15)) !important;
  transform: translateX(2px);
}

.fc-popover.fc-more-popover .fc-event .fc-event-main {
  color: var(--cat-text, rgb(19, 19, 19));
  font-weight: 600 !important;
  font-size: 13px !important;
}

.fc-popover.fc-more-popover .fc-daygrid-event-dot { display: none !important; }


/* ════════════════════════════════════════════════════
   5. DARK MODE
   ════════════════════════════════════════════════════ */

[data-theme="dark"] .fc-view-harness .fc-timeGridDay-view .fc-timegrid-event {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.04);
}
[data-theme="dark"] .fc-view-harness .fc-timeGridDay-view .fc-timegrid-event:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .cal-tg-dot {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .fc-popover.fc-more-popover {
  background: var(--color-card, #1e1e2e) !important;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}
[data-theme="dark"] .fc-popover.fc-more-popover .fc-popover-header {
  background: rgba(255, 255, 255, 0.03) !important;
  border-bottom-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .fc-popover.fc-more-popover .fc-popover-title {
  color: #e8ecf4;
}
[data-theme="dark"] .fc-popover.fc-more-popover .fc-popover-close {
  color: rgba(255, 255, 255, 0.5);
}
[data-theme="dark"] .fc-popover.fc-more-popover .fc-popover-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e8ecf4;
}


/* ════════════════════════════════════════════════════
   6. REDUCED MOTION
   ════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .fc-popover.fc-more-popover { animation: none !important; }
  .fc-view-harness .fc-timeGridDay-view .fc-timegrid-event,
  .fc-view-harness .fc-timeGridDay-view .fc-timegrid-more-link,
  .fc-popover.fc-more-popover .fc-event { transition: none !important; }
}


/* ════════════════════════════════════════════════════
   7. RESPONSIVE — Mobile & Tablet adjustments
   ════════════════════════════════════════════════════ */

/* ── Small tablets & large phones (< 768px) ── */
@media (max-width: 767px) {
  /* Day view: slightly smaller text */
  .cal-tg-title { font-size: 13px; }
  .cal-tg-time { font-size: 11px; }
  .cal-tg-dot { width: 7px; height: 7px; }

  /* Day view "+N" pill: compact */
  .fc-view-harness .fc-timeGridDay-view .fc-timegrid-more-link {
    min-width: 36px;
    min-height: 24px;
    padding: 3px 8px;
    font-size: 12px !important;
    border-radius: 12px;
  }

  /* Week view: even more compact events */
  .fc-view-harness .fc-timeGridWeek-view .fc-timegrid-event {
    padding: 2px 4px !important;
  }
  .fc-view-harness .fc-timeGridWeek-view .cal-tg-title { font-size: 11px; }
  .fc-view-harness .fc-timeGridWeek-view .cal-tg-time { font-size: 10px; }
  .fc-view-harness .fc-timeGridWeek-view .cal-tg-dot { width: 6px; height: 6px; }

  /* Popover: fit within mobile viewport */
  .fc-popover.fc-more-popover {
    min-width: 200px;
    max-width: calc(100vw - 24px) !important;
  }
}

/* ── Mobile phones (< 480px) ── */
@media (max-width: 479px) {
  /* Day view: when eventMaxStack=1 via JS, event is full-width.
     Make text generous and clear since there's plenty of room. */
  .cal-tg-title { font-size: 14px; }
  .cal-tg-time { font-size: 12px; }

  /* Day view "+N" pill: must not overlap events */
  .fc-view-harness .fc-timeGridDay-view .fc-timegrid-more-link {
    min-width: 32px;
    min-height: 22px;
    padding: 2px 8px;
    font-size: 11px !important;
    border-radius: 11px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  }

  /* Day view: tighter gaps on single-column layout */
  .fc-view-harness .fc-timeGridDay-view .fc-timegrid-event {
    left: 2px !important;
    right: 2px !important;
  }

  /* Week view: hide dots entirely, just show truncated text */
  .fc-view-harness .fc-timeGridWeek-view .cal-tg-dot { display: none; }
  .fc-view-harness .fc-timeGridWeek-view .cal-tg-line { gap: 2px; }
  .fc-view-harness .fc-timeGridWeek-view .cal-tg-time { font-size: 9px; }
  .fc-view-harness .fc-timeGridWeek-view .cal-tg-title { font-size: 10px; }
  .fc-view-harness .fc-timeGridWeek-view .fc-timegrid-event {
    padding: 1px 2px !important;
    border-left-width: 3px !important;
  }

  /* Week "+N" pill: smaller */
  .fc-view-harness .fc-timeGridWeek-view .fc-timegrid-more-link {
    min-height: 18px;
    padding: 1px 5px;
    font-size: 9px !important;
    border-radius: 9px;
  }

  /* Popover: full-width on mobile */
  .fc-popover.fc-more-popover {
    min-width: 180px;
    max-width: calc(100vw - 16px) !important;
    left: 8px !important;
    right: 8px !important;
  }
}
