/* =====================================================
   ENCHANT スタッフ在籍カレンダー スタイル
   元画像のデザインに忠実に再現
   ===================================================== */


/* =====================================================
   サイズ調整（必要に応じて数値を変更してください）
   - 公開ページ / 管理ページのカレンダー両方に反映
   ===================================================== */
:root{
  --cal-max-width: 560px;
  --cal-pad-y: 18px;
  --cal-pad-x: 14px;

  --cal-month-font: 24px;
  --cal-year-font: 18px;
  --cal-weekday-font: 14px;

  --cal-cell-minh: 82px;
  --cal-cell-pad-y: 8px;
  --cal-cell-pad-x: 4px;

  --cal-date-font: 18px;
  --cal-date-size: 34px;
  --cal-date-mb: 6px;

  --cal-staff-font: 12px;
  --cal-staff-line: 1.55;

  --cal-legend-font: 12px;
  --cal-ctl-size: 38px;
  --cal-ctl-font: 16px;
}

/* カレンダーコンテナ */
.calendar-container {
  width: 100%;
  max-width: var(--cal-max-width, 700px);
  margin: 0 auto;
  padding: var(--cal-pad-y, 30px) var(--cal-pad-x, 20px);
  background: #fff;
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
}

/* ヘッダー部分 (月名 --- 年月) */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 25px;
  gap: 20px;
}

.calendar-month-name {
  font-size: var(--cal-month-font, 32px);
  font-weight: 300;
  letter-spacing: 4px;
  color: #333;
}

.calendar-header-line {
  flex: 0 0 80px;
  height: 1px;
  background: #999;
}

.calendar-year-month {
  font-size: var(--cal-year-font, 22px);
  font-weight: 300;
  color: #666;
  letter-spacing: 1px;
}

/* 曜日ヘッダー */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid #ccc;
  padding-bottom: 12px;
  margin-bottom: 0;
}

.calendar-weekday {
  text-align: center;
  font-size: var(--cal-weekday-font, 18px);
  font-weight: 400;
  color: #333;
  padding: 8px 0;
}

/* 日曜日のみ赤色 */
.calendar-weekday.sunday {
  color: #c41e3a;
}

/* カレンダーグリッド */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

/* 日付セル */
.calendar-cell {
  min-height: var(--cal-cell-minh, 110px);
  padding: var(--cal-cell-pad-y, 12px) var(--cal-cell-pad-x, 5px);
  text-align: center;
  border-bottom: 1px solid #eee;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.calendar-cell.empty {
  background: transparent;
  border-bottom: 1px solid #eee;
}

/* 日付番号 */
.calendar-date {
  font-size: var(--cal-date-font, 26px);
  font-weight: 400;
  color: #333;
  width: var(--cal-date-size, 48px);
  height: var(--cal-date-size, 48px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--cal-date-mb, 10px);
  border-radius: 50%;
  background: transparent;
}

/* 日曜日の数字は赤色 */
.calendar-cell.sunday .calendar-date {
  color: #c41e3a;
}

/* 定休日（赤丸背景 + 白文字） */
.calendar-cell.holiday .calendar-date {
  background-color: #c41e3a;
  color: #fff !important;
}

/* スタッフ名表示 */
.calendar-staff {
  font-size: var(--cal-staff-font, 16px);
  color: #333;
  line-height: var(--cal-staff-line, 1.8);
  text-align: center;
}

.calendar-staff-name {
  display: block;
}

/* 凡例 */
.calendar-legend {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 25px;
  padding-top: 15px;
}

.calendar-legend-item {
  display: flex;
  align-items: center;
  font-size: var(--cal-legend-font, 15px);
  color: #333;
}

.calendar-legend-dot {
  width: 16px;
  height: 16px;
  background-color: #c41e3a;
  border-radius: 50%;
  margin-right: 10px;
}

/* 編集ボタン */
.calendar-edit-btn {
  display: block;
  margin: 25px auto 0;
  padding: 14px 35px;
  background: #c41e3a;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: var(--cal-staff-font, 16px);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s ease;
}

.calendar-edit-btn:hover {
  background: #a01830;
}

/* スライドコントロール */
.slide-schedule {
  position: relative;
  margin: 0 60px;
}

.js-slide-schedule {
  position: relative;
}

.slide-schedule .control {
  position: absolute;
  top: 50%;
  left: -33px;
  right: -33px;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
}

.slide-schedule .control span {
  pointer-events: auto;
  cursor: pointer;
  width: var(--cal-ctl-size, 50px);
  height: var(--cal-ctl-size, 50px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--cal-ctl-font, 20px);
  color: #c41e3a;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.slide-schedule .control span:hover {
  background: #c41e3a;
  color: #fff;
}

.slide-schedule .control .previous::before {
  content: "<";
  font-weight: bold;
  font-size: var(--cal-ctl-font, 20px);
}

.slide-schedule .control .next::before {
  content: ">";
  font-weight: bold;
  font-size: var(--cal-ctl-font, 20px);
}

/* =====================================================
   モーダルダイアログ
   ===================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  border-radius: 10px;
  padding: 30px;
  max-width: 550px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
  margin: 0 0 25px 0;
  font-size: var(--cal-year-font, 22px);
  color: #333;
  text-align: center;
  border-bottom: 2px solid #c41e3a;
  padding-bottom: 15px;
}

/* フォームセクション */
.form-section {
  margin-bottom: 20px;
}

.form-section > label {
  display: block;
  font-size: var(--cal-staff-font, 16px);
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.form-section input[type="password"],
.form-section input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  font-size: var(--cal-staff-font, 16px);
  border: 2px solid #ddd;
  border-radius: 5px;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
}

.form-section input[type="password"]:focus,
.form-section input[type="text"]:focus {
  outline: none;
  border-color: #c41e3a;
}

/* 日付セレクター */
.date-selector {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 12px;
  background: #f9f9f9;
  border-radius: 5px;
}

.date-selector label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0px 5px;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
  font-size: var(--cal-legend-font, 15px);
  font-weight: 500;
  transition: all 0.2s ease;
  min-height: 30px;
}

.date-selector label:hover {
  border-color: #c41e3a;
}

.date-selector input[type="radio"] {
  display: none;
}

.date-selector label.selected {
  background: #c41e3a;
  color: #fff;
  border-color: #c41e3a;
}

/* スタッフセレクター */
.staff-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 5px;
}

.staff-selector label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: var(--cal-staff-font, 16px);
  padding: 4px 18px;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 5px;
  transition: all 0.2s ease;
}

.staff-selector label:hover {
  border-color: #c41e3a;
}

.staff-selector input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  accent-color: #c41e3a;
}

/* 定休日チェックボックス */
.holiday-checkbox-wrapper {
  display: flex;
  align-items: center;
  padding: 4px 18px;
  background: #fff3f3;
  border: 2px solid #c41e3a;
  border-radius: 5px;
  cursor: pointer;
}

.holiday-checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 12px;
  accent-color: #c41e3a;
  vertical-align: middle;
}

/* モーダルボタン */
.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 25px;
}

.modal-buttons button {
  padding: 14px 40px;
  font-size: var(--cal-staff-font, 16px);
  font-weight: 500;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-buttons button#auth-submit,
.modal-buttons button#edit-save {
  background: #c41e3a;
  color: #fff;
}

.modal-buttons button#auth-submit:hover,
.modal-buttons button#edit-save:hover {
  background: #a01830;
}

.modal-buttons button#auth-cancel,
.modal-buttons button#edit-cancel {
  background: #666;
  color: #fff;
}

.modal-buttons button#auth-cancel:hover,
.modal-buttons button#edit-cancel:hover {
  background: #444;
}

/* =====================================================
   レスポンシブ対応
   ===================================================== */

@media (max-width: 768px) {
  .calendar-container {
    padding: 20px 15px;
  }

  .slide-schedule {
    margin: 0 50px;
  }

  .slide-schedule .control {
    left: -10px;
    right: -10px;
  }

  .calendar-month-name {
    font-size: 24px;
    letter-spacing: 2px;
  }

  .calendar-header-line {
    flex: 0 0 50px;
  }

  .calendar-year-month {
    font-size: var(--cal-weekday-font, 18px);
  }

  .calendar-weekday {
    font-size: 14px;
  }

  .calendar-date {
    font-size: var(--cal-ctl-font, 20px);
    width: 40px;
    height: 40px;
  }

  .calendar-cell {
    min-height: 90px;
    padding: 10px 3px;
  }

  .calendar-staff {
    font-size: 13px;
  }

  .slide-schedule .control span {
    width: 42px;
    height: 42px;
    font-size: var(--cal-staff-font, 16px);
  }
}

@media (max-width: 480px) {
  .calendar-container {
    padding: 15px 10px;
  }

  .slide-schedule {
    margin: 0 40px;
  }

  .slide-schedule .control {
    left: -3px;
    right: -3px;
  }

  .calendar-header {
    flex-direction: column;
    gap: 10px;
  }

  .calendar-header-line {
    display: none;
  }

  .calendar-month-name {
    font-size: var(--cal-ctl-font, 20px);
    letter-spacing: 1px;
  }

  .calendar-year-month {
    font-size: var(--cal-staff-font, 16px);
  }

  .calendar-weekday {
    font-size: 12px;
  }

  .calendar-date {
    font-size: var(--cal-staff-font, 16px);
    width: 32px;
    height: 32px;
  }

  .calendar-cell {
    min-height: 70px;
    padding: 8px 2px;
  }

  .calendar-staff {
    font-size: 10px;
    line-height: 1.5;
  }

  .modal-content {
    padding: 20px 15px;
  }

  .date-selector {
    grid-template-columns: repeat(5, 1fr);
  }

  .slide-schedule .control span {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
}


/* =====================================================
   スタッフ管理スタイル
   ===================================================== */

.staff-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 5px;
  margin-bottom: var(--cal-date-mb, 10px);
  gap: 10px;
}

.staff-name-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: var(--cal-legend-font, 15px);
}

.staff-name-input:focus {
  outline: none;
  border-color: #c41e3a;
}

.staff-delete-btn {
  padding: 8px 16px;
  background: #c41e3a;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.3s ease;
}

.staff-delete-btn:hover {
  background: #a01830;
}

#add-staff-btn {
  padding: 10px 20px;
  background: #c41e3a;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: var(--cal-legend-font, 15px);
  transition: background 0.3s ease;
}

#add-staff-btn:hover {
  background: #a01830;
}
