/* ==========================================================================
   Calendar Page Styles
   Loaded ONLY by calendar.html — do not reference these classes elsewhere.
   ========================================================================== */

/* Header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.title h1 {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: 0.2px;
}

.subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

/* Two-column layout: calendar on left, side panel on right.
   At ≤1100px collapses to single column (side panel moves below calendar). */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 18px;
  align-items: start;
}

/* Calendar card wrapper — overflow:hidden clips the day grid's border-radius */
.cal-card {
  overflow: hidden;
}

/* Month navigation bar at the top of the calendar card */
.cal-topbar {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.month-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.month-title strong {
  font-size: 15px;
  letter-spacing: 0.2px;
}

.month-title span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.cal-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cal-body {
  padding: 14px 14px 16px;
}

/* Day-of-week header row — 7 equal columns aligned with .cal-grid below */
.dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.dow div {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.68);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 0 6px;
}

/* 7-column calendar day grid — renamed from .grid to .cal-grid to avoid
   collision with the shared 2-column form .grid in components.css.
   DEPENDENCY: calendar.html must use class="cal-grid" (not "grid") on the
   container div, and calendar.js targets #calGrid by ID. */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 94px;
  gap: 10px;
}

/* Individual calendar day cell — flex column for day-head + event chips */
.day {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  padding: 8px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  overflow: hidden;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.day:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}

/* Days from the previous or next month shown to fill a full 6-week grid */
.day.other {
  opacity: 0.55;
}

/* Today's date: teal border + subtle glow */
.day.today {
  border-color: rgba(45, 189, 177, 0.45);
  box-shadow: 0 0 0 3px rgba(45, 189, 177, 0.08);
}

/* Currently selected date: blue border + subtle glow */
.day.selected {
  border-color: rgba(60, 123, 216, 0.5);
  box-shadow: 0 0 0 3px rgba(60, 123, 216, 0.08);
}

/* Row with day number and event count badge */
.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.day-num {
  font-weight: 900;
  font-size: 13px;
  opacity: 0.95;
}

/* Small count badge shown when a day has events */
.day-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.75);
}

/* Container for event chips within a day cell; hidden overflow clips extra chips */
.chips {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

/* Individual event chip inside a day cell.
   Color modifier classes (teal | blue | amber) MUST match the event type values
   stored in the DB: interview → teal, followup/reminder → blue, deadline → amber.
   Changing type values in the DB requires updating TYPE_META in calendar.js
   and these CSS classes. */
.event-chip {
  border-radius: 5px;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.4;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.event-chip:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Teal: interview events */
.event-chip.teal {
  background: rgba(47, 209, 191, 0.18);
  border-color: rgba(47, 209, 191, 0.35);
}

/* Blue: follow-up and reminder events */
.event-chip.blue {
  background: rgba(60, 123, 216, 0.18);
  border-color: rgba(60, 123, 216, 0.35);
}

/* Amber: deadline events */
.event-chip.amber {
  background: rgba(255, 196, 70, 0.18);
  border-color: rgba(255, 196, 70, 0.35);
}

/* "+N more" overflow label when a day has more than 3 events */
.more {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  padding-left: 3px;
}

/* ==========================================================================
   Side Panel
   Shows events for the selected day. Sits to the right of the calendar card.
   ========================================================================== */

.side-card {
  overflow: hidden;
}

/* Header row with selected date label and event count pill */
.side-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.side-header h3 {
  font-size: 16px;
  font-weight: 850;
}

.side-body {
  padding: 14px 16px 16px;
}

/* Search + clear button row */
.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.search-row input {
  flex: 1;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

/* Vertical list of event items for the selected day */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Individual event card in the side panel — click to open edit modal */
.item {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.12);
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.item:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Top row: event title (left) and time range (right) */
.item .top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.item strong {
  font-size: 13px;
}

.item .time {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
}

/* Event type + notes on second line */
.item .meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
}

/* Empty state label when no events exist for selected day */
.empty {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  padding: 10px 4px;
}

/* ==========================================================================
   Legend
   Color key for event types, shown at the bottom of the calendar card.
   Dot colors match .event-chip.teal / .blue / .amber above.
   ========================================================================== */

.cal-legend {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 700;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.legend-dot.teal {
  background: rgba(47, 209, 191, 0.7);
  border: 1px solid rgba(47, 209, 191, 0.5);
}

.legend-dot.blue {
  background: rgba(60, 123, 216, 0.7);
  border: 1px solid rgba(60, 123, 216, 0.5);
}

.legend-dot.amber {
  background: rgba(255, 196, 70, 0.7);
  border: 1px solid rgba(255, 196, 70, 0.5);
}

.legend-dot.default {
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet: collapse two-column layout to single column */
@media (max-width: 1100px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

/* Small tablet: stack page header */
@media (max-width: 780px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   App Picker Popup
   Appears when the user clicks a calendar day cell. Shows today's events
   and a list of applications to quickly attach events to.
   z-index: 200 — above the main modal (z-index: 60).
   ========================================================================== */

.app-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.app-picker-backdrop.show {
  display: flex;
}

.app-picker {
  background: linear-gradient(180deg, #1a2438, #131b2c);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 20px;
  width: min(580px, 96vw);
  max-height: 82vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow);
}

/* Top row: date label + close button */
.app-picker-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.app-picker-label {
  font-size: 16px;
  font-weight: 850;
}

.app-picker-date {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.62);
  margin-top: 3px;
}

/* Sections group related content (Today's Events / Applications) */
.picker-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.picker-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Section label — uppercase, muted, small */
.picker-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255, 255, 255, 0.4);
}

/* Event count pill beside the section label */
.picker-event-count {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.07);
  padding: 2px 8px;
  border-radius: 999px;
}

.picker-section-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: -2px;
}

/* List of events already on the selected day */
.picker-events-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.picker-no-events {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  font-style: italic;
  padding: 4px 2px;
}

/* Single event row: dot + label + edit/delete buttons */
.picker-event-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.12);
}

/* Colored dot matching the event type chip color */
.schedule-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.3);
}

.schedule-dot.teal  { background: rgba(47, 209, 191, 0.85); }
.schedule-dot.blue  { background: rgba(60, 123, 216, 0.85); }
.schedule-dot.amber { background: rgba(255, 196, 70, 0.85); }

/* Event title label — flex-grows, truncates overflow */
.picker-event-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Inline edit and delete icon buttons on each event row */
.picker-event-edit,
.picker-event-del {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
}

.picker-event-edit { color: rgba(255, 255, 255, 0.38); }
.picker-event-edit:hover { background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.85); }

.picker-event-del { color: rgba(220, 80, 80, 0.5); }
.picker-event-del:hover { background: rgba(220, 80, 80, 0.12); color: rgba(220, 80, 80, 0.9); }

/* Reduces opacity on the dragged item while dragging */
.picker-event-item.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

/* Drag-to-delete trash zone — appears below the events list */
.picker-trash-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1.5px dashed rgba(220, 80, 80, 0.3);
  border-radius: 8px;
  color: rgba(220, 80, 80, 0.4);
  font-size: 12px;
  cursor: default;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  user-select: none;
}

/* Active state when a dragged event is over the trash zone */
.picker-trash-zone.active {
  background: rgba(220, 80, 80, 0.1);
  border-color: rgba(220, 80, 80, 0.75);
  color: rgba(220, 80, 80, 0.95);
}

.picker-trash-icon { font-size: 14px; }

/* List of application cards in the picker */
.app-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* One application row: shows company+role and quick-add type buttons */
.picker-app-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: background 0.12s;
}

.picker-app-card:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Company · Role and status badge row */
.picker-app-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.picker-app-name {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status badge next to the application name */
.app-row-status {
  font-size: 11px;
  font-weight: 800;
  text-transform: capitalize;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Status-specific colors match .chip variants in components.css */
.app-row-status.status-interviewing { background: rgba(47, 209, 191, 0.18); color: rgba(47, 209, 191, 0.9); }
.app-row-status.status-offer        { background: rgba(60, 200, 100, 0.18); color: rgba(60, 200, 100, 0.9); }
.app-row-status.status-rejected     { background: rgba(220, 80, 80, 0.18);  color: rgba(220, 80, 80, 0.9); }
.app-row-status.status-applied      { background: rgba(60, 123, 216, 0.18); color: rgba(60, 123, 216, 0.9); }

/* Row of quick "Interview / Follow-up / Deadline / Reminder / Other" buttons */
.picker-type-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Pill-shaped quick-add button — one per event type per application */
.picker-type-btn {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.1s;
}

.picker-type-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
}

.picker-type-btn:active { transform: translateY(0); }

/* Colored variants match event type chip colors */
.picker-type-btn.teal  { border-color: rgba(47, 209, 191, 0.4);  color: rgba(47, 209, 191, 0.85); }
.picker-type-btn.blue  { border-color: rgba(60, 123, 216, 0.4);  color: rgba(60, 123, 216, 0.85); }
.picker-type-btn.amber { border-color: rgba(255, 196, 70, 0.4);  color: rgba(255, 196, 70, 0.85); }

.picker-type-btn.teal:hover  { background: rgba(47, 209, 191, 0.18); border-color: rgba(47, 209, 191, 0.7); color: rgba(47, 209, 191, 1); }
.picker-type-btn.blue:hover  { background: rgba(60, 123, 216, 0.18); border-color: rgba(60, 123, 216, 0.7); color: rgba(60, 123, 216, 1); }
.picker-type-btn.amber:hover { background: rgba(255, 196, 70, 0.18);  border-color: rgba(255, 196, 70, 0.7);  color: rgba(255, 196, 70, 1); }

/* Empty state when user has no applications */
.app-picker-empty {
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
  padding: 6px 2px;
}

/* "New Event" full-width button at the bottom of the picker */
.picker-manual-btn {
  width: 100%;
  justify-content: center;
}

/* ==========================================================================
   Modal Type Quick Buttons
   Appear in the event modal below the Type select dropdown to let users
   set the type with a single click instead of using the select.
   ========================================================================== */

.type-quick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 2px;
}

.type-quick-label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  margin-right: 2px;
}

.type-quick-btn {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.type-quick-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

/* Colored default (inactive) state */
.type-quick-btn.teal  { border-color: rgba(47, 209, 191, 0.3);  color: rgba(47, 209, 191, 0.7); }
.type-quick-btn.blue  { border-color: rgba(60, 123, 216, 0.3);  color: rgba(60, 123, 216, 0.7); }
.type-quick-btn.amber { border-color: rgba(255, 196, 70, 0.3);  color: rgba(255, 196, 70, 0.7); }

/* Active state — applied by syncTypeQuickBtns() in calendar.js when this
   type matches the current value of the #typeInput select */
.type-quick-btn.teal.active  { background: rgba(47, 209, 191, 0.2); border-color: rgba(47, 209, 191, 0.6); color: rgba(47, 209, 191, 1); }
.type-quick-btn.blue.active  { background: rgba(60, 123, 216, 0.2); border-color: rgba(60, 123, 216, 0.6); color: rgba(60, 123, 216, 1); }
.type-quick-btn.amber.active { background: rgba(255, 196, 70, 0.2); border-color: rgba(255, 196, 70, 0.6); color: rgba(255, 196, 70, 1); }
.type-quick-btn.active       { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.4); color: rgba(255, 255, 255, 0.95); }
