/* ===== date-calendar-1.css — カレンダー（イベント・祝日対応） ===== */

/* デモコンテナをフル幅にする */
.demo-container {
  display: block;
  max-width: 100%;
  padding: 20px;
}

/* ===== カレンダーヘッダー ===== */
.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}
.cal-nav-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-primary);
  line-height: 1;
  transition: background 0.15s;
}
.cal-nav-btn:hover { background: var(--color-bg); }
.cal-title {
  font-size: 18px;
  font-weight: 700;
  min-width: 120px;
  text-align: center;
}
.cal-today-btn {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
  background: #fff;
  color: var(--color-text-primary);
  transition: background 0.15s;
}
.cal-today-btn:hover { background: var(--color-bg); }

/* ===== グリッドビュー（768px以上） ===== */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-left: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
}
.cal-weekday {
  text-align: center;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 700;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.cal-weekday--sun { color: var(--color-danger, #D93025); }
.cal-weekday--sat { color: var(--color-accent); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-left: 1px solid var(--color-border);
}
.cal-cell {
  min-height: 100px;
  padding: 6px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
}
.cal-cell--other-month { background: #f8f8f8; }
.cal-cell--has-events { cursor: pointer; }
.cal-cell--has-events:hover { background: #f4f8ff; }

/* 日付数字 */
.cal-date-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 50%;
  margin-bottom: 2px;
}
.cal-cell--other-month .cal-date-num { color: #ccc; }
.cal-cell--sun .cal-date-num,
.cal-cell--holiday .cal-date-num { color: var(--color-danger, #D93025); }
.cal-cell--sat .cal-date-num { color: var(--color-accent); }
.cal-cell--today .cal-date-num {
  background: var(--color-accent);
  color: #fff;
}

/* 祝日名ラベル */
.cal-holiday-name {
  display: block;
  font-size: 10px;
  color: var(--color-danger, #D93025);
  line-height: 1.3;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* イベントバッジ */
.cal-event {
  font-size: 11px;
  padding: 2px 5px;
  margin-bottom: 2px;
  border-radius: 3px;
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event-more {
  font-size: 11px;
  color: var(--color-text-muted);
  padding-left: 4px;
}

/* ===== リストビュー（767px以下） ===== */
.cal-list-view { display: none; }

.cal-list-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--color-border);
}
.cal-list-row--has-events { cursor: pointer; }
.cal-list-row--has-events:hover { background: #f4f8ff; }

.cal-list-date {
  flex-shrink: 0;
  width: 44px;
  text-align: center;
}
.cal-list-date-num {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.cal-list-date-day {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.cal-list-row--today .cal-list-date-num { color: var(--color-accent); }
.cal-list-row--holiday .cal-list-date-num,
.cal-list-row--sun .cal-list-date-num { color: var(--color-danger, #D93025); }
.cal-list-row--holiday .cal-list-date-day,
.cal-list-row--sun .cal-list-date-day { color: var(--color-danger, #D93025); }
.cal-list-row--sat .cal-list-date-num { color: var(--color-accent); }
.cal-list-row--sat .cal-list-date-day { color: var(--color-accent); }

.cal-list-events { flex: 1; padding-top: 4px; }
.cal-list-event {
  font-size: 13px;
  padding: 3px 8px;
  margin-bottom: 3px;
  border-radius: 3px;
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-list-event-more {
  font-size: 12px;
  color: var(--color-text-muted);
  padding-left: 4px;
}
.cal-list-no-events {
  font-size: 13px;
  color: var(--color-text-muted);
  padding-top: 4px;
}

/* ===== ダイアログ ===== */
.cal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.cal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.cal-dialog {
  background: #fff;
  border-radius: 10px;
  width: 90%;
  max-width: 440px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.cal-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}
.cal-dialog-title { font-size: 17px; font-weight: 700; margin: 0; }
.cal-dialog-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text-muted);
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}
.cal-dialog-close:hover { color: var(--color-text-primary); }
.cal-dialog-events { list-style: none; padding: 0; margin: 0; }
.cal-dialog-event {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.cal-dialog-event:last-child { border-bottom: none; }
.cal-dialog-event-title { font-size: 15px; font-weight: 600; margin-bottom: 5px; }
.cal-dialog-event-meta { font-size: 13px; color: var(--color-text-secondary); line-height: 1.7; }

/* ===== レスポンシブ切り替え ===== */
@media (max-width: 767px) {
  .cal-grid-view { display: none; }
  .cal-list-view { display: block; }
}
