/* =========================================================
   Family Calendar
   ========================================================= */

.cal-main {
  padding: 32px 24px 96px;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.cal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.cal-month-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex: 1;
  text-align: center;
}
.cal-nav-btn {
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  color: var(--ink);
}
.cal-nav-btn:hover { border-color: var(--primary); color: var(--primary); }
.cal-add-btn { white-space: nowrap; }

/* Calendar grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.cal-day-header {
  padding: 10px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

#cal-cells {
  display: contents;
}

.cal-cell {
  min-height: 80px;
  padding: 6px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  position: relative;
  cursor: default;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.empty { background: var(--bg); opacity: 0.5; }
.cal-cell.today { background: var(--primary-light); }

.cal-date {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}
.cal-cell.today .cal-date {
  color: var(--primary);
}

.cal-event {
  font-size: 10px;
  font-weight: 600;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* Upcoming events list */
.upcoming-section {
  margin-top: 40px;
}
.section-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 16px;
}
.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.upcoming-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: all 0.15s ease;
}
.upcoming-item:hover { box-shadow: var(--shadow-sm); }

.upcoming-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.upcoming-info { flex: 1; }
.upcoming-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.upcoming-desc {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.upcoming-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}
.upcoming-actions {
  display: flex;
  gap: 4px;
}
.upcoming-actions button {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-body);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--ink-soft);
}
.upcoming-actions .del-btn:hover { color: var(--rose); border-color: var(--rose); }

/* Event color grid */
.event-color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.ev-color-opt {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ev-color-opt:hover { transform: scale(1.15); }
.ev-color-opt.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink);
}

.form-error {
  color: var(--rose);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

@media (max-width: 720px) {
  .cal-main { padding: 20px 12px 64px; }
  .cal-header { gap: 8px; }
  .cal-month-title { font-size: 22px; }
  .cal-cell { min-height: 56px; padding: 4px; }
  .cal-date { font-size: 11px; }
  .cal-event { font-size: 9px; padding: 1px 4px; }
  .cal-add-btn { width: 100%; order: 10; }
}
