/* =====================================================
   스케줄러 모바일 스킨 — scheduler.m.css
   그누보드 모바일 basic 스킨 레이아웃에 맞게 조정
   body, html 전역 스타일 사용 금지
   ===================================================== */

#sch-m-wrap {
  font-family: 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  background: #f5f5f5;
  /* 그누보드 모바일 레이아웃 너비에 맞춤 — 음수 마진 제거 */
  margin: 0;
  padding-bottom: 70px;
  box-sizing: border-box;
  width: 100%;
  overflow-x: hidden;
}

/* ── 상단 헤더 ── */
.m-header {
  background: #4a7fd4;
  color: #fff;
  padding: 12px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  width: 100%;
  box-sizing: border-box;
}
.m-header-title { font-size: 17px; font-weight: 700; letter-spacing: -0.5px; }
.m-header-sub   { font-size: 11px; opacity: 0.85; margin-top: 1px; }
.m-header-btn {
  background: rgba(255,255,255,0.2);
  border: none; border-radius: 8px;
  color: #fff; padding: 6px 10px;
  font-size: 18px; cursor: pointer; line-height: 1;
}

/* ── 검색 ── */
.m-search-wrap {
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid #eee;
  display: none;
  gap: 8px;
}
.m-search-wrap.show { display: flex; }
.m-search-input {
  flex: 1;
  border: 1px solid #e0e0e0; border-radius: 20px;
  padding: 7px 14px; font-size: 14px;
  font-family: inherit; outline: none; background: #f8f8f8;
}
.m-search-input:focus { border-color: #4a7fd4; background: #fff; }
.m-search-cancel {
  background: none; border: none;
  color: #888; font-size: 14px;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.m-search-results {
  background: #fff; margin: 0 8px 8px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  overflow: hidden; display: none;
}
.m-search-results.show { display: block; }
.m-search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid #f5f5f5; cursor: pointer;
}
.m-search-result-item:last-child { border-bottom: none; }
.m-search-result-item:active { background: #f5f5f0; }
.m-search-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.m-search-info { flex: 1; }
.m-search-title { font-size: 14px; font-weight: 500; color: #1a1a1a; }
.m-search-title mark { background: #fff3cd; border-radius: 2px; }
.m-search-date { font-size: 11px; color: #999; margin-top: 2px; }

/* ── 월 네비 ── */
.m-nav {
  background: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid #eee;
}
.m-nav-btn {
  background: none; border: none;
  font-size: 22px; color: #4a7fd4;
  cursor: pointer; padding: 4px 10px; border-radius: 8px; line-height: 1;
}
.m-nav-btn:active { background: #f0f0f0; }
.m-nav-title { font-size: 16px; font-weight: 700; color: #1a1a1a; }
.m-today-btn {
  background: #4a7fd4; color: #fff;
  border: none; border-radius: 14px;
  padding: 4px 12px; font-size: 12px;
  cursor: pointer; font-family: inherit;
}

/* ── 요일 헤더 ── */
.m-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: #fff; border-bottom: 1px solid #eee; padding: 4px 0;
}
.m-weekdays span {
  text-align: center; font-size: 11px; font-weight: 600;
  color: #888; padding: 2px 0;
}
.m-weekdays span.sun { color: #d85a30; }
.m-weekdays span.sat { color: #4a7fd4; }

/* ── 달력 그리드 ── */
.m-cal-body {
  background: #fff;
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 0; border-bottom: 1px solid #eee;
}
.m-day {
  min-height: 50px; padding: 4px 2px 2px;
  border-right: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  overflow: hidden; box-sizing: border-box;
}
.m-day:nth-child(7n) { border-right: none; }
.m-day:active { background: #f0f0f0; }

.m-day-num {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 400; color: #1a1a1a; flex-shrink: 0;
}
.m-day.col-sun .m-day-num,
.m-day.is-holiday .m-day-num { color: #d85a30; }
.m-day.col-sat:not(.is-holiday) .m-day-num { color: #4a7fd4; }
.m-day.today .m-day-num { background: #4a7fd4; color: #fff; font-weight: 700; }
.m-day.out-month .m-day-num { color: #ccc; }
.m-day.selected .m-day-num { background: #e8f0fb; color: #1a56c4; font-weight: 700; }

.m-lunar { font-size: 9px; color: #bbb; line-height: 1; text-align: center; }
.m-lunar.lunar-new { color: #3b7a3b; font-weight: 600; }
.m-day.out-month .m-lunar { color: #e0e0e0; }

.m-dots { display: flex; gap: 2px; justify-content: center; margin-top: 1px; }
.m-dot  { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

/* ── 날짜 패널 ── */
.m-day-panel {
  background: #fff; margin: 8px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08); overflow: hidden;
}
.m-day-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px 9px; border-bottom: 1px solid #f0f0f0;
}
.m-day-panel-date  { font-size: 14px; font-weight: 700; color: #1a1a1a; }
.m-day-panel-lunar { font-size: 11px; color: #999; margin-top: 2px; }
.m-day-panel-add {
  background: #4a7fd4; color: #fff;
  border: none; border-radius: 18px;
  padding: 5px 13px; font-size: 13px;
  cursor: pointer; font-family: inherit;
}
.m-sched-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid #f8f8f8; cursor: pointer;
}
.m-sched-item:last-child  { border-bottom: none; }
.m-sched-item:active      { background: #f5f5f0; }
.m-sched-color   { width: 4px; height: 34px; border-radius: 2px; flex-shrink: 0; }
.m-sched-info    { flex: 1; }
.m-sched-title   { font-size: 14px; font-weight: 500; color: #1a1a1a; line-height: 1.3; }
.m-sched-title.is-lunar::before { content: '음 '; font-size: 11px; color: #3b7a3b; }
.m-sched-meta    { font-size: 11px; color: #999; margin-top: 2px; }
.m-sched-arrow   { color: #ccc; font-size: 16px; }
.m-empty         { text-align: center; padding: 18px; color: #bbb; font-size: 13px; }

/* ── 하단 네비 ── */
.m-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid #eee;
  display: flex; align-items: center; height: 56px;
  z-index: 500;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}
.m-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  cursor: pointer; padding: 5px 0;
  border: none; background: none;
  color: #aaa; font-family: inherit;
}
.m-nav-item.active { color: #4a7fd4; }
.m-nav-item-icon  { font-size: 19px; line-height: 1; }
.m-nav-item-label { font-size: 10px; font-weight: 500; }
.m-nav-add {
  flex: 0 0 56px; display: flex;
  align-items: center; justify-content: center;
  position: relative; top: -10px;
}
.m-nav-add-circle {
  width: 48px; height: 48px;
  background: #4a7fd4; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff;
  box-shadow: 0 4px 14px rgba(74,127,212,0.4);
  border: none; cursor: pointer; font-family: inherit; line-height: 1;
}
.m-nav-add-circle:active { background: #3868be; }

/* ── 모달 (바텀 시트) ── */
.m-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 600;
  display: flex; align-items: flex-end; justify-content: center;
}
.m-modal {
  background: #fff;
  border-radius: 18px 18px 0 0;
  width: 100%; max-height: 90vh;
  overflow-y: auto;
  padding-bottom: 20px;
  animation: mSlideUp 0.22s ease;
}
@keyframes mSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.m-modal-handle {
  width: 34px; height: 4px; background: #ddd;
  border-radius: 2px; margin: 9px auto 3px;
}
.m-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 16px 11px; border-bottom: 1px solid #f0f0f0;
}
.m-modal-title { font-size: 15px; font-weight: 700; color: #1a1a1a; }
.m-modal-close {
  background: #f0f0f0; border: none; border-radius: 50%;
  width: 28px; height: 28px; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #666;
}
.m-modal-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }

.m-form-row { display: flex; flex-direction: column; gap: 4px; }
.m-form-row label { font-size: 11px; color: #888; font-weight: 600; }
.m-form-row input[type="text"],
.m-form-row input[type="date"],
.m-form-row input[type="time"],
.m-form-row textarea,
.m-form-row select {
  border: 1px solid #e8e8e8; border-radius: 9px;
  padding: 9px 11px; font-size: 14px;
  font-family: inherit; background: #fafafa;
  outline: none; color: #1a1a1a; width: 100%; box-sizing: border-box;
}
.m-form-row input:focus,
.m-form-row textarea:focus,
.m-form-row select:focus { border-color: #4a7fd4; background: #fff; }
.m-form-row textarea { resize: none; }
.m-date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.m-color-picker { display: flex; gap: 9px; flex-wrap: wrap; padding: 3px 0; }
.m-color-opt {
  width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent; transition: transform .1s;
}
.m-color-opt.selected { border-color: #1a1a1a; transform: scale(1.15); }

.m-lunar-row {
  display: flex; align-items: center; justify-content: space-between;
  background: #f8f8f4; border-radius: 9px; padding: 9px 12px;
}
.m-lunar-label { font-size: 13px; color: #444; }
.m-lunar-info  { font-size: 11px; color: #3b7a3b; margin-top: 2px; }
.m-toggle { position: relative; width: 42px; height: 23px; }
.m-toggle input { opacity: 0; width: 0; height: 0; }
.m-toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #ccc; border-radius: 23px; transition: .3s;
}
.m-toggle-slider:before {
  content: ''; position: absolute;
  width: 17px; height: 17px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .3s;
}
.m-toggle input:checked + .m-toggle-slider { background: #3b7a3b; }
.m-toggle input:checked + .m-toggle-slider:before { transform: translateX(19px); }

.m-modal-footer {
  padding: 10px 16px; border-top: 1px solid #f0f0f0;
  display: flex; gap: 8px;
}
.m-btn-save {
  flex: 2; background: #4a7fd4; color: #fff;
  border: none; border-radius: 11px; padding: 13px;
  font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.m-btn-save:active { background: #3868be; }
.m-btn-cancel {
  flex: 1; background: #f0f0f0; color: #555;
  border: none; border-radius: 11px; padding: 13px;
  font-size: 14px; cursor: pointer; font-family: inherit;
}
.m-btn-delete {
  background: #fdecea; color: #c62828;
  border: none; border-radius: 11px; padding: 13px 14px;
  font-size: 14px; cursor: pointer; font-family: inherit;
}

/* ── 상세보기 ── */
.m-view-color-bar { height: 4px; }
.m-view-body { padding: 14px 16px; }
.m-view-title { font-size: 17px; font-weight: 700; color: #1a1a1a; margin-bottom: 12px; }
.m-view-row  { display: flex; gap: 8px; font-size: 13px; margin-bottom: 9px; align-items: flex-start; }
.m-view-label { color: #999; min-width: 48px; padding-top: 1px; }
.m-view-val   { color: #333; flex: 1; line-height: 1.5; }
.m-view-memo  {
  background: #f8f8f4; border-radius: 9px;
  padding: 9px 12px; font-size: 13px; color: #444;
  white-space: pre-wrap; margin-top: 4px;
}
.m-view-footer {
  padding: 10px 16px; border-top: 1px solid #f0f0f0; display: flex; gap: 8px;
}
.m-btn-edit {
  flex: 2; background: #4a7fd4; color: #fff;
  border: none; border-radius: 11px; padding: 13px;
  font-size: 14px; cursor: pointer; font-family: inherit;
}

/* ── 스와이프 애니메이션 ── */
.m-cal-body.swipe-left-out  { animation: mSwipeLeftOut  0.2s ease forwards; }
.m-cal-body.swipe-right-out { animation: mSwipeRightOut 0.2s ease forwards; }
.m-cal-body.swipe-left-in   { animation: mSwipeLeftIn   0.2s ease forwards; }
.m-cal-body.swipe-right-in  { animation: mSwipeRightIn  0.2s ease forwards; }
@keyframes mSwipeLeftOut  { from{transform:translateX(0);opacity:1;} to{transform:translateX(-30%);opacity:0;} }
@keyframes mSwipeRightOut { from{transform:translateX(0);opacity:1;} to{transform:translateX(30%);opacity:0;} }
@keyframes mSwipeLeftIn   { from{transform:translateX(30%);opacity:0;} to{transform:translateX(0);opacity:1;} }
@keyframes mSwipeRightIn  { from{transform:translateX(-30%);opacity:0;} to{transform:translateX(0);opacity:1;} }
