/* =============================================================
   Clinic Hours Manager — Frontend CSS  v1.0.0
   Brand palette: #0E6C5A (forest green), neutral greys
   ============================================================= */

/* ── Schedule ──────────────────────────────────────────────── */
.chm-hours-wrap { font-family: inherit; }

/* Full-chain selectors beat theme overrides without !important fights */
.chm-hours-wrap .chm-schedule {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  border: 1.5px solid #D4DBD8 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.chm-hours-wrap .chm-schedule .chm-schedule__row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  align-items: stretch !important;
  border-bottom: 1px solid #E5EAE7 !important;
  margin: 0 !important;
  padding: 0 !important;
}
.chm-hours-wrap .chm-schedule .chm-schedule__row:last-child {
  border-bottom: none !important;
}

.chm-hours-wrap .chm-schedule .chm-schedule__day {
  padding: 15px 22px !important;
  font-size: 0.93rem !important;
  font-weight: 700 !important;
  color: #111827 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  border-right: 1.5px solid #E5EAE7 !important;
  margin: 0 !important;
  line-height: 1.4 !important;
  background: transparent !important;
}

.chm-hours-wrap .chm-schedule .chm-schedule__hours {
  padding: 15px 22px !important;
  font-size: 0.9rem !important;
  color: #374151 !important;
  font-variant-numeric: tabular-nums !important;
  font-weight: 400 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin: 0 !important;
  line-height: 1.4 !important;
  background: transparent !important;
}

/* Today row */
.chm-hours-wrap .chm-schedule .chm-schedule__row--today {
  background: rgba(14,108,90,.05) !important;
}
.chm-hours-wrap .chm-schedule .chm-schedule__row--today .chm-schedule__day {
  color: #0E6C5A !important;
  font-weight: 700 !important;
}
.chm-hours-wrap .chm-schedule .chm-schedule__row--today .chm-schedule__hours {
  color: #0E6C5A !important;
  font-weight: 600 !important;
}

/* Closed row */
.chm-hours-wrap .chm-schedule .chm-schedule__row--closed {
  background: #FEF2F2 !important;
}
.chm-hours-wrap .chm-schedule .chm-schedule__row--closed .chm-schedule__day {
  color: #DC2626 !important;
  font-weight: 700 !important;
}
.chm-hours-wrap .chm-schedule .chm-schedule__row--closed .chm-schedule__hours {
  color: #DC2626 !important;
  font-weight: 400 !important;
}

/* Exception row */
.chm-hours-wrap .chm-schedule .chm-schedule__row--exception .chm-schedule__hours {
  color: #D97706 !important;
  font-weight: 600 !important;
}

/* Schedule inside popup — no outer border, compact rows */
.chm-popup__hours-block .chm-schedule,
.evera-announcement__hours .chm-schedule {
  border: none !important;
  border-radius: 0 !important;
}
.chm-popup__hours-block .chm-schedule .chm-schedule__row,
.evera-announcement__hours .chm-schedule .chm-schedule__row {
  border-bottom-color: #F0F4F2 !important;
}
.chm-popup__hours-block .chm-schedule .chm-schedule__day,
.chm-popup__hours-block .chm-schedule .chm-schedule__hours,
.evera-announcement__hours .chm-schedule .chm-schedule__day,
.evera-announcement__hours .chm-schedule .chm-schedule__hours {
  padding: 10px 4px !important;
}
.chm-popup__hours-block .chm-schedule .chm-schedule__day,
.evera-announcement__hours .chm-schedule .chm-schedule__day {
  padding-right: 14px !important;
  border-right-color: #F0F4F2 !important;
}
.chm-popup__hours-block .chm-schedule .chm-schedule__hours,
.evera-announcement__hours .chm-schedule .chm-schedule__hours {
  padding-left: 14px !important;
}
.evera-announcement__hours .chm-hours-wrap { margin: 0; }
.evera-announcement__hours .chm-notice-area { margin-bottom: 10px; }

/* Inline reason tag on exception/closure rows (e.g. "Victoria Day", "Temporary Closure") */
.chm-hours-wrap .chm-schedule .chm-schedule__note {
  display: inline-flex !important;
  align-items: center !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  letter-spacing: .4px !important;
  text-transform: uppercase !important;
  padding: 4px 12px !important;
  border-radius: 20px !important;
  white-space: nowrap !important;
  line-height: 1.5 !important;
  opacity: 1 !important;
  margin: 0 !important;
  /* neutral solid fallback */
  background: #4B5563 !important;
  color: #fff !important;
  border: none !important;
}
/* Closed row — solid red pill */
.chm-hours-wrap .chm-schedule .chm-schedule__row--closed .chm-schedule__note {
  background: #DC2626 !important;
  color: #fff !important;
  border: none !important;
}
/* Exception row (open with special hours) — solid amber pill */
.chm-hours-wrap .chm-schedule .chm-schedule__row--exception .chm-schedule__note {
  background: #D97706 !important;
  color: #fff !important;
  border: none !important;
}
/* Today row — solid green pill (matches TODAY tag) */
.chm-hours-wrap .chm-schedule .chm-schedule__row--today .chm-schedule__note {
  background: #0E6C5A !important;
  color: #fff !important;
  border: none !important;
}

.chm-today-tag {
  display: inline-flex !important;
  align-items: center !important;
  background: #0E6C5A !important;
  color: #fff !important;
  font-size: 0.6rem !important;
  font-weight: 700 !important;
  padding: 2px 7px !important;
  border-radius: 20px !important;
  text-transform: uppercase !important;
  letter-spacing: .5px !important;
  line-height: 1.6 !important;
}

/* ── Notices ───────────────────────────────────────────────── */
.chm-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  background: #0E6C5A;
  color: #ffffff;
  border: none;
}
/* All notice variants — colours driven by CSS custom properties set from admin */
.chm-notice--holiday,
.chm-notice--warning {
  background: var(--chm-hbg, #0E6C5A) !important;
  color: var(--chm-htx, #ffffff) !important;
  border: none !important;
}
.chm-notice--closure {
  background: var(--chm-cbg, #0E6C5A) !important;
  color: var(--chm-ctx, #ffffff) !important;
  border: none !important;
}
/* Upcoming: subtle dashed outline to distinguish from today */
.chm-notice--upcoming { opacity: 0.88; outline: 1.5px dashed rgba(255,255,255,.3); }
/* Wrapper groups multiple notices */
.chm-notice-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.chm-notice-area .chm-notice { margin-bottom: 0; }
.chm-notice__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: #ffffff;
  opacity: .9;
}
.chm-notice__icon svg,
.chm-notice__icon .dashicons { vertical-align: middle; }
.chm-notice__msg { flex: 1; }
.chm-notice__msg strong { font-weight: 700; }

/* Custom colour overrides from admin settings */
.chm-notice--holiday[data-chm-custom] { /* handled via inline style */ }

/* ── Badge ─────────────────────────────────────────────────── */
.chm-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 7px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.chm-badge--open  { background: #ECFDF5; color: #0E6C5A; border: 1.5px solid #A7F3D0; }
.chm-badge--closed { background: #FEF2F2; color: #991B1B; border: 1.5px solid #FECACA; }
.chm-badge__dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.chm-badge--open .chm-badge__dot  { background: #10B981; animation: chm-pulse 2s infinite; }
.chm-badge--closed .chm-badge__dot { background: #EF4444; }
.chm-badge__label { }
.chm-badge__hours { font-weight: 400; opacity: .75; margin-left: 3px; }

@keyframes chm-pulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(2.2); opacity: 0; }
}
.chm-badge--open .chm-badge__dot { transform-origin: center; }

/* ── Announcement Bar ──────────────────────────────────────── */
#chm-bar {
  width: 100%;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.45;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-sizing: border-box;
  z-index: 99999;
}
/* Above header — renders before <header> via wp_body_open, sticks at top */
.chm-bar--above-header { position: sticky; top: 0; z-index: 99999; }

/* Below header — JS moves it after <header>, then sticks */
.chm-bar--below-header { position: sticky; top: 0; z-index: 9999; }

/* Legacy alias */
.chm-bar--top { position: sticky; top: 0; z-index: 99999; }

/* Bottom of page */
.chm-bar--bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 99999; box-shadow: 0 -2px 10px rgba(0,0,0,.15); }
.chm-bar__inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
}
.chm-bar__primary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.chm-bar__notice {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82em;
  opacity: 0.9;
  flex-wrap: wrap;
  justify-content: center;
}
.chm-bar__inner svg { flex-shrink: 0; vertical-align: middle; }
.chm-bar__close  {
  background: none; border: none; cursor: pointer; opacity: .65;
  color: inherit; font-size: 1.25rem; line-height: 1; padding: 2px 4px; flex-shrink: 0;
  align-self: flex-start;
}
.chm-bar__close:hover { opacity: 1; }

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 600px) {
  #chm-bar { font-size: 0.82rem; padding: 8px 14px; }
}

/* ── Dark mode ─────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  .chm-schedule__row     { border-bottom-color: #1A2D20; }
  .chm-schedule__day     { color: #C5DEC9; }
  .chm-schedule__hours   { color: #7AA888; }
  .chm-schedule__row--today .chm-schedule__day,
  .chm-schedule__row--today .chm-schedule__hours { color: #4ADE80; }
  .chm-badge--open   { background: #052E16; color: #4ADE80; border-color: #166534; }
  .chm-badge--closed { background: #200000; color: #FCA5A5; border-color: #991B1B; }
}
