/* ---------------------------------------------------------------------------
 * calendar.css — page-specific styles for the Calendar view
 * ---------------------------------------------------------------------------
 * Extracted from the former inline <style> block in templates/calendar.ts
 * (App-Building Bible principle 5). Loaded via the layout headExtra <link>.
 * ------------------------------------------------------------------------- */

.cal-view-active {
  background: var(--primary-light) !important;
  color: var(--primary) !important;
  border: 1px solid var(--primary) !important;
}

.cal-layout {
  display: grid;
  grid-template-columns: 1fr 250px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1080px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-sidebar { display: none; }
}

/* Grid */
.cal-grid { border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.cal-header-row { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--bg); }
.cal-hdr {
  padding: 8px; font-size: 11px; font-weight: 600; color: var(--muted);
  text-align: center; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.cal-body { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
  min-height: 108px; padding: 4px; border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  display: flex; flex-direction: column; gap: 2px; position: relative;
  transition: background .08s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-outside { background: var(--bg); min-height: 50px; }
.cal-today { background: var(--primary-light); }
.cal-weekend { background: var(--bg); }
.cal-date {
  font-size: 11px; font-weight: 500; color: var(--muted);
  padding: 2px 4px; align-self: flex-end;
}
.cal-date-active {
  background: var(--primary); color: #fff; border-radius: 50%;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.cal-drop { background: var(--primary-light) !important; outline: 2px dashed var(--primary); outline-offset: -2px; }

/* Card */
.cal-card {
  display: flex; flex-direction: column; gap: 2px;
  padding: 3px 4px; border-radius: 4px;
  background: var(--surface); border: 1px solid var(--border-light);
  cursor: grab; transition: box-shadow .08s, border-color .08s;
  text-decoration: none; color: var(--ink);
}
.cal-card:hover { border-color: var(--border); box-shadow: var(--shadow); }
.cal-card:active { cursor: grabbing; }
.cal-card-chips { display: flex; gap: 2px; align-items: center; }
.cal-card-chips .chip { font-size: 9px; padding: 0 4px; line-height: 14px; }
.cal-card-title {
  font-size: 10px; font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cal-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 2px; }
.cal-more { font-size: 10px; color: var(--muted); padding: 2px 4px; font-weight: 500; cursor: pointer; }
.cal-more:hover { color: var(--primary); }

/* List view */
.cal-list { display: flex; flex-direction: column; gap: 20px; }
.cal-list-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.cal-list-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 4px; font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  transition: background .08s; text-decoration: none; color: var(--ink);
}
.cal-list-row:hover { background: var(--border-light); }

/* Sidebar panels */
.cal-sidebar { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 20px; }
.cal-panel {
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-card);
  background: var(--surface);
}
.cal-panel-title {
  font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; margin-bottom: 10px;
}
.cal-stat {
  display: flex; flex-direction: column; padding: 8px; border-radius: var(--radius-chip);
  background: var(--bg);
}
.cal-stat-val { font-size: 20px; font-weight: 700; line-height: 1.1; }
.cal-stat-lbl { font-size: 11px; color: var(--muted); font-weight: 500; }

/* Dialog */
.cal-dialog {
  border: none; border-radius: var(--radius-card); padding: 24px;
  box-shadow: 0 24px 48px rgba(0,0,0,.12); max-width: 480px; width: 100%;
}
.cal-dialog::backdrop { background: rgba(0,0,0,.3); }

/* Toast */
.cal-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: #fff;
  box-shadow: var(--shadow-md); transition: opacity .3s, transform .3s;
  opacity: 0; transform: translateY(10px); pointer-events: none;
}
.cal-toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.cal-toast-success { background: #059669; }
.cal-toast-error { background: #DC2626; }
