/* scheduler.css */
#scheduler-wrap{max-width:960px;margin:20px auto;font-family:'Malgun Gothic','Apple SD Gothic Neo','Noto Sans KR',sans-serif;}

.toolbar{display:flex;align-items:center;gap:8px;margin-bottom:12px;flex-wrap:wrap;}
.view-tabs{display:flex;gap:6px;}
.tab-btn{padding:6px 22px;border:1px solid #ddd;border-radius:20px;background:#fff;cursor:pointer;font-size:13px;color:#666;transition:all 0.15s;font-family:inherit;}
.tab-btn.active{background:#4a7fd4;color:#fff;border-color:#4a7fd4;}
.notify-btn{background:none;border:1px solid #ddd;border-radius:20px;padding:6px 12px;font-size:13px;cursor:pointer;color:#666;font-family:inherit;white-space:nowrap;}
.notify-btn.on{background:#e8f5e9;color:#2e7d32;border-color:#a5d6a7;}
.notify-btn.off{background:#fff8e1;color:#f57f17;border-color:#ffe082;}
.search-wrap{display:flex;align-items:center;gap:6px;margin-left:auto;}
.search-input{border:1px solid #ddd;border-radius:20px;padding:6px 14px;font-size:13px;font-family:inherit;outline:none;width:180px;}
.search-input:focus{border-color:#4a7fd4;}
.search-btn{background:#4a7fd4;color:#fff;border:none;border-radius:20px;padding:6px 14px;font-size:13px;cursor:pointer;font-family:inherit;}
.search-btn:hover{background:#3868be;}

.search-panel{background:#fff;border-radius:12px;padding:1rem 1.25rem;box-shadow:0 2px 12px rgba(0,0,0,.08);margin-bottom:12px;display:none;}
.search-panel.show{display:block;}
.search-panel-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;}
.search-panel-title{font-size:14px;font-weight:600;}
.search-close-btn{background:none;border:none;font-size:16px;cursor:pointer;color:#999;}
.search-result-list{display:flex;flex-direction:column;gap:6px;max-height:280px;overflow-y:auto;}
.search-result-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;cursor:pointer;border:1px solid #eee;transition:background .1s;}
.search-result-item:hover{background:#f5f5f0;}
.search-result-color{width:10px;height:10px;border-radius:50%;flex-shrink:0;}
.search-result-info{flex:1;}
.search-result-title{font-size:13px;font-weight:500;}
.search-result-title mark{background:#fff3cd;border-radius:2px;padding:0 2px;}
.search-result-date{font-size:11px;color:#888;margin-top:2px;}
.search-result-memo{font-size:11px;color:#aaa;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:300px;}
.search-empty{text-align:center;padding:1.5rem;color:#aaa;font-size:13px;}

.view-wrap{background:#fff;border-radius:12px;padding:1.25rem;box-shadow:0 2px 12px rgba(0,0,0,.08);}
.cal-header{display:flex;align-items:center;gap:10px;margin-bottom:1rem;flex-wrap:wrap;}
.cal-title{font-size:22px;font-weight:700;flex:1;min-width:140px;letter-spacing:-.5px;}
.nav-group{display:flex;align-items:center;gap:4px;}
.nav-btn{background:none;border:1px solid #ddd;border-radius:8px;padding:5px 12px;cursor:pointer;font-size:15px;font-family:inherit;transition:all .12s;}
.nav-btn:hover{background:#f0f0f0;}
.nav-btn:active{transform:scale(.97);}
.today-btn{background:#f0f0f0;font-size:13px;}
.input-group{display:flex;align-items:center;gap:4px;}
.cal-input{border:1px solid #ddd;border-radius:8px;padding:5px 8px;font-size:14px;width:70px;text-align:center;outline:none;font-family:inherit;}
.cal-input.month-input{width:50px;}
.cal-input:focus{border-color:#4a7fd4;}
.input-sep{font-size:13px;color:#888;}

.grid-head{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;margin-bottom:4px;border-bottom:1px solid #eee;padding-bottom:6px;}
.grid-head span{text-align:center;font-size:13px;font-weight:600;padding:4px 0;color:#888;}
.grid-head span.sun{color:#d85a30;}
.grid-head span.sat{color:#4a7fd4;}

/* ══ 핵심: 그리드 = 7열, 행 높이는 자동 ══ */
.grid-body{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  /* gap 없음 — 셀이 딱 붙어야 연속바가 이어짐 */
  gap:0;
  overflow:hidden;
}
.loading-msg{grid-column:1/-1;text-align:center;padding:2rem;color:#888;}

/* ══ 날짜 셀 ══ */
.day-cell{
  min-height:90px;
  padding:5px 4px 4px;
  border:1px solid #e8e8e8;
  cursor:pointer;
  display:flex;
  flex-direction:column;
  gap:0;
  transition:background .1s;
  box-sizing:border-box;
  overflow:hidden;
  /* 셀 간 이중 테두리 방지 */
  margin-right:-1px;
  margin-bottom:-1px;
}
.day-cell.in-month:hover{background:#f5f5f0;}
.day-cell.out-month .solar-num{color:#ccc;}
.day-cell.out-month .lunar-txt{color:#ccc;}
.day-cell.out-month .holiday-name,.day-cell.out-month .subst-badge{opacity:.3;}
.solar-num{font-size:15px;font-weight:400;line-height:1.3;color:#1a1a1a;display:block;}
.day-cell.col-sun .solar-num,.day-cell.is-holiday .solar-num{color:#d85a30;}
.day-cell.col-sat:not(.is-holiday) .solar-num{color:#4a7fd4;}
.lunar-txt{font-size:10px;color:#999;line-height:1.3;display:block;margin-bottom:2px;}
.lunar-txt.lunar-new{color:#3b7a3b;font-weight:600;}
.day-cell.today{background:#ebf2ff;}
.day-cell.today .solar-num{color:#1a56c4;font-weight:700;}
.day-cell.highlight{background:#fff9e6;}
.holiday-name{font-size:9px;color:#d85a30;line-height:1.3;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:block;margin-bottom:2px;}
.subst-badge{display:inline-block;font-size:8px;background:#fdecea;color:#d85a30;border-radius:4px;padding:1px 4px;font-weight:500;margin-bottom:2px;}

/* ══ 연속 일정 바 ══
   시작셀: border-radius 왼쪽, 오른쪽 margin 없음
   중간셀: radius 없음, 양쪽 margin 없음
   끝셀  : border-radius 오른쪽, 왼쪽 margin 없음
   핵심: overflow:visible 로 셀 경계 넘어가게
*/
.range-item{
  display:block;
  height:17px;
  line-height:17px;
  font-size:9px;
  color:#fff;
  cursor:pointer;
  flex-shrink:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  padding:0 5px;
  box-sizing:border-box;
  margin-top:2px;
  /* 셀 경계를 넘겨서 이어지게 */
  margin-left:-4px;
  margin-right:-5px;
}
/* 시작 */
.range-item.r-start{
  border-radius:8px 0 0 8px;
  margin-left:2px;
  padding-left:6px;
}
/* 끝 */
.range-item.r-end{
  border-radius:0 8px 8px 0;
  margin-right:2px;
}
/* 하나짜리 */
.range-item.r-only{
  border-radius:8px;
  margin-left:2px;
  margin-right:2px;
}
/* 주 첫날(일요일)에서 시작처럼 */
.range-item.r-wstart{
  border-radius:8px 0 0 8px;
  margin-left:2px;
  padding-left:6px;
}
/* 주 마지막(토요일)에서 끝처럼 */
.range-item.r-wend{
  border-radius:0 8px 8px 0;
  margin-right:2px;
}
/* 중간: 색상만, 텍스트 투명 */
.range-item.r-mid,.range-item.r-end,.range-item.r-wend{
  /* 텍스트는 JS에서 처리 */
}

/* 단일 일정 칩 */
.sched-chip{
  font-size:9px;
  border-radius:4px;
  padding:2px 5px;
  color:#fff;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  cursor:pointer;
  margin-top:2px;
  line-height:1.5;
  flex-shrink:0;
}
.sched-chip.is-lunar-chip::before{content:'음 ';font-size:8px;opacity:.85;}

/* 주간뷰 */
.week-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;margin-top:.5rem;}
.week-day-col{border:1px solid #eee;border-radius:10px;padding:8px 6px;min-height:160px;cursor:pointer;transition:background .1s;}
.week-day-col:hover{background:#f9f9f6;}
.week-day-col.today-col{background:#ebf2ff;border-color:#a3c0f0;}
.week-day-header{text-align:center;margin-bottom:6px;}
.week-day-name{font-size:11px;color:#888;display:block;}
.week-day-num{font-size:18px;font-weight:600;color:#1a1a1a;line-height:1.2;}
.week-day-col.col-sun .week-day-num,.week-day-col.is-holiday .week-day-num{color:#d85a30;}
.week-day-col.col-sat:not(.is-holiday) .week-day-num{color:#4a7fd4;}
.week-day-col.today-col .week-day-num{color:#1a56c4;}
.week-lunar{font-size:9px;color:#aaa;text-align:center;margin-bottom:4px;}
.week-holiday{font-size:9px;color:#d85a30;text-align:center;margin-bottom:4px;}
.week-sched-chip{font-size:10px;border-radius:5px;padding:3px 6px;color:#fff;margin-bottom:3px;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.week-sched-chip.is-lunar-chip::before{content:'음 ';font-size:9px;opacity:.85;}

.legend{display:flex;gap:16px;flex-wrap:wrap;margin-top:10px;padding-top:8px;}
.legend-item{display:flex;align-items:center;gap:5px;font-size:11px;color:#777;}
.legend-dot{width:9px;height:9px;border-radius:50%;}
.legend-dot.red{background:#d85a30;}
.legend-dot.blue{background:#4a7fd4;}
.legend-dot.green{background:#3b7a3b;}
.legend-dot.navy{background:#1a56c4;}
.source-note{font-size:10px;color:#bbb;margin-top:5px;text-align:right;}

.today-schedules{background:#fff;border-radius:12px;padding:1rem 1.25rem;box-shadow:0 2px 12px rgba(0,0,0,.08);margin-top:12px;}
.today-header{display:flex;align-items:center;margin-bottom:10px;padding-bottom:8px;border-bottom:1px solid #eee;}
.today-header-title{font-size:14px;font-weight:600;color:#1a1a1a;}
.today-list{display:flex;flex-direction:column;gap:6px;}
.today-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;border:1px solid #eee;cursor:pointer;transition:background .1s;}
.today-item:hover{background:#f5f5f0;}
.today-item-color{width:10px;height:10px;border-radius:50%;flex-shrink:0;}
.today-item-info{flex:1;}
.today-item-title{font-size:13px;font-weight:500;color:#1a1a1a;}
.today-item-title.is-lunar::before{content:'음 ';font-size:11px;color:#3b7a3b;}
.today-item-time{font-size:11px;color:#888;margin-top:2px;}
.today-item-memo{font-size:11px;color:#aaa;margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:500px;}
.today-empty{text-align:center;padding:1rem;color:#aaa;font-size:13px;}

.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.35);display:flex;align-items:center;justify-content:center;z-index:9999;}
.modal{background:#fff;border-radius:16px;width:460px;max-width:95vw;max-height:90vh;overflow-y:auto;box-shadow:0 8px 40px rgba(0,0,0,.18);}
.modal-header{display:flex;align-items:flex-start;justify-content:space-between;padding:14px 20px 10px;border-bottom:1px solid #eee;position:sticky;top:0;background:#fff;z-index:1;}
.modal-title-main{font-size:15px;font-weight:700;color:#1a1a1a;}
.modal-title-lunar{font-size:12px;color:#3b7a3b;font-weight:500;margin-top:2px;}
.modal-close{background:none;border:none;font-size:18px;cursor:pointer;color:#999;padding:2px 6px;border-radius:6px;}
.modal-close:hover{background:#f0f0f0;}
.modal-body{padding:16px 20px;display:flex;flex-direction:column;gap:12px;}
.form-row{display:flex;flex-direction:column;gap:4px;}
.form-row label{font-size:12px;color:#888;font-weight:500;}
.form-row input[type="text"],.form-row input[type="date"],.form-row input[type="time"],.form-row textarea,.form-row select{border:1px solid #ddd;border-radius:8px;padding:8px 10px;font-size:14px;font-family:inherit;outline:none;resize:none;color:#1a1a1a;}
.form-row input:focus,.form-row textarea:focus,.form-row select:focus{border-color:#4a7fd4;}
.datetime-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;}
.datetime-grid .form-row{margin:0;}
.color-picker{display:flex;gap:8px;flex-wrap:wrap;}
.color-opt{width:28px;height:28px;border-radius:50%;cursor:pointer;border:2px solid transparent;transition:transform .1s;}
.color-opt:hover{transform:scale(1.15);}
.color-opt.selected{border-color:#1a1a1a;transform:scale(1.15);}
.lunar-row{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;background:#f8f8f4;border-radius:8px;border:1px solid #eee;}
.lunar-row-left{flex:1;}
.lunar-row-label{font-size:13px;color:#555;}
.lunar-row-info{font-size:11px;color:#3b7a3b;margin-top:2px;}
.lunar-toggle{position:relative;width:40px;height:22px;flex-shrink:0;}
.lunar-toggle input{opacity:0;width:0;height:0;}
.lunar-slider{position:absolute;cursor:pointer;inset:0;background:#ccc;border-radius:22px;transition:.3s;}
.lunar-slider:before{content:'';position:absolute;width:16px;height:16px;left:3px;bottom:3px;background:#fff;border-radius:50%;transition:.3s;}
.lunar-toggle input:checked+.lunar-slider{background:#3b7a3b;}
.lunar-toggle input:checked+.lunar-slider:before{transform:translateX(18px);}
.modal-footer{display:flex;align-items:center;gap:8px;padding:12px 20px 16px;border-top:1px solid #eee;justify-content:flex-end;position:sticky;bottom:0;background:#fff;}
.btn-save{background:#4a7fd4;color:#fff;border:none;border-radius:8px;padding:8px 20px;font-size:14px;cursor:pointer;font-family:inherit;}
.btn-save:hover{background:#3868be;}
.btn-cancel{background:#f0f0f0;color:#444;border:none;border-radius:8px;padding:8px 16px;font-size:14px;cursor:pointer;font-family:inherit;}
.btn-cancel:hover{background:#e0e0e0;}
.btn-delete{background:#fdecea;color:#c62828;border:none;border-radius:8px;padding:8px 16px;font-size:14px;cursor:pointer;font-family:inherit;margin-right:auto;}
.btn-delete:hover{background:#f7c1c1;}

.grid-body.swipe-left-out{animation:swipeLeftOut .25s ease forwards;}
.grid-body.swipe-right-out{animation:swipeRightOut .25s ease forwards;}
.grid-body.swipe-left-in{animation:swipeLeftIn .25s ease forwards;}
.grid-body.swipe-right-in{animation:swipeRightIn .25s ease forwards;}
@keyframes swipeLeftOut{from{transform:translateX(0);opacity:1;}to{transform:translateX(-100%);opacity:0;}}
@keyframes swipeRightOut{from{transform:translateX(0);opacity:1;}to{transform:translateX(100%);opacity:0;}}
@keyframes swipeLeftIn{from{transform:translateX(100%);opacity:0;}to{transform:translateX(0);opacity:1;}}
@keyframes swipeRightIn{from{transform:translateX(-100%);opacity:0;}to{transform:translateX(0);opacity:1;}}

@media(max-width:600px){
  #scheduler-wrap{margin:10px auto;}
  .view-wrap{padding:.75rem;border-radius:10px;}
  .cal-title{font-size:18px;}
  .solar-num{font-size:13px;}
  .lunar-txt{font-size:9px;}
  .day-cell{min-height:60px;padding:3px 3px 2px;}
  .input-group{display:none;}
  .search-input{width:120px;}
  .sched-chip{font-size:8px;}
  .range-item{font-size:8px;height:14px;line-height:14px;}
  .week-day-col{min-height:100px;}
}
