/* ─── AK Chat Platform — Calendar Drawer ─────────────────────────────────────── */

/* ── Overlay ─────────────────────────────────────────────────────────────────── */
#cal-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#cal-drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Drawer panel ────────────────────────────────────────────────────────────── */
#calendar-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 100vw;
  height: 100vh;
  background: var(--secondary);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.4);
}
#calendar-drawer.open {
  transform: translateX(0);
}

/* ── Drawer header ───────────────────────────────────────────────────────────── */
#cal-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cal-drawer-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.cal-drawer-title svg { color: var(--primary); }

.cal-drawer-fs-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--tertiary);
  border: 1px solid var(--border);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.cal-drawer-fs-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

#cal-drawer-close {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
  transition: background var(--transition), color var(--transition);
}
#cal-drawer-close:hover { background: var(--tertiary); color: var(--text); }

/* ── Controls row ────────────────────────────────────────────────────────────── */
#cal-drawer-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Brand tabs */
.cal-drawer-brands {
  display: flex;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px;
  gap: 2px;
}

.cal-drawer-brand {
  padding: 5px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.cal-drawer-brand:hover  { color: var(--text); }
.cal-drawer-brand.active { background: var(--primary); color: #fff; }

/* Month navigation */
.cal-month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.cal-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 16px;
  transition: background var(--transition), color var(--transition);
}
.cal-nav-btn:hover { background: var(--tertiary); color: var(--text); }

#cal-month-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 110px;
  text-align: center;
}

/* ── Grid area ───────────────────────────────────────────────────────────────── */
#cal-grid-view {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 20px;
}

.cal-loading {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

/* Day-of-week headers */
.cal-week-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.cal-week-header {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  padding: 4px 0;
}

/* Days grid */
.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

/* Individual day card */
.cal-day {
  aspect-ratio: 1;
  border-radius: 6px;
  padding: 4px 3px 3px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  transition: background var(--transition);
  min-height: 44px;
}

.cal-day.empty {
  background: transparent;
}

.cal-day.off {
  background: rgba(255,255,255,0.03);
}
.cal-day.off:hover { background: rgba(255,255,255,0.05); }

.cal-day.has-post {
  background: rgba(255, 107, 0, 0.08);
  border: 1px solid rgba(255, 107, 0, 0.2);
  cursor: default;
}
.cal-day.has-post:hover { background: rgba(255, 107, 0, 0.13); }

.cal-day.today .cal-day-num {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-day.weekend.off { opacity: 0.5; }

/* Day number */
.cal-day-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  flex-shrink: 0;
}
.cal-day.has-post .cal-day-num { color: var(--text); }

/* Post indicator dot */
.cal-post-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

/* Intent text */
.cal-day-intent {
  font-size: 8.5px;
  color: var(--text);
  line-height: 1.2;
  margin-top: 3px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
  width: 100%;
}

/* Caption type */
.cal-day-caption {
  font-size: 7.5px;
  color: var(--primary);
  margin-top: 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  width: 100%;
  opacity: 0.8;
}

/* No data notice */
.cal-no-data {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 20px 0 0;
}

/* ── Mobile ───────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #calendar-drawer { width: 100vw; }
}
