/* Pack 874 unified calendar styles.
   Everything is scoped under #cal-app so these rules cannot leak into the
   HTML5 UP "Editorial" template (assets/css/main.css) on calendar.html.
   Requires the Bebas Neue + DM Sans Google Fonts to be loaded by the page. */

#cal-app {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --border: #e0dbd0;
  --text: #1a1a1a;
  --text-muted: #888;
  --header-bg: #1c2b3a;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
}
#cal-app *, #cal-app *::before, #cal-app *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Neutralize the Editorial template's <button> styling inside the calendar. Editorial draws
   buttons with an inset red ring (box-shadow), uppercases the label, and forces a fixed
   height/line-height — the per-button rules below restore the calendar's own look. */
#cal-app button {
  -webkit-appearance: none; appearance: none;
  box-shadow: none; text-transform: none;
  height: auto; line-height: normal;
}

#cal-app .app-wrapper { max-width: 100%; margin: 0; padding: 0; }

/* Header */
#cal-app .cal-header {
  background: var(--header-bg); border-radius: 16px 16px 0 0;
  padding: 20px 28px 16px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
#cal-app .cal-title { font-family: 'Bebas Neue', sans-serif; font-size: 2.2rem; color: white; letter-spacing: 2px; line-height: 1; }
#cal-app .cal-subtitle { font-size: 0.72rem; color: rgba(255,255,255,0.4); letter-spacing: 1px; text-transform: uppercase; margin-top: 3px; }
#cal-app .header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#cal-app .nav-controls { display: flex; align-items: center; gap: 8px; }
#cal-app .nav-btn {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  color: white; width: 32px; height: 32px; border-radius: 7px; cursor: pointer;
  font-size: 1rem; display: flex; align-items: center; justify-content: center; transition: background 0.15s;
}
#cal-app .nav-btn:hover { background: rgba(255,255,255,0.22); }
#cal-app .month-label { font-family: 'Bebas Neue', sans-serif; font-size: 1.35rem; color: white; letter-spacing: 1.5px; min-width: 180px; text-align: center; }
#cal-app .toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#cal-app .tool-btn {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85); padding: 4px 11px; border-radius: 6px; cursor: pointer;
  font-size: 0.7rem; font-family: 'DM Sans', sans-serif; letter-spacing: 0.4px; transition: background 0.15s; white-space: nowrap;
}
#cal-app .tool-btn:hover { background: rgba(255,255,255,0.2); }
#cal-app .tool-btn.active { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.5); color: white; font-weight: 600; }
#cal-app .tool-btn.has-filter { border-color: #F5A623; color: #F5A623; }

/* Filter panel */
#cal-app .filter-panel {
  background: #1c2b3a;
  border-left: 1px solid rgba(255,255,255,0.08);
  border-right: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease, padding 0.25s ease;
  padding: 0 20px;
}
#cal-app .filter-panel.open { max-height: 240px; padding: 14px 20px; }
#cal-app .filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
#cal-app .filter-row:last-child { margin-bottom: 0; }
#cal-app .filter-label { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.4); min-width: 34px; }
#cal-app .filter-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; border-radius: 20px; font-size: 0.68rem; font-weight: 600;
  cursor: pointer; border: 2px solid transparent; transition: all 0.12s; user-select: none;
}
#cal-app .filter-chip.off { opacity: 0.28; }
#cal-app .filter-reset {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7); padding: 2px 9px; border-radius: 20px;
  font-size: 0.65rem; font-weight: 600; cursor: pointer; transition: background 0.12s;
}
#cal-app .filter-reset:hover { background: rgba(255,255,255,0.2); }

/* Cal body */
#cal-app .cal-body {
  background: var(--surface); border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 16px 16px; box-shadow: var(--shadow); overflow: hidden;
}

/* Month grid */
#cal-app #monthView { display: block; }
#cal-app .day-names {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: #f9f7f3; border-bottom: 2px solid var(--border);
}
#cal-app .day-name { text-align: center; padding: 9px 0; font-size: 0.66rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); }

#cal-app .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

/* Each week row is a separate element to allow chips to span/overflow */
#cal-app .week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-column: 1 / -1;
  position: relative;
}

#cal-app .cal-cell {
  height: 118px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 5px 4px 4px;
  background: white;
  min-width: 0;
}
#cal-app .cal-cell:last-child { border-right: none; }
#cal-app .cal-cell.other-month { background: #faf9f6; }
#cal-app .cal-cell.other-month .cell-num { color: #ccc; }
#cal-app .cal-cell.today { background: #f0f6ff; }

#cal-app .cell-num {
  font-size: 0.74rem; font-weight: 600; color: #555;
  width: 21px; height: 21px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; position: relative; z-index: 1;
}
#cal-app .cal-cell.today .cell-num { background: var(--header-bg); color: white; }

/* Chips are absolutely positioned over the week-row */
#cal-app .event-chip {
  position: absolute;
  height: 17px;
  font-size: 0.62rem; font-weight: 500;
  padding: 1px 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; pointer-events: all;
  transition: opacity 0.15s;
  line-height: 15px; z-index: 2;
  border-radius: 3px;
}
#cal-app .event-chip:hover { opacity: 0.82; }

#cal-app .more-link {
  position: absolute;
  font-size: 0.58rem; color: var(--text-muted);
  cursor: pointer; padding: 1px 4px;
  pointer-events: all; z-index: 3;
}
#cal-app .more-link:hover { text-decoration: underline; }

/* Agenda */
#cal-app #agendaView { display: none; width: 100%; }
#cal-app .agenda-month-header {
  font-family: 'Bebas Neue', sans-serif; font-size: 1rem; letter-spacing: 2px;
  padding: 12px 22px 8px; background: #f5f3ee; border-bottom: 1px solid var(--border); color: #444;
}
#cal-app .agenda-row { display: flex; align-items: stretch; border-bottom: 1px solid #f0ede8; cursor: pointer; transition: background 0.1s; }
#cal-app .agenda-row:hover { background: #faf8f5; }
#cal-app .agenda-date-col { width: 82px; flex-shrink: 0; padding: 11px 14px; text-align: right; border-right: 2px solid var(--border); }
#cal-app .agenda-day-num { font-family: 'Bebas Neue', sans-serif; font-size: 1.4rem; line-height: 1; color: #333; }
#cal-app .agenda-day-name { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 600; }
#cal-app .agenda-event-col { flex: 1; padding: 11px 18px; }
#cal-app .agenda-event-title { font-size: 0.88rem; font-weight: 600; margin-bottom: 4px; }
#cal-app .agenda-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#cal-app .agenda-type-pill { font-size: 0.62rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
#cal-app .agenda-den-pill { font-size: 0.62rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
#cal-app .agenda-multiday { font-size: 0.62rem; color: var(--text-muted); font-style: italic; }
#cal-app .agenda-desc { font-size: 0.73rem; color: var(--text-muted); margin-top: 4px; }
#cal-app .agenda-empty { padding: 48px 24px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* Modals (event, day list, subscribe) */
#cal-app .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 10001; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
#cal-app .modal-overlay.open { display: flex; }
#cal-app .modal { background: white; border-radius: 14px; padding: 24px 26px; max-width: 420px; width: 90%; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2); position: relative; animation: calModalIn 0.18s ease; }
@keyframes calModalIn { from { opacity:0; transform:translateY(10px) scale(0.97); } to { opacity:1; transform:none; } }
#cal-app .modal-bar { height: 5px; border-radius: 3px; margin-bottom: 14px; }
#cal-app .modal-title { font-family: 'Bebas Neue', sans-serif; font-size: 1.45rem; letter-spacing: 1px; margin-bottom: 4px; }
#cal-app .modal-date { font-size: 0.76rem; color: var(--text-muted); margin-bottom: 10px; font-weight: 500; }
#cal-app .modal-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
#cal-app .modal-pill { font-size: 0.67rem; font-weight: 700; padding: 2px 10px; border-radius: 20px; }
#cal-app .modal-desc { font-size: 0.82rem; color: #444; line-height: 1.6; border-top: 1px solid var(--border); padding-top: 11px; }
#cal-app .modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: #aaa; padding: 4px; }
#cal-app .modal-close:hover { color: #333; }

/* Day modal (+more) list + Subscribe list */
#cal-app .day-row { display: flex; align-items: center; gap: 8px; padding: 8px 2px; border-bottom: 1px solid #f0ede8; cursor: pointer; }
#cal-app .day-row:last-child { border-bottom: none; }
#cal-app .day-row:hover { background: #faf8f5; }
#cal-app .day-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
#cal-app .day-row-title { font-size: 0.82rem; font-weight: 600; flex: 1; }
#cal-app .day-pill { font-size: 0.6rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
#cal-app .sub-row { display: flex; align-items: center; gap: 8px; padding: 9px 2px; border-bottom: 1px solid #f0ede8; }
#cal-app .sub-row:last-child { border-bottom: none; }
#cal-app .sub-name { font-size: 0.82rem; font-weight: 600; flex: 1; }
#cal-app .sub-link { font-size: 0.68rem; font-weight: 600; padding: 3px 11px; border-radius: 20px; background: var(--header-bg); color: #fff; text-decoration: none; }
#cal-app .sub-link:hover { opacity: 0.85; }
#cal-app .status-msg { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 0.9rem; }
#cal-app .spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--header-bg); border-radius: 50%; animation: calSpin 0.7s linear infinite; margin: 0 auto 12px; }
@keyframes calSpin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  #cal-app .cal-title { font-size: 1.6rem; }
  #cal-app .cal-cell { height: 80px; }
  #cal-app .event-chip { font-size: 0.56rem; }
  #cal-app .cal-header { flex-direction: column; align-items: flex-start; }
  #cal-app .header-right { align-items: flex-start; }
}
