/* GhotiCal — Unified Calendar Widget
   Version: 1.0.0
   No framework. No build step. Attach to window.GhotiCal.
   Source: http://10.49.230.1:4000/choich/ghotical
*/

/* ─── Container ─────────────────────────────────────────── */
.gc {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #1a1a2e;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.10);
}

/* ─── Header ─────────────────────────────────────────────── */
.gc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #1a1a2e;
  color: #fff;
  flex-shrink: 0;
}

.gc-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gc-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  min-width: 200px;
  text-align: center;
}

.gc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, opacity .15s;
}

.gc-btn:hover { opacity: .85; }

.gc-btn-ghost {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.gc-btn-ghost:hover { background: rgba(255,255,255,.22); }

.gc-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gc-view-switcher {
  display: flex;
  border-radius: 5px;
  overflow: hidden;
}

.gc-view-switcher .gc-btn {
  border-radius: 0;
  background: rgba(255,255,255,.12);
  color: #fff;
  border-right: 1px solid rgba(255,255,255,.08);
}

.gc-view-switcher .gc-btn:last-child { border-right: none; }
.gc-view-switcher .gc-btn.active { background: rgba(255,255,255,.30); }

.gc-btn-today {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* ─── Body ───────────────────────────────────────────────── */
.gc-body {
  flex: 1;
  overflow: auto;
  position: relative;
}

/* ─── Month view ─────────────────────────────────────────── */
.gc-month {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.gc-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f0f0f5;
  border-bottom: 1px solid #ddd;
  flex-shrink: 0;
}

.gc-weekday {
  padding: 6px 0;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #666;
}

.gc-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  flex: 1;
  border-left: 1px solid #e8e8ef;
  border-top: 1px solid #e8e8ef;
}

.gc-day {
  border-right: 1px solid #e8e8ef;
  border-bottom: 1px solid #e8e8ef;
  padding: 4px;
  min-height: 80px;
  cursor: pointer;
  transition: background .1s;
  position: relative;
  overflow: hidden;
}

.gc-day:hover { background: #f7f7fb; }

.gc-day.other-month { background: #fafafa; }
.gc-day.other-month .gc-day-num { color: #bbb; }

.gc-day.today { background: #eef2ff; }
.gc-day.today .gc-day-num {
  background: #4f46e5;
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gc-day.selected { background: #f0f4ff; outline: 2px solid #4f46e5; outline-offset: -2px; }

.gc-day-num {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gc-day-events {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.gc-event-pill {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  background: #4f46e5;
  color: #fff;
  font-weight: 500;
  line-height: 1.6;
}

.gc-event-pill:hover { opacity: .85; }

.gc-overflow {
  font-size: 10px;
  color: #888;
  padding-left: 4px;
  margin-top: 1px;
}

/* ─── Week view ──────────────────────────────────────────── */
.gc-week {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 600px;
}

.gc-week-header {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 1px solid #ddd;
  background: #f0f0f5;
  flex-shrink: 0;
}

.gc-week-header-gutter { border-right: 1px solid #ddd; }

.gc-week-col-head {
  text-align: center;
  padding: 6px 4px;
  border-right: 1px solid #e8e8ef;
}

.gc-week-col-head .gc-wday { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #666; }
.gc-week-col-head .gc-wnum { font-size: 18px; font-weight: 600; color: #333; }
.gc-week-col-head .gc-wnum.today-num {
  background: #4f46e5;
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.gc-week-scroll {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.gc-week-grid {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  position: relative;
}

.gc-time-gutter {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #ddd;
}

.gc-time-label {
  height: 48px;
  padding: 2px 6px 0 0;
  text-align: right;
  font-size: 10px;
  color: #aaa;
  flex-shrink: 0;
  box-sizing: border-box;
}

.gc-week-day-col {
  border-right: 1px solid #e8e8ef;
  position: relative;
}

.gc-slot {
  height: 48px;
  border-bottom: 1px solid #f0f0f5;
  box-sizing: border-box;
}

.gc-slot:nth-child(2n) { border-bottom-color: #e8e8ef; }

.gc-week-events {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
}

.gc-event-block {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  overflow: hidden;
  cursor: pointer;
  pointer-events: all;
  z-index: 1;
  min-height: 20px;
  box-sizing: border-box;
}

.gc-event-block:hover { opacity: .85; filter: brightness(1.1); }

.gc-event-block-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-event-block-time { font-size: 10px; opacity: .85; }

/* ─── Day view ───────────────────────────────────────────── */
.gc-day-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.gc-day-view-header {
  text-align: center;
  padding: 10px;
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid #ddd;
  background: #f0f0f5;
  flex-shrink: 0;
}

.gc-day-view-scroll {
  flex: 1;
  overflow-y: auto;
}

.gc-day-view-grid {
  display: grid;
  grid-template-columns: 52px 1fr;
}

/* ─── All-day bar (week/day) ─────────────────────────────── */
.gc-allday-row {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 2px solid #ddd;
  min-height: 28px;
  background: #fafafa;
  flex-shrink: 0;
}

.gc-allday-gutter {
  border-right: 1px solid #ddd;
  font-size: 9px;
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 4px;
}

.gc-allday-cell {
  border-right: 1px solid #e8e8ef;
  padding: 2px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* ─── Source color defaults ──────────────────────────────── */
/* Can be overridden per-event via the color field */
.gc-src-questlog  { background: #4f46e5; }
.gc-src-porkchop  { background: #059669; }
.gc-src-loanlabor { background: #d97706; }
.gc-src-whale     { background: #0ea5e9; }

/* ─── Tooltip ────────────────────────────────────────────── */
.gc-tooltip {
  position: fixed;
  background: #1a1a2e;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  max-width: 240px;
  z-index: 9999;
  pointer-events: none;
  line-height: 1.5;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

.gc-tooltip-title { font-weight: 700; margin-bottom: 2px; }
.gc-tooltip-time { opacity: .8; }
.gc-tooltip-source { opacity: .6; font-size: 11px; margin-top: 2px; }

/* ─── Loading state ──────────────────────────────────────── */
.gc-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #aaa;
  font-size: 13px;
}

/* ─── TV / big-screen overrides (add class gc--tv) ──────── */
.gc--tv { font-size: 20px; }
.gc--tv .gc-title { font-size: 1.5rem; }
.gc--tv .gc-day { min-height: 120px; }
.gc--tv .gc-event-pill { font-size: 14px; padding: 3px 8px; }
.gc--tv .gc-day-num { font-size: 16px; width: 30px; height: 30px; }
