/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Wrapper fills parent ── */
.hcal-wrapper {
  width: 100%;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ── Container ── */
.hcal-container {
  background: #fff;
  /* border-radius: 12px; */
  box-shadow: 0 2px 20px rgba(0,0,0,.10);
  overflow: hidden;
  position: relative;
  width: 100%;
}

/* ── Header ── */
.hcal-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  background: linear-gradient(135deg, var(--bs-secondary) 0%, var(--bs-primary) 100%);
  color: #fff;
}

.hcal-nav-btn {
  display: flex; align-items: center; justify-content: center;
  height: 52px; font-size: 1.5rem; cursor: pointer;
  background: transparent; border: none; color: rgba(255,255,255,.7);
  transition: color .2s, background .2s;
}
.hcal-nav-btn:hover { color: #fff; background: rgba(255,255,255,.14); }

.hcal-header-center {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 4px;
}

.hcal-month-name {
  font-size: clamp(.9rem, 2vw, 1.2rem);
  font-weight: 700; letter-spacing: .03em; text-align: center;
}

.hcal-year-btn {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  border-radius: 6px; padding: 5px 12px; font-size: .82rem; font-weight: 600;
  cursor: pointer; letter-spacing: .04em; transition: background .2s;
  white-space: nowrap;
}
.hcal-year-btn:hover { background: rgba(255,255,255,.28); }

/* ── Day-name row ── */
.hcal-day-names {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 2px solid #e2e8f0;
}
.hcal-day-names span {
  text-align: center; padding: 8px 0;
  font-size: clamp(.6rem, 1.4vw, .72rem); font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: #64748b;
}
.hcal-day-names span.dn-sun { color: #dc2626; }
.hcal-day-names span.dn-sat { color: #2563eb; }

/* ── Grid ── */
.hcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }

/* ── Cell ── */
.hcal-cell {
  min-height: clamp(60px, 9vw, 90px);
  border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0;
  padding: 5px 3px 3px; position: relative;
  display: flex; flex-direction: column; gap: 2px;
  transition: background .15s;
  overflow: hidden;
}
.hcal-cell:nth-child(7n) { border-right: none; }
.hcal-cell:hover { background: #f8fafc !important; }
.hcal-cell.blank { background: #f9fafb; pointer-events: none; }

/* Day number */
.hcal-day-num {
  font-size: clamp(.7rem, 1.5vw, .9rem); font-weight: 700; color: #334155;
  width: clamp(20px, 3vw, 26px); height: clamp(20px, 3vw, 26px);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; flex-shrink: 0; line-height: 1;
}

/* ── Today ── */
.hcal-cell.today .hcal-day-num { background: #2563eb; color: #fff; }

/* ── Sunday / weekend ── */
.hcal-cell.sunday .hcal-day-num,
.hcal-cell.weekend-off .hcal-day-num { color: #dc2626; }
.hcal-cell.sunday { background: #fef2f2; }
.hcal-cell.weekend-off { background: #fef2f2; }

/* ── 1st & 3rd Saturday: Non-Sitting (cyan) ── */
.hcal-cell.sat-nonsitting { background: #ecfeff; }
.hcal-cell.sat-nonsitting .hcal-day-num { color: #0e7490; }

/* ── Gazetted holiday (red) ── */
.hcal-cell.has-gazetted { background: #fff1f2; }
.hcal-cell.has-gazetted .hcal-day-num { color: #b91c1c; }

/* ── Vacation (green) ── */
.hcal-cell.has-vacation { background: #f0fdf4; }
.hcal-cell.has-vacation .hcal-day-num { color: #15803d; }

/* ── Non-sitting holiday (cyan, from holiday data) ── */
.hcal-cell.has-nonsitting { background: #ecfeff; }
.hcal-cell.has-nonsitting .hcal-day-num { color: #0e7490; }

/* ── Pills ── */
.hcal-pill {
  font-size: clamp(.5rem, 1vw, .62rem); font-weight: 600;
  border-radius: 3px; padding: 1px 4px; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.pill-gazetted   { background: #fee2e2; color: #991b1b; }
.pill-vacation   { background: #dcfce7; color: #15803d; }
.pill-nonsitting { background: #cffafe; color: #0e7490; }

.hcal-pill-region {
  font-size: clamp(.45rem, .9vw, .55rem);
  color: #7c3aed; font-weight: 700; letter-spacing: .04em;
  padding: 0 2px; line-height: 1.2;
}

/* ── Tooltip ── */
.hcal-tooltip {
  display: none; position: absolute; z-index: 999;
  bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #f1f5f9; font-size: .72rem;
  border-radius: 8px; padding: 8px 11px; min-width: 150px; max-width: 240px;
  text-align: left; box-shadow: 0 8px 28px rgba(0,0,0,.3);
  pointer-events: none; line-height: 1.5; white-space: normal;
}
.hcal-tooltip::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #1e293b;
}
.hcal-tooltip .tt-item { margin-bottom: 5px; }
.hcal-tooltip .tt-item:last-child { margin-bottom: 0; }
.hcal-tooltip .tt-name { font-weight: 700; color: #fff; display: block; }
.hcal-tooltip .tt-region {
  display: inline-block; font-size: .63rem; font-weight: 700;
  background: #7c3aed; color: #fff; border-radius: 3px;
  padding: 1px 5px; margin-top: 2px; letter-spacing: .04em;
}
.hcal-tooltip .tt-sep { border: none; border-top: 1px solid #334155; margin: 5px 0; }
.hcal-tooltip .tt-nonsit { font-size: .65rem; color: #67e8f9; font-style: italic; }

.hcal-cell:hover .hcal-tooltip { display: block; }

/* Tooltip overflow near edges */
.hcal-grid > .hcal-cell:nth-child(7n) .hcal-tooltip,
.hcal-grid > .hcal-cell:nth-child(7n-1) .hcal-tooltip {
  left: auto; right: 0; transform: none;
}
.hcal-grid > .hcal-cell:nth-child(7n) .hcal-tooltip::after,
.hcal-grid > .hcal-cell:nth-child(7n-1) .hcal-tooltip::after {
  left: auto; right: 14px; transform: none;
}
.hcal-grid > .hcal-cell:nth-child(7n+1) .hcal-tooltip,
.hcal-grid > .hcal-cell:nth-child(7n+2) .hcal-tooltip {
  left: 0; transform: none;
}
.hcal-grid > .hcal-cell:nth-child(7n+1) .hcal-tooltip::after,
.hcal-grid > .hcal-cell:nth-child(7n+2) .hcal-tooltip::after {
  left: 14px; transform: none;
}

/* ── Legend ── */
.hcal-legend {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  padding: 10px 14px; border-top: 1px solid #e2e8f0; background: #f8fafc;
}
.hcal-legend-item {
  display: flex; align-items: center; gap: 5px;
  font-size: clamp(.65rem, 1.2vw, .75rem); color: #475569; font-weight: 500;
}
.hcal-legend-dot {
  width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0;
}
.dot-gazetted   { background: #ef4444; }
.dot-vacation   { background: #22c55e; }
.dot-nonsitting { background: #06b6d4; }
.dot-weekend    { background: #f87171; }
.dot-today      { background: #2563eb; border-radius: 50%; }
.dot-regional   { background: #7c3aed; }

/* ── Loader ── */
.hcal-loader {
  display: none; position: absolute; inset: 0;
  background: rgba(255,255,255,.75); z-index: 100;
  align-items: center; justify-content: center;
}
.hcal-loader.active { display: flex; }
.hcal-spinner {
  width: 32px; height: 32px;
  border: 3px solid #dbeafe; border-top-color: #2563eb;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Holiday list panel ── */
.hcal-list-panel {
  margin-top: 20px;
  background: #fff; border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08); overflow: hidden;
}
.hcal-list-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff; padding: 12px 18px;
  font-size: clamp(.85rem, 1.5vw, 1rem); font-weight: 700; letter-spacing: .04em;
}
.hcal-list-table { width: 100%; border-collapse: collapse; font-size: clamp(.75rem, 1.3vw, .85rem); }
.hcal-list-table th {
  background: #f1f5f9; color: #475569; font-weight: 700;
  text-align: left; padding: 9px 14px; border-bottom: 2px solid #e2e8f0;
  font-size: clamp(.65rem, 1vw, .72rem); text-transform: uppercase; letter-spacing: .06em;
}
.hcal-list-table td {
  padding: 8px 14px; border-bottom: 1px solid #e2e8f0; color: #334155; vertical-align: middle;
}
.hcal-list-table tr:last-child td { border-bottom: none; }
.hcal-list-table tr:hover td { background: #f8fafc; }

.hcal-badge {
  display: inline-block; font-size: .68rem; font-weight: 700;
  padding: 2px 7px; border-radius: 20px; text-transform: uppercase; letter-spacing: .05em;
}
.badge-gazetted   { background: #fee2e2; color: #b91c1c; }
.badge-vacation   { background: #dcfce7; color: #15803d; }
.badge-nonsitting { background: #cffafe; color: #0e7490; }

.hcal-badge-region {
  display: inline-block; font-size: .65rem; font-weight: 700;
  padding: 1px 6px; border-radius: 20px; background: #ede9fe; color: #5b21b6;
  letter-spacing: .04em; margin-left: 5px;
}

/* ══════════════════════════════════════════
   FULL-YEAR PRINT PAGE  (opened in new tab)
══════════════════════════════════════════ */
body.fullcal-page {
  background: #fff;
  font-family: 'Segoe UI', system-ui, sans-serif;
  padding: 0; margin: 0;
}

.fc-outer {
  max-width: 1280px; margin: 0 auto; padding: 20px 16px 40px;
}

.fc-banner {
  text-align: center; border: 3px solid #1e3a8a;
  border-radius: 10px; padding: 16px 12px 12px; margin-bottom: 22px;
}
.fc-banner h1 {
  color: #1e3a8a; font-size: clamp(1.1rem, 2.5vw, 1.7rem);
  font-weight: 900; letter-spacing: .02em; text-transform: uppercase;
}
.fc-banner h2 {
  color: #dc2626; font-size: clamp(.9rem, 2vw, 1.3rem);
  font-weight: 800; margin-top: 4px;
}

.fc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px; margin-bottom: 28px;
}

.fc-month { border: 1px solid #c7d7ed; border-radius: 8px; overflow: hidden; }
.fc-month-header {
  background: #1e3a8a; color: #fff; text-align: center;
  padding: 7px; font-size: .9rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.fc-month-days-header {
  display: grid; grid-template-columns: repeat(7,1fr);
  background: #f1f5f9; border-bottom: 1px solid #c7d7ed;
}
.fc-month-days-header span {
  text-align: center; font-size: .58rem; font-weight: 700;
  padding: 4px 0; letter-spacing: .04em; color: #64748b;
}
.fc-month-days-header span.fcdh-sun { color: #dc2626; }
.fc-month-days-header span.fcdh-sat { color: #2563eb; }

.fc-month-grid { display: grid; grid-template-columns: repeat(7,1fr); }
.fc-day {
  min-height: 40px; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0;
  padding: 3px 2px; display: flex; flex-direction: column; align-items: flex-start;
  font-size: .62rem; position: relative; overflow: hidden;
}
.fc-day:nth-child(7n) { border-right: none; }
.fc-day.fcblank { background: #f9fafb; }
.fc-day-num {
  font-weight: 700; font-size: .7rem; color: #334155;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.fc-day.fc-today .fc-day-num { background: #2563eb; color: #fff; }
.fc-day.fc-sunday,
.fc-day.fc-weekend-off { background: #fef2f2; }
.fc-day.fc-sunday .fc-day-num,
.fc-day.fc-weekend-off .fc-day-num { color: #dc2626; }
.fc-day.fc-sat-nonsitting { background: #ecfeff; }
.fc-day.fc-sat-nonsitting .fc-day-num { color: #0e7490; }
.fc-day.fc-vacation { background: #f0fdf4; }
.fc-day.fc-vacation .fc-day-num { color: #15803d; }
.fc-day.fc-gazetted { background: #fff1f2; }
.fc-day.fc-gazetted .fc-day-num { color: #b91c1c; }
.fc-day.fc-nonsitting { background: #ecfeff; }
.fc-day.fc-nonsitting .fc-day-num { color: #0e7490; }

.fc-dot {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  margin: 1px 1px 0; flex-shrink: 0;
}
.fc-dot-gazetted   { background: #ef4444; }
.fc-dot-vacation   { background: #22c55e; }
.fc-dot-nonsitting { background: #06b6d4; }

/* Holiday list table (full-year) */
.fc-table-section { margin-bottom: 28px; }
.fc-table-section h3 {
  font-size: 1rem; font-weight: 800; color: #1e3a8a;
  border-bottom: 2px solid #1e3a8a; padding-bottom: 5px; margin-bottom: 10px;
  text-transform: uppercase; letter-spacing: .05em;
}
.fc-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.fc-table th {
  background: #1e3a8a; color: #fff; padding: 7px 12px;
  text-align: left; font-weight: 700; font-size: .72rem; letter-spacing: .05em;
}
.fc-table td { padding: 6px 12px; border-bottom: 1px solid #e2e8f0; color: #334155; }
.fc-table tr:last-child td { border-bottom: none; }
.fc-table tr:nth-child(even) td { background: #f8fafc; }
.fc-table .fc-badge {
  display: inline-block; font-size: .65rem; font-weight: 700;
  padding: 1px 7px; border-radius: 20px;
}
.fc-table .fc-badge-gazetted   { background: #fee2e2; color: #991b1b; }
.fc-table .fc-badge-vacation   { background: #dcfce7; color: #15803d; }
.fc-table .fc-badge-regional   { background: #ede9fe; color: #5b21b6; }

/* Full-year legend */
.fc-legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 10px 16px; margin-bottom: 22px; background: #f8fafc;
}
.fc-legend-item { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: #334155; }
.fc-legend-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.fc-ls-vacation   { background: #22c55e; }
.fc-ls-gazetted   { background: #ef4444; }
.fc-ls-nonsitting { background: #06b6d4; }
.fc-ls-weekend    { background: #f87171; }
.fc-ls-today      { background: #2563eb; border-radius: 50%; }

/* Print */
@media print {
  .hcal-nav-btn, .hcal-year-btn { display: none; }
  .hcal-tooltip { display: none !important; }
  .fc-outer { padding: 8px; }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .hcal-cell { min-height: 50px; padding: 3px 1px; }
  .hcal-pill { display: none; }
  .hcal-cell.has-gazetted::after,
  .hcal-cell.has-vacation::after,
  .hcal-cell.has-nonsitting::after {
    content: ''; position: absolute; bottom: 3px; right: 3px;
    width: 5px; height: 5px; border-radius: 50%; background: currentColor;
  }
  .fc-grid { grid-template-columns: 1fr 1fr; }
  .fc-day { min-height: 30px; }
}

@media (max-width: 400px) {
  .fc-grid { grid-template-columns: 1fr; }
}
