/**
 * スタッフスケジュール表示用CSS
 */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

.staff-schedule-container {
  max-width: 95vw;
  width: 100%;
  margin: 0 auto;
  font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
  background-color: #fff;
  /*border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);*/
  height: calc(var(--vvh, 1vh) * 100 - 52px);
  position: relative;
  padding: 0 !important;
}

.wrapper {
  height: calc(var(--vvh, 1vh) * 100 - 100px); /* 日付選択UIの高さを動的に計算 */
  width: 100%;
  padding: 0px;
}

/* iOS Safari用 */
@supports (-webkit-touch-callout: none) {
  .staff-schedule-container {
    max-width: 95vw;
    width: 100%;
    margin: 0 auto;
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    background-color: #fff;
    /*border-radius: 8px;*/
    /*box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);*/
    height: calc(var(--vvh, 1vh) * 100 - 110px); /* モバイル用に調整 */
    position: relative;
    padding: 0 !important;
  }
  .wrapper {
    height: calc(var(--vvh, 1vh) * 100 - 110px); /* モバイル用に調整 */
    width: 100%;
    padding: 0px;
  }
}

.scheduler {
  display: flex;
  height: 100%;
  border: 1px solid #ccc;
  overflow: hidden;
}

/* タイム列全体（ヘッダー＋スロット） */
.time-container {
  width: 60px;
  display: flex;
  flex-direction: column;
}

.time-header {
  height: 30px;
  background: #f4f4f4;
  border-bottom: 1px solid #ddd;
}

.time-column {
  flex: 1;
  border-right: 1px solid #ddd;
  position: relative;
}

.time-slot {
  height: calc(100% / var(--total-slots));
  position: relative;
}

.time-label {
  position: absolute;
  top: 1px;
  left: 4px;
  font-size: 11px;
  color: #666;
  background: white;
  padding: 0 2px;
  z-index: 2;
}

.hour-line {
  border-top: 1px dotted #ccc;
}

.columns {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.columns-header {
  height: 30px;
  display: flex;
  background: #f4f4f4;
  border-bottom: 1px solid #ddd;
}

.therapist-header {
  flex: 1;
  text-align: center;
  line-height: 30px;
  font-weight: bold;
  border-right: 1px solid #ddd;
}

.columns-body {
  flex: 1;
  display: flex;
  position: relative;
}

.therapist-column {
  flex: 1;
  border-right: 1px solid #ddd;
  position: relative;
}

.staff-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px dotted #ccc;
  z-index: 0;
}

.reservation {
  position: absolute;
  left: 2px;
  width: calc(100% - 4px); /* 列幅ほぼいっぱいに設定 */
  height: calc((100% / 156) * 3); /* 15分 */
  background-color: rgb(0, 150, 250);
  color: #000000; /* 文字色は黒に統一 */
  border-radius: 3px;
  padding: 5px;
  cursor: move;
  z-index: 2 !important;
}

/* 予約札のテキストオーバーフロー対策 */
.reservation {
  padding: 2px 4px !important;
  font-size: 10px !important;
  line-height: 1.2 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}

/* 日付選択UIのスタイル */
.date-control-panel {
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px 8px 0 0;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
}

.date-navigation {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.nav-btn {
  background: #007cba;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.nav-btn:hover {
  background: #005a87;
}

.nav-btn:active {
  background: #004067;
}

.date-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.date-input {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  min-width: 200px; /* 横幅を広げて曜日表示に対応 */
  max-width: 100%;
  width: 100%;
  -webkit-appearance: none; /* iOS Safari用 */
  appearance: none;
  background-color: #fff;
  text-align: center;
  position: relative;
}

/* 日付入力フィールドに曜日表示用の疑似要素 */
.date-input::after {
  content: attr(data-weekday);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #999;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  margin-top: 2px;
}

.current-date {
  font-size: 12px; /* 曜日表示のため少し大きく */
  color: #666;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

.today-button {
  background: #28a745;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.today-button:hover {
  background: #218838;
}

.today-button:active {
  background: #1e7e34;
}

/* タブレット縦向き対応 */
@media (min-width: 481px) and (max-width: 768px) {
  .staff-schedule-container {
    max-width: 95vw;
    height: calc(var(--vvh, 1vh) * 100 - 100px);
  }
  
  .date-control-panel {
    padding: 8px 12px;
    gap: 6px;
  }
  
  .wrapper {
    padding: 0px;
  }
}

/* タブレット横向き対応 */
@media (min-width: 769px) and (max-width: 1024px) {
  .staff-schedule-container {
    max-width: 98vw;
    height: calc(var(--vvh, 1vh) * 100 - 100px);
  }
  
  .wrapper {
    padding: 0px;
  }
  
  .time-container {
    width: 70px; /* タブレット横では時間列を少し広く */
  }
}

/* デスクトップ対応 */
@media (min-width: 1025px) and (max-width: 1400px) {
  .staff-schedule-container {
    max-width: 95vw;
    height: calc(var(--vvh, 1vh) * 100 - 100px);
  }
  
  .wrapper {
    padding: 0px;
  }
  
  .time-container {
    width: 80px; /* デスクトップでは時間列をさらに広く */
  }
}

/* 大画面デスクトップ対応 */
@media (min-width: 1401px) {
  .staff-schedule-container {
    max-width: 1200px; /* 読みやすさのために最大幅を制限 */
    height: calc(var(--vvh, 1vh) * 100 - 110px);
  }
  
  .wrapper {
    padding: 0px;
  }
  
  .time-container {
    width: 90px;
  }
}

/* モバイル対応 */
@media (max-width: 480px) {
  .staff-schedule-container {
    max-width: 100vw;
    margin: 0;
    border-radius: 0;
    height: calc(var(--vvh, 1vh) * 100 - 110px); /* モバイル用に調整 */
  }
  
  .date-control-panel {
    padding: 6px 8px;
    gap: 4px;
    flex-wrap: nowrap;
    min-height: 36px; /* 高さを固定して安定化 */
    border-radius: 0;
  }
  
  .date-navigation {
    gap: 4px;
    flex: 0 1 auto;
  }
  
  .nav-btn {
    padding: 4px 8px;
    font-size: 11px;
    min-width: 30px;
    height: 28px;
    line-height: 1;
  }
  
  .date-display {
    gap: 0;
    flex: 1 1 auto;
    min-width: 0;
  }
  
  .date-input {
    min-width: 160px; /* 曜日表示のため幅を拡張 */
    max-width: 180px;
    font-size: 11px;
    padding: 3px 5px;
    height: 28px;
    text-align: center;
  }
  
  .current-date {
    display: block; /* 曜日表示を有効化 */
    font-size: 10px;
    margin-top: 1px;
  }
  
  .today-button {
    padding: 4px 10px;
    font-size: 11px;
    min-width: auto;
    height: 28px;
    line-height: 1;
    flex: 0 0 auto;
  }
  
  .wrapper {
    padding: 0px;
  }
}

/* より小さい画面用の追加調整 */
@media (max-width: 360px) {
  .date-control-panel {
    padding: 4px 6px;
    gap: 2px;
  }
  
  .date-input {
    min-width: 140px; /* 曜日表示のため最小幅を拡張 */
    max-width: 160px;
    font-size: 10px;
    padding: 2px 4px;
    height: 26px;
  }
  
  .nav-btn {
    padding: 3px 5px;
    font-size: 10px;
    min-width: 26px;
    height: 26px;
  }
  
  .today-button {
    padding: 3px 6px;
    font-size: 10px;
    height: 26px;
  }
  
  .wrapper {
    padding: 0px;
  }
}

/* 非出勤時間のスタイル */
.non-working-time {
  background-color: #666666 !important;
  opacity: 0.7 !important;
  z-index: 1 !important;
  position: absolute !important;
  pointer-events: none; /* クリックを無効化 */
}

/* 自動リフレッシュ通知のスタイル */
.refresh-notification {
  position: fixed;
  top: 10px;
  right: 10px;
  background: #28a745;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  z-index: 1000;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  animation: slideInFromRight 0.3s ease-out, fadeOut 0.5s ease-in 2.5s forwards;
}

/* アニメーション定義 */
@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* モバイル用の通知調整 */
@media (max-width: 480px) {
  .refresh-notification {
    top: 5px;
    right: 5px;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 3px;
  }
}

/* 予約詳細モーダルのスタイル */
.booking-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
  box-sizing: border-box;
}

.booking-modal-overlay.show {
  opacity: 1;
}

.booking-modal-overlay.hide {
  opacity: 0;
}

.booking-modal {
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.booking-modal-overlay.show .booking-modal {
  transform: scale(1);
}

.booking-modal-overlay.hide .booking-modal {
  transform: scale(0.9);
}

.booking-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  background: #f8f9fa;
  border-radius: 8px 8px 0 0;
}

.booking-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

.booking-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s, color 0.2s;
}

.booking-modal-close:hover {
  background: #e0e0e0;
  color: #333;
}

.booking-modal-body {
  padding: 20px;
}

.booking-info-section {
  margin-bottom: 20px;
}

.booking-info-section:last-child {
  margin-bottom: 0;
}

.booking-info-section h4 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: bold;
  color: #333;
  border-bottom: 2px solid #007cba;
  padding-bottom: 4px;
}

.booking-info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.booking-info-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.booking-info-label {
  font-weight: bold;
  color: #555;
  min-width: 100px;
  flex-shrink: 0;
}

.booking-info-value {
  color: #333;
  text-align: right;
  word-break: break-word;
}

.booking-type-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  color: white;
  text-align: center;
}

.booking-type-badge.work-time {
  background: #6c757d;
}

.booking-type-badge.personal-designation {
  background: #007bff;
}

.booking-type-badge.gender-designation {
  background: #28a745;
}

.booking-type-badge.free {
  background: #ffc107;
  color: #333;
}

.booking-type-badge.other {
  background: #dc3545;
}

.booking-info-memo {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
}

/* モバイル対応 */
@media (max-width: 480px) {
  .booking-modal-overlay {
    padding: 10px;
  }
  
  .booking-modal {
    max-height: 90vh;
  }
  
  .booking-modal-header {
    padding: 12px 15px;
  }
  
  .booking-modal-header h3 {
    font-size: 16px;
  }
  
  .booking-modal-body {
    padding: 15px;
  }
  
  .booking-info-section h4 {
    font-size: 14px;
  }
  
  .booking-info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .booking-info-label {
    min-width: auto;
    font-size: 14px;
  }
  
  .booking-info-value {
    text-align: left;
    font-size: 14px;
  }
  
  .booking-type-badge {
    font-size: 11px;
    padding: 3px 6px;
  }
}

/* より小さい画面でのさらなる調整 */
@media (max-width: 360px) {
  .booking-modal-overlay {
    padding: 5px;
  }
  
  .booking-modal-header {
    padding: 10px 12px;
  }
  
  .booking-modal-body {
    padding: 12px;
  }
  
  .booking-info-section {
    margin-bottom: 15px;
  }
}