/* ============================================================
   CALENDAR.CSS
   Styles for the full Calendar tab page.
   Depends on: main.css (tokens), resources.css (.res-tabs, .res-modal-*)
   ============================================================ */


/* ——————————————————————————————————————————————————————————
   TOP BAR: tabs + toolbar
   —————————————————————————————————————————————————————————— */

.cal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  flex-wrap: wrap;
}

.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-nav-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 18px;
  color: var(--text-secondary);
  background: transparent;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.cal-nav-btn:hover {
  background: var(--bg-panel);
  color: var(--text-primary);
}

.cal-range-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 160px;
  text-align: center;
}

.cal-today-btn {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1.5px solid var(--blush);
  background: transparent;
  transition: background 0.15s, color 0.15s;
}
.cal-today-btn:hover {
  background: var(--blush);
  color: var(--text-primary);
}

.cal-add-btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: white;
  background: var(--rose);
  transition: opacity 0.15s;
}
.cal-add-btn:hover { opacity: 0.85; }


/* ——————————————————————————————————————————————————————————
   PAGE LAYOUT: main area + right sidebar
   —————————————————————————————————————————————————————————— */

.cal-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 20px;
  align-items: start;
}

.cal-main {
  min-width: 0;
}


/* ——————————————————————————————————————————————————————————
   WEEK GRID
   —————————————————————————————————————————————————————————— */

.cal-week-grid {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* Header row: gutter + 7 day headers */
.cwg-header {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 1.5px solid rgba(0,0,0,0.065);
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 4;
}

.cwg-header-gutter {
  border-right: 1px solid rgba(0,0,0,0.06);
}

.cwg-day-header {
  padding: 10px 6px 9px;
  text-align: center;
  border-right: 1px solid rgba(0,0,0,0.05);
}
.cwg-day-header:last-child { border-right: none; }
.cwg-day-header.is-weekend { background: rgba(0,0,0,0.012); }

.cwg-day-name {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.cwg-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  border-radius: 50%;
}

.cwg-day-header.is-today .cwg-day-num {
  background: var(--rose);
  color: white;
}

/* Scroll wrapper — contains header + body so scrollbar never misaligns header */
.cwg-scroll-wrap {
  overflow-y: auto;
  max-height: 640px;
}

/* Body: time column + 7 day columns side by side */
.cwg-body {
  display: flex;
  padding-top: 10px;
}

.cwg-time-col {
  width: 52px;
  flex-shrink: 0;
  border-right: 1px solid rgba(0,0,0,0.06);
}

.cwg-time-slot {
  position: relative;
  box-sizing: border-box;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.cwg-time-label {
  font-size: 10px;
  color: var(--text-muted);
  position: absolute;
  top: -7px;
  right: 6px;
  background: var(--bg-card);
  padding: 0 2px;
  white-space: nowrap;
}
.cwg-time-slot:first-child .cwg-time-label {
  top: 0;
}

/* 7 day columns */
.cwg-days-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  min-width: 0;
  position: relative;
}

.cwg-day-col {
  position: relative;
  border-right: 1px solid rgba(0,0,0,0.045);
  cursor: pointer;
}
.cwg-day-col:last-child { border-right: none; }
.cwg-day-col.is-weekend { background: rgba(0,0,0,0.01); }
.cwg-day-col.is-today { background: rgba(217,180,180,0.04); }

/* Hour lines inside day columns */
.cwg-day-col::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent calc(var(--cal-hour-h, 64px) - 1px),
    rgba(0,0,0,0.04) calc(var(--cal-hour-h, 64px) - 1px),
    rgba(0,0,0,0.04) var(--cal-hour-h, 64px)
  );
  pointer-events: none;
  z-index: 0;
}

/* Event cards */
.cwg-event {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 7px;
  padding: 4px 6px 3px;
  font-size: 10.5px;
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.1s;
  z-index: 1;
  min-height: 20px;
}
.cwg-event:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.13);
  transform: translateY(-1px);
  z-index: 3;
}

.cwg-event-title {
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cwg-event-brand {
  font-size: 9.5px;
  opacity: 0.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}

.cwg-event-time {
  font-size: 9.5px;
  opacity: 0.65;
  margin-top: 1px;
}


/* ——————————————————————————————————————————————————————————
   CURRENT TIME INDICATOR
   —————————————————————————————————————————————————————————— */

.cwg-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--rose);
  z-index: 2;
  pointer-events: none;
  opacity: 0.75;
}

.cwg-now-dot {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rose);
  display: block;
}


/* ——————————————————————————————————————————————————————————
   MONTH GRID
   —————————————————————————————————————————————————————————— */

.cmg-wrap {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.cmg-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1.5px solid rgba(0,0,0,0.065);
  background: var(--bg-card);
}

.cmg-day-name {
  padding: 10px 6px 9px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-right: 1px solid rgba(0,0,0,0.05);
}
.cmg-day-name:last-child { border-right: none; }

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

.cmg-cell {
  border-right: 1px solid rgba(0,0,0,0.05);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 7px 8px 6px;
  min-height: 90px;
  cursor: pointer;
  transition: background 0.12s;
  box-sizing: border-box;
  overflow: hidden;
  vertical-align: top;
}
.cmg-cell:nth-child(7n) { border-right: none; }
.cmg-cell:hover { background: var(--bg-panel); }
.cmg-cell.is-other { background: rgba(0,0,0,0.015); }
.cmg-cell.is-today { background: rgba(217,180,180,0.07); }

.cmg-cell-num {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
}
.cmg-cell.is-today .cmg-cell-num {
  background: var(--rose);
  color: white;
}
.cmg-cell.is-other .cmg-cell-num { color: var(--text-muted); opacity: 0.5; }

.cmg-cell-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  margin-top: 2px;
}

.cmg-cell-event {
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  display: block;
  box-sizing: border-box;
  line-height: 1.4;
}
.cmg-cell-event:hover { opacity: 0.8; }

.cmg-cell-more {
  font-size: 9.5px;
  color: var(--text-muted);
  padding: 1px 3px;
}


/* ——————————————————————————————————————————————————————————
   DAY VIEW
   —————————————————————————————————————————————————————————— */

.cal-day-view {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.cdv-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px 12px;
  border-bottom: 1.5px solid rgba(0,0,0,0.065);
}
.cdv-header.is-today { background: rgba(217,180,180,0.06); }

.cdv-day-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.cdv-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 50%;
  color: var(--text-secondary);
}
.cdv-header.is-today .cdv-day-num {
  background: var(--rose);
  color: white;
}

.cwg-days-single {
  grid-template-columns: 1fr;
}

.cdv-col {
  min-width: 0;
}

.cwg-event-day {
  left: 8px;
  right: 8px;
  font-size: 12px;
}


/* ——————————————————————————————————————————————————————————
   SCHEDULE VIEW
   —————————————————————————————————————————————————————————— */

.cal-schedule-list {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.csl-date-group {
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.csl-date-group:last-child { border-bottom: none; }

.csl-date-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 20px 4px;
  background: var(--bg-panel);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.csl-event {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid rgba(0,0,0,0.03);
}
.csl-event:last-child { border-bottom: none; }
.csl-event:hover { background: var(--bg-panel); }

.csl-event-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.csl-event-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
}

.csl-event-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.csl-event-brand {
  color: var(--text-secondary);
}

.cal-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}


/* ——————————————————————————————————————————————————————————
   RIGHT SIDEBAR
   —————————————————————————————————————————————————————————— */

.cal-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cal-panel {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
}

.cal-panel-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}


/* ——————————————————————————————————————————————————————————
   MINI MONTH CALENDAR
   —————————————————————————————————————————————————————————— */

.cmm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cmm-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.cmm-nav {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--text-secondary);
  border-radius: 5px;
  transition: background 0.12s;
  line-height: 1;
}
.cmm-nav:hover { background: var(--bg-panel); }

.cmm-day-names {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 3px;
}

.cmm-dn {
  text-align: center;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 2px 0;
}

.cmm-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.cmm-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  font-size: 10.5px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  position: relative;
  transition: background 0.1s;
}
.cmm-cell:hover { background: var(--bg-panel); }
.cmm-cell.is-other { color: var(--text-muted); opacity: 0.4; pointer-events: none; }
.cmm-cell.is-today { background: var(--rose); color: white; }
.cmm-cell.in-week { background: var(--bg-panel); border-radius: 3px; color: var(--text-primary); }
.cmm-cell.in-week.is-today { background: var(--rose); color: white; border-radius: 50%; }
.cmm-cell.is-selected { background: var(--rose); color: white; }

.cmm-dot {
  width: 3px;
  height: 3px;
  background: var(--rose);
  border-radius: 50%;
  position: absolute;
  bottom: 1px;
}
.cmm-cell.is-today .cmm-dot,
.cmm-cell.is-selected .cmm-dot,
.cmm-cell.in-week.is-today .cmm-dot { background: white; }


/* ——————————————————————————————————————————————————————————
   PANEL ITEMS (Up Next, Shoots, Calls)
   —————————————————————————————————————————————————————————— */

.cpanel-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.cpanel-item:last-child { border-bottom: none; }
.cpanel-item:hover { background: var(--bg-panel); }

.cpanel-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.cpanel-body { min-width: 0; }

.cpanel-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cpanel-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.cpanel-empty {
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0;
}


/* ——————————————————————————————————————————————————————————
   BOTTOM: color legend (tip card removed)
   —————————————————————————————————————————————————————————— */

.cal-bottom {
  padding-top: 20px;
}

.cal-legend {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px 22px 18px;
}

.cal-legend-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.cal-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  align-items: center;
}

.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.cal-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}


/* ——————————————————————————————————————————————————————————
   TOPBAR: scope res-tabs inside cal-topbar so tab heights
   match without interfering with other pages' tab strips
   —————————————————————————————————————————————————————————— */

.cal-topbar .res-tabs {
  margin-bottom: 0;
  border-bottom: none;
}


/* ——————————————————————————————————————————————————————————
   MOBILE RESPONSIVE
   —————————————————————————————————————————————————————————— */

@media (max-width: 768px) {

  /* Stack topbar vertically */
  .cal-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .cal-toolbar { width: 100%; justify-content: space-between; }

  /* Stack layout: sidebar goes below main */
  .cal-layout {
    grid-template-columns: 1fr;
  }
  .cal-sidebar {
    width: 100%;
    min-width: 0;
  }

  /* Week view: horizontal scroll instead of squishing */
  .cal-week-grid {
    min-width: 480px;
  }
  .cwg-scroll-wrap {
    max-height: 520px;
  }
  .cal-main {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Month view: tighter cells */
  .cmg-cell {
    min-height: 60px;
    padding: 4px 4px 3px;
  }
  .cmg-cell-event { font-size: 9px; padding: 1px 3px; }
  .cmg-day-name   { font-size: 9px; }
  .cmg-cell-num   { font-size: 10px; }

  /* Day view: full width column */
  .cdv-col { min-width: 0; width: 100%; }

  /* Schedule list: tighter spacing */
  .csl-date-label { font-size: 10px; }
  .csl-event-title { font-size: 12px; }

  /* Legend: tighter wrap */
  .cal-legend-items { gap: 8px 16px; }
  .cal-legend { padding: 12px 16px 14px; }
}
