/* ──────────────────────────────────────────────
   Smart Calendar — Public Frontend Styles
────────────────────────────────────────────── */
.sc-calendar-root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 820px;
  margin: 0 auto;
  color: #111827;
}

/* Loading */
.sc-loading { text-align: center; padding: 60px; color: #6b7280; }
.sc-spinner {
  width: 36px; height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: sc-spin .7s linear infinite;
}
@keyframes sc-spin { to { transform: rotate(360deg); } }

/* Clock + controls */
.sc-topbar { padding: 0 0 12px; }
.sc-clock { font-size: 30px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.sc-clock-sub { font-size: 13px; color: #6b7280; margin-top: 2px; }
.sc-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.sc-select {
  flex: 1 1 180px;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 13px;
  background: #fff;
  color: #111827;
  cursor: pointer;
}
.sc-view-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.sc-view-tab {
  padding: 6px 18px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: #374151;
  transition: background .12s, color .12s;
}
.sc-view-tab.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }

/* Calendar box */
.sc-cal-box {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  margin-bottom: 28px;
}
.sc-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
}
.sc-cal-nav-title { font-weight: 700; font-size: 16px; }
.sc-nav-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 6px;
  width: 30px; height: 30px;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.sc-nav-btn:hover { background: #f3f4f6; }
.sc-nav-today {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: #374151;
  font-weight: 600;
}

/* Legend */
.sc-legend {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid #f3f4f6;
}
.sc-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #6b7280; }
.sc-legend-dot  { width: 10px; height: 10px; border-radius: 50%; }

/* Month grid */
.sc-month-head {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  border-bottom: 1px solid #e5e7eb;
}
.sc-day-label {
  text-align: center;
  padding: 8px 0;
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  letter-spacing: .05em;
}
.sc-month-grid { display: grid; grid-template-columns: repeat(7,1fr); }
.sc-day-cell {
  min-height: 90px;
  border-right: 1px solid #f3f4f6;
  border-bottom: 1px solid #f3f4f6;
  padding: 6px 4px;
  cursor: pointer;
  transition: background .12s;
}
.sc-day-cell:nth-child(7n) { border-right: none; }
.sc-day-cell:hover { background: #f0f7ff; }
.sc-day-cell.sc-today-cell { background: #eff6ff; }
.sc-day-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 400;
  color: #111827;
  margin-bottom: 4px;
}
.sc-day-num.sc-today-num { background: #2563eb; color: #fff; font-weight: 700; }
.sc-day-num.sc-other-month { color: #d1d5db; }
.sc-event-pill {
  font-size: 10px;
  font-weight: 700;
  border-radius: 3px;
  padding: 1px 5px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.sc-more-badge { font-size: 10px; color: #6b7280; }

/* Week view */
.sc-week-head {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  border-bottom: 1px solid #e5e7eb;
}
.sc-week-col-head {
  text-align: center;
  padding: 10px 4px;
  border-right: 1px solid #f3f4f6;
}
.sc-week-col-label { font-size: 11px; color: #6b7280; font-weight: 700; letter-spacing: .05em; }
.sc-week-col-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  margin: 4px auto 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 400; color: #111827;
}
.sc-week-col-num.sc-today-num { background: #2563eb; color: #fff; font-weight: 700; }
.sc-week-body { display: grid; grid-template-columns: repeat(7,1fr); min-height: 140px; }
.sc-week-day {
  border-right: 1px solid #f3f4f6;
  padding: 8px 4px;
  cursor: pointer;
}
.sc-week-day:last-child { border-right: none; }
.sc-week-event {
  font-size: 11px; font-weight: 600;
  border-left: 3px solid;
  border-radius: 0 4px 4px 0;
  padding: 3px 6px;
  margin-bottom: 4px;
}

/* Day view */
.sc-day-view { padding: 16px; }
.sc-day-event-card {
  display: flex; gap: 12px;
  padding: 14px 16px;
  border-left: 4px solid;
  border-radius: 0 8px 8px 0;
  margin-bottom: 12px;
}
.sc-day-event-title { font-size: 15px; font-weight: 700; }
.sc-day-event-meta  { font-size: 12px; color: #6b7280; margin-top: 2px; }
.sc-day-event-desc  { font-size: 13px; color: #374151; margin-top: 6px; }
.sc-no-events { text-align: center; padding: 40px; color: #9ca3af; font-size: 14px; }

/* Upcoming events */
.sc-upcoming-title {
  font-size: 18px;
  font-weight: 800;
  color: #111827;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sc-upcoming-list { display: grid; gap: 10px; }
.sc-upcoming-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: box-shadow .15s;
}
.sc-upcoming-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.09); }
.sc-upcoming-date-badge { text-align: center; min-width: 44px; }
.sc-upcoming-date-month { font-size: 11px; font-weight: 800; text-transform: uppercase; }
.sc-upcoming-date-day   { font-size: 24px; font-weight: 900; color: #111827; line-height: 1; }
.sc-upcoming-bar        { width: 3px; align-self: stretch; border-radius: 3px; flex-shrink: 0; }
.sc-upcoming-info       { flex: 1; min-width: 0; }
.sc-upcoming-ev-title   { font-size: 14px; font-weight: 700; color: #111827; }
.sc-upcoming-pills      { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.sc-upcoming-pill       { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 700; }
.sc-upcoming-pill-gray  { background: #f3f4f6; color: #6b7280; }
.sc-upcoming-desc       { font-size: 12px; color: #6b7280; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-upcoming-countdown  { font-size: 11px; font-weight: 700; color: #9ca3af; flex-shrink: 0; align-self: center; }
.sc-upcoming-countdown.today { color: #2563eb; }

/* Modal */
.sc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.38);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sc-modal {
  background: #fff;
  border-radius: 12px;
  width: min(480px, 92vw);
  max-height: 80vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  animation: sc-modal-in .18s ease;
}
@keyframes sc-modal-in {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}
.sc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.sc-modal-header-title { font-size: 16px; font-weight: 700; }
.sc-modal-header-count { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.sc-modal-close {
  background: none; border: none;
  font-size: 20px; cursor: pointer; color: #9ca3af; line-height: 1;
}
.sc-modal-body { padding: 16px 20px; }
.sc-modal-event {
  margin-bottom: 14px;
  padding: 14px;
  border-left: 4px solid;
  border-radius: 0 8px 8px 0;
}
.sc-modal-event-title { font-size: 15px; font-weight: 700; }
.sc-modal-event-meta  { font-size: 12px; color: #6b7280; margin-top: 2px; }
.sc-modal-event-desc  { font-size: 13px; color: #374151; margin-top: 6px; }
