/* ─── デザイン定義 ─── */
:root {
    --primary: #0055aa; --secondary: #6c757d; --bg: #f4f7f9; --white: #ffffff;
    --ok: #28a745; --warn: #ffc107; --ng: #dc3545; --reserved: #e1f0ff;
}
body { font-family: "Helvetica Neue", Arial, sans-serif; background: var(--bg); margin: 0; padding: 10px; color: #333; }
.container { max-width: 800px; margin: 0 auto; background: var(--white); border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); overflow: hidden; min-height: 80vh; }
.header-bar { background: var(--primary); padding: 15px 20px; color: white; display: flex; justify-content: space-between; align-items: center; }
.header-bar h1 { margin: 0; font-size: 1.2rem; }
.content { padding: 20px; }

h2 { border-left: 5px solid var(--primary); padding-left: 10px; font-size: 1.1rem; margin: 25px 0 10px; }
label { display: block; margin-top: 15px; font-weight: bold; font-size: 0.85rem; color: #555; }
input, select, button { width: 100%; padding: 12px; margin-top: 5px; border: 1px solid #ccc; border-radius: 8px; box-sizing: border-box; font-size: 1rem; }
button { background: var(--primary); color: white; border: none; font-weight: bold; cursor: pointer; transition: 0.2s; }
button:hover { opacity: 0.9; }
button:disabled { background: #ccc; cursor: not-allowed; opacity: 1; }
.btn-sm { width: auto; padding: 5px 15px; font-size: 0.8rem; }
.btn-outline { background: white; color: var(--primary); border: 1px solid var(--primary); }
.btn-danger { color: #dc3545; border-color: #dc3545; }
.btn-cancel-text { width: 100%; margin-top: 10px; border: none; color: #666; background: transparent; cursor: pointer; text-decoration: underline; }

.login-box { border: 2px solid #eee; padding: 20px; border-radius: 10px; background: #fdfdfd; }
.user-info-bar { background: #eef6ff; padding: 15px; border-radius: 8px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; }

/* カレンダー */
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; text-align: center; }
.cal-day-label { font-weight: bold; font-size: 0.75rem; color: #666; padding: 5px 0; }
.cal-date { padding: 10px 0; border: 1px solid #eee; border-radius: 6px; cursor: pointer; font-weight: bold; min-height: 40px; display: flex; align-items: center; justify-content: center; position: relative; }
.cal-date.empty { border: none; cursor: default; }
.cal-date.disabled { background: #f9f9f9; color: #ccc; cursor: not-allowed; }
.cal-date.selected { border: 2px solid var(--primary); background: #fff; z-index: 1; }
.cal-date.has-res { background-color: var(--reserved); color: var(--primary); }
.cal-date.has-res::after { content: "●"; font-size: 8px; position: absolute; bottom: 2px; }
.cal-date.today { text-decoration: underline; color: var(--ng); }

/* 時間枠 */
.selection-panel { background: #fff; padding: 15px; border: 2px solid var(--primary); border-radius: 10px; margin-top: 15px; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.slot-card { border: 2px solid #ddd; padding: 12px; border-radius: 8px; cursor: pointer; text-align: center; position: relative; }
.slot-card input { position: absolute; top: 5px; right: 5px; width: auto; }
.slot-card.full { background: #f0f0f0; color: #999; cursor: not-allowed; }
.slot-card.warn-block { background: #fff9e6; cursor: pointer; } 
.badge { padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; }
.bg-ok { background: #e6ffed; color: var(--ok); } 
.bg-warn { background: #fff9e6; color: var(--warn); } 
.bg-ng { background: #ffeef0; color: var(--ng); }
.warn-msg { color:#d63384; font-weight:bold; margin-top:10px; background:#fff0f5; padding:10px; border-radius:4px; }

/* 管理者画面 */
.list-item { border-bottom: 1px solid #eee; padding: 10px 0; font-size: 0.9rem; display: flex; justify-content: space-between; align-items: center; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.week-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; background: #eee; padding: 10px; border-radius: 8px; }
.day-schedule-wrapper { margin-bottom: 30px; }
.day-title { background: #333; color: #fff; padding: 8px 15px; font-weight: bold; border-radius: 6px 6px 0 0; margin: 0; }
.schedule-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; border: 1px solid #ccc; table-layout: fixed; }
.schedule-table th, .schedule-table td { border: 1px solid #ccc; padding: 6px 2px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-table th { background: #f9f9f9; font-weight: bold; width: 12.5%; }
.schedule-table th:first-child { width: 10%; } 
.schedule-table td { cursor: pointer; }
.schedule-table td:hover { background-color: #f0f8ff; }
.row-gray { background-color: #e0e0e0; }
.cell-pc-blue { background-color: #e1f0ff; color: #0055aa; font-weight: bold; }
.cell-pc-red { background-color: #ffeef0; color: #d63384; font-weight: bold; }
.cell-pc-default { background-color: #fff3cd; color: #664d03; }

/* 月間リスト */
.monthly-list-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.monthly-list-table th, .monthly-list-table td { border: 1px solid #333; padding: 4px; text-align: center; }
.monthly-list-table th { background: #eee; }
.col-name { width: 100px; text-align: left; }
.col-num { width: 30px; }

/* モーダル */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: #fff; margin: 15% auto; padding: 20px; border: 1px solid #888; width: 300px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 2000; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.spinner { border: 4px solid #f3f3f3; border-top: 4px solid var(--primary); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

@media print {
    body { background: #fff; padding: 0; font-size: 9pt; }
    .container { box-shadow: none; max-width: 100%; width: 100%; border-radius: 0; min-height: auto; }
    .no-print { display: none !important; }
    .header-bar { display: none; }
    .schedule-table, .monthly-list-table { border: 1px solid #000; }
    .schedule-table th, .schedule-table td { border: 1px solid #000; padding: 2px; }
    .monthly-list-table { font-size: 8pt; page-break-inside: auto; }
    .monthly-list-table th, .monthly-list-table td { padding: 1px; height: 14px; }
    .day-schedule-wrapper { page-break-inside: avoid; margin-bottom: 10px; }
    #admin-week-view, #admin-month-view { display: block !important; } 
    .content { padding: 0; display: block; }
}

/* 週間予約状況：PC5とPC6の間の境界線を太くする (PC5の右側を強調) */
.schedule-table th:nth-child(6),
.schedule-table td:nth-child(6) {
    border-right: 2px solid #333;
}

/* 月間予約一覧：「残」と「1」の列の間の境界線を太くする (「残」の右側を強調) */
.monthly-list-table th:nth-child(4),
.monthly-list-table td:nth-child(4) {
    border-right: 2px solid #333;
}

/* マンツーマンコース専用の色（script.jsの判定で使用） */
.cell-pc-man { background-color: #d4edda; color: #155724; font-weight: bold; }

/* 検定試験用のセル色 */
.cell-exam { background-color: #f3e5f5; color: #7b1fa2; font-weight: bold; border: 2px solid #7b1fa2 !important; }

/* 休み（臨時休校）のセル色 */
.cell-holiday { background-color: #666 !important; color: #fff !important; font-weight: bold; }

@media print {
    @page {
        size: A4 portrait;
        margin: 5mm;
    }

    /* 1. 全ての要素を一旦非表示にし、余白をリセット */
    html, body { height: auto !important; background: #fff; overflow: visible !important; }
    .no-print, .header-bar, .admin-tabs, .week-nav, h2, #admin-student-view { display: none !important; }
    
    /* 2. コンテナの制限を解除 */
    .container { box-shadow: none !important; width: 100% !important; border: none !important; min-height: 0 !important; margin: 0 !important; }
    .content { padding: 0 !important; }

    /* 3. 【重要】現在画面で見えているタブ（style="display: block"がついているもの）以外は印刷しない */
    #admin-week-view, #admin-month-view { display: none !important; }

    /* JavaScriptの表示状態と連動させる（週間座席表） */
    #admin-week-view[style*="display: block"], 
    #admin-week-view:not([style]) { /* 初期状態（style属性なし）も考慮 */
        display: block !important;
        margin-left: 15mm;
        margin-right: 15mm;
    }

    /* JavaScriptの表示状態と連動させる（月間一覧） */
    #admin-month-view[style*="display: block"] { 
        display: block !important; 
         /* 表全体を右に寄せる（左余白を広げる） */
        margin-left: 20mm; 
    }

    /* --- 週間座席表の細部調整 --- */
    .day-schedule-wrapper { page-break-inside: avoid; margin-bottom: 2mm; }
    .schedule-table { font-size: 7.2pt; line-height: 1.1; width: 100%; }

    /* --- 月間一覧の細部調整（80名集約） --- */
    /* --- 月間一覧の細部調整（80名集約） --- */
    .monthly-list-table { width: auto; font-size: 6.5pt; line-height: 1; border-collapse: collapse; }
    
    /* 受講生名の列幅を狭く固定する */
    .monthly-list-table th:first-child,
    .monthly-list-table td:first-child {
        width: 25mm !important;
        text-align: left;
        padding-left: 2px !important;
    }

    .monthly-list-table th, .monthly-list-table td { 
        height: 3.1mm !important;
        padding: 0 !important;
        border: 1px solid #000;
        /* 日付列の幅を固定 */
        width: 7mm; 
    }
}

.summary-info {
    margin: -10px 0 15px 10px; /* 見出しとの距離を詰め、左に少し余白 */
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--primary); /* ブルー系統の色 */
}

.reserve-info {
    margin: -10px 0 15px 10px; /* 見出しとの距離を詰め、左に少し余白 */
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--primary); /* ブルー系統の色 */
}

/* 体験予約カレンダー用の〇印 */
.cal-date.available::after {
    content: "〇";
    font-size: 10px;
    position: absolute;
    bottom: 2px;
    color: var(--ok);
}

/* 体験予約カレンダー用の×印（空き枠なしの日） */
.cal-date.full-unavailable::after {
    content: "×";
    font-size: 10px;
    position: absolute;
    bottom: 2px;
    color: var(--ng); /* 赤色 */
}