/* 既存のスタイル */

.center{
	text-align:center;
}

#dsr-roster-wrapper {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.dsr-controls {
    margin-bottom: 20px;
    text-align: center;
}

.dsr-controls p {
    font-weight: bold;
    margin-bottom: 10px;
}

#dsr-calendar-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dsr-date-btn {
    padding: 10px 15px;
    border: 2px solid #007cba;
    background-color: #fff;
    color: #007cba;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.dsr-date-btn:hover {
    background-color: #007cba;
    color: #fff;
}

.dsr-date-btn.active {
    background-color: #007cba;
    color: #fff;
	font-size:1.6em;
    font-weight: bold;
}

#dsr-roster-display {
    margin-top: 20px;
}

.dsr-loading {
    text-align: center;
    padding: 20px;
    font-style: italic;
    color: #666;
}

.dsr-error {
    color: #d63638;
    font-weight: bold;
    text-align: center;
    padding: 20px;
    background-color: #fcf2f3;
    border: 1px solid #d63638;
    border-radius: 5px;
}

.dsr-bento-info {
    background-color: #fff;
    padding: 15px;
    margin: 20px 0;
    border-radius: 5px;
    border: 1px solid #0003;
	text-align:center;
}

.dsr-bento-info h4 {
    margin: 0 0 10px 0;
    color: #007cba;
	background-color: #f9f9f9;
}

.dsr-bento-info p {
    margin: 5px 0;
    font-size: 20px;
}

.dsr-room-status-wrapper {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.dsr-dorm-block {
    flex: 1;
    min-width: 300px;
    border: 1px solid #0003;
    border-radius: 8px;
    padding: 15px;
    background-color: #fff;
}

.dsr-dorm-block h4 {
    margin: 0 0 15px 0;
    padding: 10px;
    background-color: #f0f0f0;
    text-align: center;
    border-radius: 5px;
    font-size: 16px;
}

.dsr-west-dorm h4 {
    background-color: #FFF2F2;
    color: #d63638;
}

.dsr-east-dorm h4 {
    background-color: #e6f3ff;
    color: #007cba;
}

.dsr-room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.dsr-room-box {
    width: 60px;
    height: 50px;
    border: 1px solid #0003;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* 日別表示の部屋ボックスの在籍時色 */
.dsr-room-box.occupied {
    /* 共通の背景色はここで削除し、個別の寮で指定 */
    color: #fff; /* テキスト色は共通で白のまま */
    border-color: transparent; /* ボーダー色も個別に指定するか、透明にする */
}

/* 西館（女性）の日別表示の在籍時色 */
.dsr-west-dorm .dsr-room-box.occupied {
    background-color: #F47C7C; /* 元々指定されていた女性寮の色 */
    border-color: #F47C7C;
}

/* 東館（男性）の日別表示の在籍時色 */
.dsr-east-dorm .dsr-room-box.occupied {
    background-color: #87CEEB; /* 新しい男性寮の色 (スカイブルー) */
    border-color: #87CEEB;
}

.dsr-room-box.occupied:hover {
    /* ホバー時の色は、少し濃くするか、別の色にする */
    /* 個別に指定する場合、.dsr-west-dorm .dsr-room-box.occupied:hover のように指定 */
    background-color: #ff1493; /* デフォルトのホバー色 */
    transform: scale(1.05);
}
/* 西館ホバー */
.dsr-west-dorm .dsr-room-box.occupied:hover {
    background-color: #E62727; /* 元の色より少し濃く */
}
/* 東館ホバー */
.dsr-east-dorm .dsr-room-box.occupied:hover {
    background-color: #3396D3; /* 元の色より少し濃く */
}

.dsr-room-box.vacant {
    background-color: #fff;
    color: #333;
}

.dsr-room-box.vacant:hover {
    background-color: #f0f0f0;
    transform: scale(1.05);
}

/* カレンダー用の新しいスタイル */
#dsr-calendar-wrapper {
    margin: 40px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.dsr-calendar-controls {
    text-align: center;
    margin-bottom: 20px;
}

.dsr-calendar-controls button {
    padding: 10px 20px;
    margin: 0 5px;
    border: 1px solid #0003;
    background-color: #fff;
    cursor: pointer;
	font-size:1.2em;
    font-weight: bold;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.dsr-calendar-controls button:hover {
    background-color: #d0d0d0;
}

.dsr-calendar-controls button.active {
    background-color: #4CAF50;
    color: white;
}

#dsr-current-month {
    font-size: 24px;
    font-weight: bold;
    margin: 0 15px;
}

.dsr-legend {
    margin: 20px 0;
    text-align: center;
}

.dsr-legend-item {
    display: inline-block;
    margin: 0 15px;
    padding: 5px 10px;
    border: 1px solid #0003;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
	}

.dsr-legend-occupied {
    background-color: #F9F3DF;
    color: #333;
}

.dsr-legend-vacant {
    background-color: white;
    color: #333;
}

.dsr-legend-today {
    background-color: #FDFBEE;
}

.dsr-calendar-container {
    background: white;
    border: 1px solid #0003;
    margin-bottom: 30px;
    overflow-x: auto; /* 横スクロールを有効にする */
    overflow-y: auto; /* 縦スクロールも有効にする */
    border-radius: 8px;
	max-height: 600px;
}

/* タイトル行を縦スクロール時に固定 */
.dsr-calendar-title {
    text-align: center;
    padding: 10px;
    background-color: #fff;
    font-weight: bold;
    font-size: 16px;
    position: sticky;
    left: 0;
    top: 0;
    z-index: 30;
    border-bottom: 2px solid #ddd;
    height: 40px; /* タイトル行の高さ */
    box-sizing: border-box; /* paddingを含めた高さ */
}

.dsr-calendar-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 1200px;
    font-family: 'MS Gothic', monospace;
    position: relative; /* 子要素のposition: stickyの基準 */
}

.dsr-calendar-table th,
.dsr-calendar-table td {
    border: 1px solid #0003;
    text-align: center;
    vertical-align: middle;
    height: 35px; /* 高さを統一 */
    min-width: 40px; /* 最小幅を少し増やす */
    padding: 2px;
    box-sizing: border-box; /* paddingを含めた高さ */
}

/* ヘッダー行（日付・曜日）を縦スクロール時に固定 */
.dsr-calendar-table thead th {
    position: sticky;
    background-color: #f0f0f0; /* 背景色を必ず指定 */
    font-weight: bold;
    font-size: 14px;
    z-index: 20;
    border-bottom: 2px solid #ccc;
}

/* 日付ヘッダー行の固定 */
.dsr-calendar-table thead tr:first-child th {
    top: 40px; /* タイトル行(40px)のすぐ下に固定 */
}

/* 曜日ヘッダー行の固定 */
.dsr-calendar-table thead tr:nth-child(2) th {
    top: 75px; /* タイトル行(40px) + 日付ヘッダー行(35px) = 75px の位置に固定 */
}

/* 日付ヘッダーのスタイル */
.dsr-date-header {
    background-color: #f0f0f0 !important;
    font-weight: bold;
}

/* 部屋番号の列を横スクロール時に固定 */
.dsr-room-number {
    position: sticky;
    left: 0;
    z-index: 15;
    background-color: #f0f0f0; /* 背景色を必ず指定 */
    font-weight: bold;
    min-width: 60px;
    font-size: 14px;
    border-right: 2px solid #ccc; /* 右側の境界線を明確に */
}

/* 左上の角のセル（タイトル行の部屋番号部分）を最前面に表示 */
.dsr-calendar-table thead tr:first-child .dsr-room-number {
    z-index: 25; /* 他の固定要素より最前面 */
    background-color: #f0f0f0;
    top: 40px; /* タイトル行の下に固定 */
    border-bottom: 2px solid #ccc;
    border-right: 2px solid #ccc;
}

/* thead内の2番目の行（曜日）の部屋番号セルも固定 */
.dsr-calendar-table thead tr:nth-child(2) .dsr-room-number {
    z-index: 25; /* 他の固定要素より最前面 */
    background-color: #f0f0f0;
    top: 75px; /* タイトル行 + 日付ヘッダー行 の下に固定 */
    border-bottom: 2px solid #ccc;
    border-right: 2px solid #ccc;
}


.dsr-calendar-occupied {
    background-color: #F9F3DF;
    color: #333;
    font-size: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dsr-calendar-occupied:hover {
    background-color: #DBD0C0;
}

.dsr-calendar-vacant {
    background-color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dsr-calendar-vacant:hover {
    background-color: #f0f0f0;
}

.dsr-calendar-today {
    background-color: #FDFBEE !important;
    font-weight: bold;
}

.dsr-student-info {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 1px;
    font-size: 12px;
}

/* モーダルダイアログのスタイル */
.dsr-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.dsr-modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border: 2px solid #333;
    width: 400px;
    max-width: 90%;
    border-radius: 8px;
}

.dsr-modal-header {
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ccc;
    font-size: 16px;
}

.dsr-modal-close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
}

.dsr-modal-close:hover {
    color: #d63638;
}

.dsr-modal-body p {
    margin: 10px 0;
    padding: 5px 0;
}

/* カレンダービューの追加スタイル */
#dsr-calendar-view {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #ddd;
}

#dsr-calendar-view h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {
    .dsr-room-status-wrapper {
        flex-direction: column;
    }
    /*
    .dsr-dorm-block {
          min-width: auto;
    }*/
    
    .dsr-room-grid {
        grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
        gap: 6px;
    }
    
    .dsr-room-box {
        width: 50px;
        height: 40px;
        font-size: 1.2em;
    }
    
    .dsr-calendar-table {
        font-size: 10px;
        min-width: 900px;
    }
    
    .dsr-calendar-table th,
    .dsr-calendar-table td {
        min-width: 28px;
        height: 30px; /* モバイルでも読みやすい高さに調整 */
        padding: 1px;
    }
    
    .dsr-student-info {
        font-size: 8px;
    }
    
    #dsr-calendar-nav {
        gap: 5px;
    }
    
    .dsr-date-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* モバイルでのタイトル位置調整 */
    .dsr-calendar-title {
        height: 38px; /* モバイルでのタイトル行の高さ */
    }
    
    /* モバイルでのヘッダー行の固定位置調整 */
    .dsr-calendar-table thead tr:first-child th {
        top: 38px; /* タイトル行の高さに合わせて調整 */
    }
    
    .dsr-calendar-table thead tr:nth-child(2) th {
        top: 68px; /* タイトル行(38px) + 日付ヘッダー行(30px) = 68px */
    }

    .dsr-calendar-table thead tr:first-child .dsr-room-number {
        top: 38px;
    }

    .dsr-calendar-table thead tr:nth-child(2) .dsr-room-number {
        top: 68px;
    }
}

/* 東館の入居中セル */
.dsr-calendar-east-occupied {
    background-color: #87CEEB; /* 東館用の色 */
}

/* 西館の入居中セル */
.dsr-calendar-west-occupied {
    background-color: #F47C7C; /* 西館用の色 */
}

/* 凡例項目 */
.dsr-legend-east-occupied {
    background-color: #87CEEB; /* 東館と同じ色 */
}

.dsr-legend-west-occupied {
    background-color: #F47C7C; /* 西館と同じ色 */
}