/* ==========================================================================
   메이플 레코드 - 메이플 캘린더 전용 스타일 (/Util/2/calendar/calendar.css)
   ========================================================================== */

.calendar-page-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

/* 1. 상단 히어로 바 */
.cal-hero-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, #161b26 0%, #11151f 100%);
  border: 1px solid #283142;
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.cal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.cal-title-badge {
  background: rgba(240, 100, 59, 0.16);
  color: #ff8b60;
  border: 1px solid rgba(240, 100, 59, 0.35);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.cal-main-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
  letter-spacing: -0.4px;
}

.cal-sub-desc {
  margin: 0;
  font-size: 0.88rem;
  color: #94a3b8;
}

.cal-hero-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 2. 상단 4대 핵심 KPI 카드 */
.cal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.cal-kpi-card {
  background: #151a24;
  border: 1px solid #262f40;
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.cal-kpi-card:hover {
  transform: translateY(-2px);
  border-color: #38465e;
}

.cal-kpi-card.kpi-reset {
  border-left: 4px solid #f97316;
}
.cal-kpi-card.kpi-sunday {
  border-left: 4px solid #facc15;
}
.cal-kpi-card.kpi-update {
  border-left: 4px solid #38bdf8;
}
.cal-kpi-card.kpi-event {
  border-left: 4px solid #34d399;
}

.kpi-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
}

.kpi-dday-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.16);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.35);
}

.kpi-dday-pill.pill-sunday {
  background: rgba(250, 204, 21, 0.15);
  color: #fde047;
  border-color: rgba(250, 204, 21, 0.35);
}

.kpi-dday-pill.pill-update {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
}

.kpi-dday-pill.pill-event {
  background: rgba(52, 211, 153, 0.15);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.35);
}

.kpi-main-val {
  font-size: 1.04rem;
  font-weight: 800;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-amber { color: #fde047 !important; }
.text-sky { color: #7dd3fc !important; }
.text-emerald { color: #6ee7b7 !important; }

.kpi-sub-text {
  font-size: 0.76rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-link-text {
  font-size: 0.76rem;
  font-weight: 700;
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.15s ease;
}

.kpi-link-text:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* 3. 달력 월 이동 & 필터 컨트롤 바 */
.cal-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  background: #151a24;
  border: 1px solid #262f40;
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 18px;
}

.cal-month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-month-arrow {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #2e384d;
  background: #0f131b;
  color: #cbd5e1;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-month-arrow:hover {
  background: #232c3d;
  color: #ffffff;
  border-color: #475569;
}

.cal-current-ym {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 6px;
  min-width: 130px;
  text-align: center;
}

.btn-today-jump {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(240, 100, 59, 0.4);
  background: rgba(240, 100, 59, 0.14);
  color: #ff9854;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-today-jump:hover {
  background: #f0643b;
  color: #ffffff;
}

.cal-filter-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.cal-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid #2b3548;
  background: #0f131b;
  color: #94a3b8;
  font-size: 0.81rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cal-filter-chip:hover {
  color: #e2e8f0;
  border-color: #475569;
}

.cal-filter-chip.active {
  background: #232c3d;
  color: #ffffff;
  border-color: #64748b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-reset { background: #f97316; }
.dot-sunday { background: #facc15; }
.dot-update { background: #38bdf8; }
.dot-event { background: #34d399; }
.dot-memo { background: #c084fc; }

/* 4. 메인 달력 + 사이드 패널 레이아웃 */
.cal-workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.cal-board-card {
  background: #151a24;
  border: 1px solid #262f40;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.cal-weekdays-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: #10141d;
  border-bottom: 1px solid #262f40;
}

.weekday-cell {
  padding: 12px 6px;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 800;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.weekday-cell.sun {
  color: #f87171;
}

.weekday-cell.thu {
  color: #fb923c;
  background: rgba(249, 115, 22, 0.07);
}

.weekday-cell.sat {
  color: #60a5fa;
}

.wd-sub {
  font-size: 0.66rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
}

.weekday-cell.thu .wd-sub {
  background: rgba(249, 115, 22, 0.2);
  color: #fdba74;
}

.weekday-cell.sun .wd-sub {
  background: rgba(250, 204, 21, 0.16);
  color: #fde047;
}

/* 달력 날짜 그리드 */
.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: #1e2636;
  gap: 1px;
}

.cal-day-cell {
  min-height: 122px;
  background: #151a24;
  padding: 8px 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  position: relative;
  transition: background-color 0.12s ease;
}

.cal-day-cell:hover {
  background: #1b2230;
}

/* 매주 목요일 초기화 컬럼 전용 은은한 강조 */
.cal-day-cell.is-thursday {
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.05) 0%, #151a24 100%);
}

.cal-day-cell.is-thursday:hover {
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.11) 0%, #1b2230 100%);
}

.cal-day-cell.other-month {
  background: #10141c;
  opacity: 0.48;
}

.cal-day-cell.is-today {
  background: rgba(56, 189, 248, 0.07);
  box-shadow: inset 0 0 0 1.5px rgba(56, 189, 248, 0.55);
}

.cal-day-cell.is-selected {
  box-shadow: inset 0 0 0 2px #ff7b54 !important;
  background: #1c2433;
}

.day-cell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 2px;
}

.day-num {
  font-size: 0.86rem;
  font-weight: 800;
  color: #cbd5e1;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.cal-day-cell.sun .day-num { color: #f87171; }
.cal-day-cell.sat .day-num { color: #60a5fa; }
.cal-day-cell.is-today .day-num {
  background: #0284c7;
  color: #ffffff;
}

.day-top-tags {
  display: flex;
  align-items: center;
  gap: 3px;
}

.day-reset-mini-tag {
  font-size: 0.63rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(249, 115, 22, 0.18);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.35);
}

.day-monthly-mini-tag {
  font-size: 0.63rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.38);
}

/* 날짜 셀 내부 이벤트 배지 목록 */
.day-badges-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.cal-event-pill {
  font-size: 0.71rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 카테고리별 배지 색상 */
.pill-cat-reset {
  background: rgba(249, 115, 22, 0.14);
  color: #fdba74;
  border-left: 2.5px solid #f97316;
}

.pill-cat-monthly-reset {
  background: rgba(244, 63, 94, 0.16);
  color: #fda4af;
  border-left: 2.5px solid #f43f5e;
}

.pill-cat-sunday {
  background: rgba(250, 204, 21, 0.15);
  color: #fef08a;
  border-left: 2.5px solid #facc15;
}

.pill-cat-update {
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
  border-left: 2.5px solid #38bdf8;
}

.pill-cat-event-start {
  background: rgba(52, 211, 153, 0.15);
  color: #a7f3d0;
  border-left: 2.5px solid #10b981;
}

.pill-cat-event-end {
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
  border-left: 2.5px solid #ef4444;
}

.pill-cat-cashshop {
  background: rgba(236, 72, 153, 0.15);
  color: #fbcfe8;
  border-left: 2.5px solid #ec4899;
}

.pill-cat-memo {
  background: rgba(192, 132, 252, 0.16);
  color: #e9d5ff;
  border-left: 2.5px solid #a855f7;
}

.day-more-count {
  font-size: 0.68rem;
  font-weight: 700;
  color: #94a3b8;
  padding-left: 4px;
}

/* 범례 푸터 */
.cal-legend-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 16px;
  background: #10141d;
  border-top: 1px solid #262f40;
  font-size: 0.76rem;
  color: #94a3b8;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.badge-reset { background: rgba(249, 115, 22, 0.2); color: #fb923c; }
.badge-monthly-reset { background: rgba(244, 63, 94, 0.2); color: #fda4af; }
.badge-sunday { background: rgba(250, 204, 21, 0.2); color: #fde047; }
.badge-update { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; }
.badge-event-end { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

/* 5. 우측 사이드 상세 패널 */
.cal-side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.side-card {
  background: #151a24;
  border: 1px solid #262f40;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

.side-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid #242d3d;
  margin-bottom: 14px;
}

.selected-date-sub {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: #fb923c;
  margin-bottom: 2px;
}

.selected-date-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  color: #ffffff;
}

.selected-day-Count-badge {
  background: #232c3d;
  color: #e2e8f0;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}

.side-events-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 14px;
}

.side-event-item {
  background: #10141d;
  border: 1px solid #242d3d;
  border-radius: 10px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.side-event-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.side-event-tag {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 5px;
}

.side-event-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.35;
  word-break: keep-all;
}

.side-event-meta {
  font-size: 0.75rem;
  color: #8b949e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.side-event-link {
  color: #60a5fa;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.75rem;
}

.side-event-link:hover {
  text-decoration: underline;
}

.btn-del-memo {
  background: transparent;
  border: 1px solid #3f2228;
  color: #f87171;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 5px;
  cursor: pointer;
}

.btn-del-memo:hover {
  background: #3f2228;
}

/* 개인 메모 입력 박스 */
.custom-memo-box {
  background: #10141d;
  border: 1px solid #262f40;
  border-radius: 10px;
  padding: 12px;
}

.memo-box-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.memo-input-row {
  display: flex;
  gap: 6px;
}

.memo-input-row input {
  flex: 1;
  min-width: 0;
  background: #161c28;
  border: 1px solid #2d3748;
  border-radius: 8px;
  padding: 8px 10px;
  color: #ffffff;
  font-size: 0.83rem;
}

.memo-input-row input:focus {
  outline: none;
  border-color: #ff7b54;
}

/* 진행 중인 전체 이벤트 타임라인 */
.active-events-card .side-card-header h3 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 800;
  color: #f8fafc;
}

.api-sync-time {
  font-size: 0.7rem;
  color: #64748b;
}

.active-events-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.active-ev-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  background: #10141d;
  border: 1px solid #242d3d;
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.active-ev-row:hover {
  border-color: #3b4963;
  transform: translateX(2px);
}

.active-ev-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.active-ev-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-ev-dday {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}

.dday-urgent {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.dday-normal {
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.active-ev-period {
  font-size: 0.73rem;
  color: #64748b;
}

.empty-side-msg {
  text-align: center;
  padding: 22px 10px;
  color: #64748b;
  font-size: 0.83rem;
}

/* 반응형 미디어 쿼리 */
@media (max-width: 1100px) {
  .cal-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cal-workspace-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .cal-hero-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .cal-kpi-grid {
    grid-template-columns: 1fr;
  }
  .cal-day-cell {
    min-height: 86px;
    padding: 5px 4px;
  }
  .cal-event-pill {
    font-size: 0.64rem;
    padding: 2px 4px;
  }
  .wd-sub,
  .day-reset-mini-tag,
  .day-monthly-mini-tag {
    display: none;
  }
}