/* ==========================================================================
   CareMetrix — Holiday Calendar
   Shared primitives: .card, .btn family.
   ========================================================================== */

.hcal {
  --hcal-event: #7C3AED; --hcal-event-bg: #EDE9FE;
  --hcal-holiday: #0D9488; --hcal-holiday-bg: #CCFBF1;
  --hcal-bday-p: #DB2777; --hcal-bday-p-bg: #FCE7F3;
  --hcal-bday-s: #EA580C; --hcal-bday-s-bg: #FFEDD5;
  --hcal-weekend-bg: #FDF2F4;
}

/* Bleed past .content's shared gutter so this page sits flush against the
   edges, without touching that padding for every other module. */
.page.hcal { margin: calc(var(--gutter) * -1); }

.hcal-shell { padding: 0; border-radius: 0; }

.hcal-shell__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.hcal-shell__title { display: flex; align-items: center; gap: 14px; }
.hcal-shell__icon {
  width: 44px; height: 44px; border-radius: 12px; background: var(--violet-bg); color: var(--brand-purple);
  display: grid; place-items: center; flex: none;
}
.hcal-shell__icon svg { width: 20px; height: 20px; }
.hcal-shell__title h1 { font-size: 19px; font-weight: 700; margin: 0; }
.hcal-shell__title p { font-size: 12.5px; color: var(--text-2); margin: 3px 0 0; }

.hcal-viewselect { position: relative; }
.hcal-viewselect > button {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px; border: 1.5px solid var(--brand-purple); border-radius: var(--r-btn);
  background: var(--surface); color: var(--brand-purple); font-size: 13px; font-weight: 700;
}
.hcal-viewselect__menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; min-width: 140px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; display: none;
}
.hcal-viewselect__menu.is-open { display: block; }
.hcal-viewselect__menu button {
  width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-2);
}
.hcal-viewselect__menu button:hover { background: var(--violet-bg); color: var(--brand-purple); }
.hcal-viewselect__menu button.is-active { background: var(--violet-bg); color: var(--brand-purple); font-weight: 700; }

.hcal-shell__body { display: grid; grid-template-columns: 280px 1fr; }

/* ---- sidebar ---- */
.hcal-sidebar { padding: 20px; border-right: 1px solid var(--border); }

.hcal-mini__nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.hcal-mini__label { font-size: 13.5px; font-weight: 700; color: var(--text); }
.hcal-mini__arrows { display: flex; align-items: center; gap: 4px; }
.hcal-mini__arrows button { width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; color: var(--text-3); }
.hcal-mini__arrows button svg { width: 13px; height: 13px; }
.hcal-mini__arrows button:hover { background: var(--violet-bg); color: var(--brand-purple); }

.hcal-mini__weekdays { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.hcal-mini__weekdays span { text-align: center; font-size: 10px; font-weight: 700; color: var(--text-3); }

.hcal-mini__grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 4px; }
.hcal-mini__cell { height: 26px; display: grid; place-items: center; font-size: 11.5px; color: var(--text-2); position: relative; cursor: pointer; border-radius: 50%; }
.hcal-mini__cell--outside { color: var(--text-3); opacity: .5; cursor: default; }
.hcal-mini__cell:not(.hcal-mini__cell--outside):hover span { background: var(--violet-bg); }
.hcal-mini__cell span { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; }
.hcal-mini__cell--today span { background: var(--brand-purple); color: #fff; font-weight: 700; }
.hcal-mini__cell--selected span { background: var(--violet-bg); color: var(--brand-purple); font-weight: 700; }

.hcal-overview { margin: 18px 0 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.hcal-overview h4 { font-size: 14px; font-weight: 700; margin: 0; }
.hcal-overview p { font-size: 11.5px; color: var(--text-3); margin: 2px 0 0; }

.hcal-sec { margin-bottom: 4px; }
.hcal-sec__head {
  display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700;
  color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; padding: 10px 0 8px;
}
.hcal-sec__head--toggle { width: 100%; justify-content: space-between; border-top: 1px solid var(--border); }
.hcal-sec__head--toggle > span { display: flex; align-items: center; gap: 8px; }

.hcal-sec__head--withadd { justify-content: space-between; }
.hcal-sec__head--withadd > span { display: flex; align-items: center; gap: 8px; }
.hcal-sec__add {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: none;
  background: var(--violet-bg);
  color: var(--brand-purple);
  cursor: pointer;
  flex: none;
}
.hcal-sec__add svg { width: 14px; height: 14px; }
.hcal-sec__add:hover { background: var(--brand-purple); color: #fff; }
.hcal-chev { width: 14px; height: 14px; color: var(--text-3); transition: transform .16s var(--ease); }
.hcal-sec--collapsible.is-open .hcal-chev { transform: rotate(180deg); }

.hcal-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.hcal-dot--event { background: var(--hcal-event); }
.hcal-dot--holiday { background: var(--hcal-holiday); }
.hcal-dot--birthday-p { background: var(--hcal-bday-p); }
.hcal-dot--birthday-s { background: var(--hcal-bday-s); }

.hcal-sec__body { display: flex; flex-direction: column; gap: 10px; padding-bottom: 6px; }
.hcal-sec__body[hidden] { display: none; }
.hcal-upcoming { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.hcal-upcoming__badge {
  flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--violet-bg); color: var(--brand-purple);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05;
}
.hcal-upcoming__badge span { font-size: 8.5px; font-weight: 700; text-transform: uppercase; }
.hcal-upcoming__badge b { font-size: 13px; }
.hcal-upcoming__name { font-size: 12.5px; font-weight: 700; color: var(--text); }
.hcal-upcoming__time { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.hcal-sec__empty { font-size: 12px; color: var(--text-3); font-style: italic; }

.hcal-bday-row, .hcal-holiday-row { display: flex; align-items: center; gap: 10px; }
.hcal-bday-row__icon, .hcal-holiday-row__icon {
  flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 14px;
}
.hcal-bday-row__info { flex: 1; min-width: 0; }
.hcal-bday-row__name, .hcal-holiday-row__name { font-size: 12.5px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hcal-bday-row__date, .hcal-holiday-row__date { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.hcal-bday-row__wish {
  flex: none; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid;
  font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.hcal-bday-row__wish--p { border-color: var(--hcal-bday-p); background: var(--hcal-bday-p-bg); color: var(--hcal-bday-p); }
.hcal-bday-row__wish--p:hover { background: var(--hcal-bday-p); color: #fff; }
.hcal-bday-row__wish--s { border-color: var(--hcal-bday-s); background: var(--hcal-bday-s-bg); color: var(--hcal-bday-s); }
.hcal-bday-row__wish--s:hover { background: var(--hcal-bday-s); color: #fff; }

/* ---- birthday wish drawer ---- */
.hcal-wish__profile { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.hcal-wish__avatar { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 16px; font-weight: 700; }
.hcal-wish__name { font-size: 15px; font-weight: 700; color: var(--text); }
.hcal-wish__meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.hcal-wish__channels { display: flex; gap: 8px; flex-wrap: wrap; }
.hcal-wish__chbtn {
  height: 32px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.hcal-wish__chbtn.is-active { border-color: var(--brand-purple); background: var(--violet-bg); color: var(--brand-purple); }

/* ---- main calendar ---- */
.hcal-main { padding: 20px 24px; min-width: 0; }

.hcal-monthbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.hcal-monthbar__label { font-size: 16px; font-weight: 700; color: var(--text); }
.hcal-navbtn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: inline-grid; place-items: center; transition: all .14s var(--ease); }
.hcal-navbtn svg { width: 15px; height: 15px; }
.hcal-navbtn:hover { background: var(--violet-bg); color: var(--brand-purple); border-color: var(--brand-purple); }

.hcal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.hcal-weekdays span { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; padding-bottom: 8px; }

/* ---- month view: week bands ---- */
.hcal-weekband { margin-bottom: 4px; }
.hcal-weekband__label {
  font-size: 11px; font-weight: 700; color: var(--brand-purple); text-transform: uppercase; letter-spacing: .05em;
  background: var(--violet-bg); padding: 7px 14px; border-radius: 8px 8px 0 0;
}
.hcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 96px; border: 1px solid var(--border); }
.hcal-weekband .hcal-grid { border-top: none; }
.hcal-day {
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 6px; display: flex; flex-direction: column; gap: 3px; overflow: hidden; position: relative;
}
.hcal-grid .hcal-day:nth-child(7n) { border-right: none; }
.hcal-day--weekend { background: var(--hcal-weekend-bg); }
.hcal-day--outside { color: var(--text-3); }
.hcal-day--outside .hcal-day__num { color: var(--text-3); opacity: .5; }
.hcal-day__num { font-size: 12.5px; font-weight: 700; color: var(--text); }
.hcal-day--today .hcal-day__num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 21px; height: 21px; border-radius: 50%; background: var(--brand-purple); color: #fff;
}
.hcal-day__items { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.hcal-chip {
  display: flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; line-height: 1.3; color: #fff;
  padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.hcal-chip--event { background: var(--hcal-event); }
.hcal-chip--holiday { background: var(--hcal-holiday); }
.hcal-chip--birthday-p { background: var(--hcal-bday-p); }
.hcal-chip--birthday-s { background: var(--hcal-bday-s); }
.hcal-day__more { font-size: 10.5px; font-weight: 700; color: var(--brand-purple); cursor: pointer; }

/* ---- week view ---- */
.hcal-weekview { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.hcal-weekview__head { display: grid; grid-template-columns: 70px repeat(7, 1fr); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.hcal-weekview__head span { text-align: center; padding: 10px 4px; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; }
.hcal-weekview__head .hcal-weekview__daynum { display: block; font-size: 14px; color: var(--text); margin-top: 2px; }
.hcal-weekview__head .is-today .hcal-weekview__daynum {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; background: var(--brand-purple); color: #fff;
}

.hcal-weekview__allday { display: grid; grid-template-columns: 70px repeat(7, 1fr); border-bottom: 1px solid var(--border); min-height: 36px; }
.hcal-weekview__allday .hcal-weekview__rowlabel { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; padding: 8px; }
.hcal-weekview__allday .hcal-weekview__cell { border-left: 1px solid var(--border); padding: 4px; }

.hcal-weekview__body { max-height: 480px; overflow-y: auto; }
.hcal-hourrow { display: grid; grid-template-columns: 70px repeat(7, 1fr); border-bottom: 1px solid var(--border); min-height: 52px; }
.hcal-hourrow .hcal-weekview__rowlabel { font-size: 10.5px; font-weight: 600; color: var(--text-3); padding: 6px 8px; }
.hcal-weekview__cell { border-left: 1px solid var(--border); padding: 3px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; min-width: 0; }
.hcal-weekview__cell--weekend { background: var(--hcal-weekend-bg); }
.hcal-weekview__cell .hcal-chip { width: 100%; box-sizing: border-box; }

/* ---- legend ---- */
.hcal-legend { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--border); }
.hcal-legend__item { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-2); }

/* ---- day popover ---- */
.hcal-daypop {
  position: fixed; z-index: 140; width: 260px; max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 12px; display: none;
}
.hcal-daypop.is-open { display: block; }
.hcal-daypop__title { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 8px; }
.hcal-daypop__item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.hcal-daypop__item:first-of-type { border-top: none; }
.hcal-daypop__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex: none; }
.hcal-daypop__name { font-size: 12.5px; font-weight: 700; color: var(--text); }
.hcal-daypop__meta { font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* ---- item detail drawer ---- */
.hcal-fd__body { padding-top: 6px; }
.hcal-fieldrow { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.hcal-fieldrow:last-child { border-bottom: none; }
.hcal-fieldrow__label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.hcal-fieldrow__value { font-size: 14px; font-weight: 700; color: var(--text); text-align: right; }

@media (max-width: 900px) {
  .hcal-shell__body { grid-template-columns: 1fr; }
  .hcal-sidebar { border-right: none; border-bottom: 1px solid var(--border); }
  .hcal-grid { grid-auto-rows: 76px; }
  .hcal-weekview__head, .hcal-weekview__allday, .hcal-hourrow { grid-template-columns: 50px repeat(7, 1fr); }
}
