:root {
    /* メインカラーパレット */
    --cMain: #203335;
    --cSecondary: #BFBFBF;
    --cWhite: #F2F2F2;
    --cBlack: #0D0D0D;
    --cAccent: #d8d8d8;
    --cSuccess: #4caf50;
    --cWarning: #ff9800;
    --cError: #f44336;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
    font-family: sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    text-align: center;
}

html {
    font-size: 16px;
    background: var(--cWhite);
    color: var(--cBlack);
    /* ページ全体のスクロールを無効化 */
    overflow: hidden;
    height: 100%;
}

body {
    /* ページ全体のスクロールを無効化 */
    overflow: hidden;
    height: 100%;
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
    font-style: italic;
    background-repeat: no-repeat;
    shape-margin: 0.75rem;
}

a,
a:link,
a:visited {
    color: inherit;
    text-decoration: none;
}

li {
    list-style: none;
}

div {
    border-radius: 4px;
}

/* 基本設定 */
h1 {
    font-size: 1rem;
    text-align: left;
    font-weight: normal;
}

/* ボタン共通 */
button,
input,
select {
    background-color: var(--cWhite);
    color: var(--cBlack);
    cursor: pointer;
    border: none;
    border-radius: 4px;
    transition: 0.3s;
}

input:focus,
select:focus {
    outline: none;
}


/* 小さいボタン */
.small-button {
    font-size: .6rem;
    padding: 1px 4px;
    opacity: 0.5;
    border: 1px dotted var(--cSecondary);
    background-color: var(--cWhite);
    color: var(--cBlack);

}

.small-button:hover {
    opacity: 1;
}

/* テーブル */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--cWhite);
    table-layout: fixed;

}


td,
th {
    border: 1px solid var(--cSecondary);
    padding: 0.5rem 1rem;
    color: var(--cBlack);
}


th {
    background: var(--cMain);
    color: var(--cWhite);
}

th:nth-child(1),
td:nth-child(1) {
    width: 120px;
}

th:nth-child(2),
td:nth-child(2) {
    width: 120px;
}

th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5),
th:nth-child(6),
td:nth-child(6) {
    width: calc((100% - 240px) / 4);
}

tr:hover {
    background-color: var(--cAccent);
}

.tableGrid {
    display: grid;
    grid-template-rows: repeat(3, 1fr);
}

thead {
    position: sticky;
    top: 0;
    z-index: 9999;
}

.table-container {
    overflow-y: auto;
}

/* レイアウト */
header {
    display: flex;
    justify-content: space-between;
    padding: 4px;
    height: 50px;
}

main {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    height: calc(100vh - 50px);
}

main>div {
    flex: 4;
}

.header-title-container {
    display: flex;
    gap: 20px;
}

#studentListArea {
    flex: 1;
    margin-left: 20px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
}

.schedule-controls {
    background-color: var(--cMain);
    color: var(--cWhite);
    display: flex;
    padding: 10px;
    border-radius: 0;
    gap: 10px;
}

/* 生徒一覧エリア */
.student-controls {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 10px;
    gap: 8px;
}


.student-filter, .student-search{
    border: 1px solid var(--cBlack);
    padding-block: 8px;
    min-width: 140px;
}
.student-filter {
    margin-right: 1px;

}

.student-search {
    flex-grow: 1;
    text-align: left;
    padding-left: 8px;
}

/* 教師名スタイル */
.teacher-name {
    cursor: pointer;
}

/* 教師選択ポップアップ */
.teacher-popup {
    display: none;
    position: absolute;
    background-color: var(--cSecondary);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    width: 120px;
    left: 0;
    top: 0;
    transform: translateY(-20px);
}

.teacher-popup.show {
    display: block;
}

.teacher-button {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 4px 0;
    cursor: pointer;
    color: var(--cBlack);
}

.teacher-button:hover {
    background-color: var(--cWhite);
    color: var(--cBlack);
}

/* タスク追加ボタン */
.add-task-button {
    position: absolute;
    right: 4px;
    bottom: 4px;
}

/* 日付セルのボタン */
.date-cell-buttons {
    display: flex;
    flex-direction: column;
    margin-left: 5px;
    float: right;
}

/* カテゴリタブ */
.student-category-tabs {
    background-color: var(--cWhite);
    position: relative;
    border-bottom: 1px solid var(--cBlack);
    padding: 0 8px;
    border-radius: 4px 4px 0 0;
}

.category-tab {
    padding: 4px 8px;
    transition: all 0.2s ease;
    border-bottom: 3px solid var(--cWhite);
    border-radius: 0;
}

.category-tab:hover {
    background-color: var(--cBlack);
    color: var(--cWhite);
    border-bottom: 3px solid var(--cBlack);
}

.category-tab.active {
    border-bottom: 3px solid var(--cBlack);
    font-weight: bold;
}

.pagination {
    background-color: var(--cWhite);
    padding-block: 8px;
    position: sticky;
    top: 0;
}
.page-button{
    padding: 4px;
}

.student-list-container {
    padding: 0 8px 8px 8px;
    overflow-y: auto;
    flex-grow: 1;
    position: relative;
    border-radius: 0 0 4px 4px;
    background-color: var(--cWhite);
    color: var(--cBlack);
}

/* 生徒の詳細情報 */
.student-preferences {
    display: none;
    position: absolute;
    padding: 8px;
    background-color: var(--cWhite);
    top: 0;
    left: 0;
    width: 100%;
}

.preference-item {
    display: inline;
    padding-inline: 2px;
}

/* 生徒リスト */


#studentList li {
    padding: 10px;
    margin: 4px 0;
    border: 1px solid var(--cBlack);
    border-radius: 4px;
    transition: background-color var(--cAccent);
}

#studentList li:hover {
    background-color: var(--cSecondary);
}

/* #studentList li:hover .student-preferences {
    display: block;
} */

/* 生徒ステータス */
#studentList li {
    border-left: 8px solid var(--cWarning);
}

#studentList li.completed-student {
    border-left: 8px solid var(--cSuccess);
}

#studentList li.over-assigned {
    border-left: 8px solid var(--cError);

    .student-status-text {
        color: var(--cError);
    }
}

/* 通知 */
.notification {
    position: fixed;
    top: 4px;
    right: 4px;
    color: var(--cWhite);
    max-width: 600px;
    z-index: 1100;
    opacity: 0;
    padding: 6px 12px;
}

.notification.show {
    opacity: 1;
}

.notification-info {
    background-color: var(--cAccent);
}

.notification-success {
    background-color: var(--cSuccess);
}

.notification-warning {
    background-color: var(--cWarning);
}

.notification-error {
    background-color: var(--cError);
}

/* 保存状態インジケーター */
.save-status {
    border-radius: 50%;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.save-status.show {
    opacity: 1;
}

.save-status.saving {
    color: #2196F3;
}

.save-status.saved {
    color: #4caf50;
}

.save-status.error {
    color: #f44336;
}

/* 空行スタイル */
.empty-row {
    opacity: 0.7;
}

.empty-row:hover {
    opacity: 1;
}

/* モーダルダイアログ */
.modal {
    display: none;
}

/* 生徒アクションメニュー */
.student-action-menu {
    position: absolute;
    z-index: 2000;
    background-color: var(--cWhite);
    color: var(--cWhite);
    box-shadow: var(--shadow-md);
    min-width: 150px;
    overflow: hidden;
    border: 1px solid var(--cBorder);
}

.menu-option {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    background-color: var(--cMain);
}

/************************************/
/* ボタンデザイン */
/************************************/

/* サーバーリセット */
#debugContainer button {
    padding: 6px 12px;
    background: var(--cWhite);
    color: var(--cError);
    border-radius: 32px;
    cursor: pointer;
    border: 1px solid var(--cError);
}

#debugContainer button:hover {
    background: var(--cError);
    color: var(--cWhite);
}

/* タスク管理 */
.task-edit-button,
.task-delete-button {
    padding: 4px 8px;
    margin-left: 4px;
}

.task-edit-button:hover {
    color: var(--cWhite);
    background-color: var(--cBlack);
}

.task-delete-button {
    color: var(--cWarning);
    background-color: var(--cWhite);
}

.task-delete-button:hover {
    color: var(--cWhite);
    background-color: var(--cWarning);
}

.app-controls button{
    background-color: var(--cMain);
    padding: 4px;
    color: var(--cWhite);
}


/* 事務作業項目スタイル */
task-item {
    width: 100%;
}

/* スケジュールコントロール */
.schedule-area {
    border: 1px solid var(--cBlack);
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* モーダルダイアログ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    color: var(--cWhite);
}

.modal-content {
    margin: 15% auto;
    padding: 20px;
    border: 1px solid var(--cBlack);
    width: 300px;
    position: relative;
    background-color: var(--cBlack);
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover {
    color: var(--cError);
}

#modalTitle {
    margin-top: 0;
    margin-bottom: 15px;
}

#modalMessage {
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-buttons button {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--cBorder);
    cursor: pointer;
}

/* 月選択 */

.control-group,
.app-controls {
    display: flex;
    align-items: center;
    background-color: var(--cWhite);
    color: var(--cBlack);
    padding: 1px;
    gap: 2px;
}

/* 振替モーダル */
.reschedule-form {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.reschedule-section {
    flex: 1;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.reschedule-section h4 {
    margin-top: 0;
    border-bottom: 1px solid #ccc;
    padding-bottom: 8px;
    margin-bottom: 15px;
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* モーダル向けの追加スタイル */
.modal-content {
    max-width: 700px;
    width: 90%;
}

/* 振替モーダルのボタン */
.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-buttons button {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#rescheduleCancel {
    background-color: var(--cError);
    color: var(--cWhite);
}

#rescheduleConfirm {
    background-color: var(--cSuccess);
    color: var(--cWhite);
}