// public_html/assets/css/common.css を<?phpの直後に配置。
// 役割規定に従い、該当箇所を改変したファイル全体の完全コードを再掲します。
// 今回の改変：工程3を工程4・工程5に近づけるための強化
//   - 日付ヘッダーの幅制御をより厳密に
//   - table-layout: fixed を全工程で確実に適用
//   - 統一感を出すための微調整

/* ========================================
   全体共通（中央寄せ強化版）
   ======================================== */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 0 auto;
    padding: 20px 40px;
    background: #f8f9fa;
    max-width: 1400px;
}

/* 見出し */
h1, h2, h3 {
    margin-top: 0;
    color: #1e40af;
}

/* ログイン状態表示 */
.logged-in {
    color: #006600;
    font-weight: bold;
}

.not-logged {
    color: #cc6600;
}

/* ========================================
   テーブル
   ======================================== */
table {
    border-collapse: collapse;
    width: 100%;
    max-width: 100%;
    margin: 15px 0;
    background: white;
}

th, td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

th {
    background: #f5f5f5;
    font-weight: 600;
}

/* ========================================
   メニューエリア
   ======================================== */
.menu {
    margin: 25px 0;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    border-left: 6px solid #0066cc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.menu strong {
    display: block;
    margin-bottom: 12px;
    color: #0066cc;
}

/* ========================================
   リンク
   ======================================== */
a {
    color: #0066cc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.logout {
    color: #d32f2f;
    font-weight: bold;
}

.logout:hover {
    color: #b71c1c;
}

/* ========================================
   デバッグ情報
   ======================================== */
pre {
    background: #f4f4f4;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 14px;
    border: 1px solid #eee;
}

/* ========================================
   ヘッダー（driver_dashboard用）
   ======================================== */
.header {
    background: #0066cc;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* ========================================
   フォーム画面の中央寄せ対策
   ======================================== */
body > h1,
body > form,
body > div,
body > section,
body > main,
.form-container,
.content {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

form {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

input[type="text"],
input[type="date"],
textarea,
select {
    width: 100%;
    max-width: 700px;
    padding: 10px 14px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    display: block;
    margin-bottom: 12px;
    margin-left: auto;
    margin-right: auto;
}

input[name="rotation_custom"] {
    max-width: 800px;
    font-size: 1.1rem;
}

button,
input[type="submit"],
.btn {
    display: inline-block;
}

section,
fieldset {
    margin-bottom: 2.5rem;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

pre {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 16px;
    border-radius: 6px;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 100%;
}

/* ========================================
   送信ボタン（.submit-btn）
   ======================================== */
.submit-btn {
    display: inline-block;
    padding: 14px 48px;
    font-size: 1.15rem;
    font-weight: 600;
    background: #1e40af;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin: 20px 10px;
    box-shadow: 0 3px 8px rgba(30, 64, 175, 0.35);
    transition: all 0.2s ease;
}

.submit-btn:hover {
    background: #1e3a8a;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(30, 64, 175, 0.45);
}

/* ========================================
   工程2: ドライバー選択ページ用スタイル
   ======================================== */
.driver-btn {
    padding: 18px 20px;
    font-size: 1.05em;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    background: white;
    text-align: center;
    width: 100%;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.driver-btn:hover {
    border-color: #64748b;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.driver-btn.selected {
    background: #22c55e;
    color: white;
    border-color: #16a34a;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.bulk-btn {
    padding: 10px 22px;
    font-size: 1em;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin: 4px;
    transition: background 0.2s;
}

.bulk-btn:hover {
    background: #2563eb;
}

/* ドライバー一覧グリッド */
#driverButtons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

/* ========================================
   シフトセル（正方形固定・工程3・4共通）
   ======================================== */
.shift-cell {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    box-sizing: border-box;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    font-weight: bold;
    user-select: none;
    font-size: 0.9em;
    border: 1px solid #64748b;
}

.shift-早 { background: #3b82f6; color: white; }
.shift-日 { background: #22c55e; color: white; }
.shift-遅 { background: #f59e0b; color: white; }
.shift-公 { background: #fecaca; color: #b91c1c; }
.shift-休 { background: #fed7aa; color: #9a3412; }
.shift-希 { background: #c084fc; color: white; }
.shift-有 { background: #67e8f9; color: #0e7490; font-weight: bold; }

/* ========================================
   月選択ボタン（工程3用）
   ======================================== */
.month-btn {
    padding: 6px 14px;
    margin: 2px;
    border: 1px solid #ccc;
    background: #f8fafc;
    cursor: pointer;
    text-decoration: none;
    color: #333;
    display: inline-block;
}

.month-btn.active {
    background: #1e40af;
    color: white;
    border-color: #1e40af;
}
/* 工程3 日付ヘッダー用 */
.day-header {
    min-width: 34px;
    padding: 2px 1px;
    line-height: 1.0;
    font-size: 0.82em;
    text-align: center;
}

.day-header .day-number {
    font-weight: bold;
    display: block;
}

.day-header .weekday {
    font-size: 0.65em;
    color: #64748b;
    display: block;
}

/* ========================================
   工程3・4・5 共通スタイル（統一感重視）
   ======================================== */

/* 日付・曜日のヘッダー（濃紺背景＋白文字） */
.schedule-phase3 table tr:first-child th,
.schedule-phase3 table > tbody > tr:first-child th,
.schedule-phase4 table tr:first-child th,
.schedule-phase4 table > tbody > tr:first-child th,
.schedule-phase5 table tr:first-child th,
.schedule-phase5 table > tbody > tr:first-child th {
    background-color: #1e40af !important;
    color: #ffffff !important;
}

.schedule-phase3 table tr:first-child th span,
.schedule-phase3 table > tbody > tr:first-child th span,
.schedule-phase4 table tr:first-child th span,
.schedule-phase4 table > tbody > tr:first-child th span,
.schedule-phase5 table tr:first-child th span,
.schedule-phase5 table > tbody > tr:first-child th span {
    color: #ffffff !important;
}

/* 左端「運転手名」セルの幅 */
.schedule-phase3 table th:first-child,
.schedule-phase3 table td:first-child,
.schedule-phase4 table th:first-child,
.schedule-phase4 table td:first-child,
.schedule-phase5 table th:first-child,
.schedule-phase5 table td:first-child {
    min-width: 95px !important;
    max-width: 110px !important;
    width: 100px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
}

/* 右端集計3列の幅 */
.schedule-phase3 table th:nth-last-child(-n+3),
.schedule-phase3 table td:nth-last-child(-n+3),
.schedule-phase4 table th:nth-last-child(-n+3),
.schedule-phase4 table td:nth-last-child(-n+3),
.schedule-phase5 table th:nth-last-child(-n+3),
.schedule-phase5 table td:nth-last-child(-n+3) {
    min-width: 55px !important;
    max-width: 70px !important;
    width: 62px !important;
    padding: 4px 6px !important;
    font-size: 0.78em !important;
    text-align: center !important;
}

/* 日付ヘッダー（1〜31）の幅を完全統一 */
.schedule-phase3 table tr:first-child th:not(:first-child):not(:nth-last-child(-n+3)),
.schedule-phase3 table > tbody > tr:first-child th:not(:first-child):not(:nth-last-child(-n+3)),
.schedule-phase4 table tr:first-child th:not(:first-child):not(:nth-last-child(-n+3)),
.schedule-phase4 table > tbody > tr:first-child th:not(:first-child):not(:nth-last-child(-n+3)),
.schedule-phase5 table tr:first-child th:not(:first-child):not(:nth-last-child(-n+3)),
.schedule-phase5 table > tbody > tr:first-child th:not(:first-child):not(:nth-last-child(-n+3)) {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    padding: 2px 1px !important;
    text-align: center !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
}

/* テーブルレイアウトを固定（統一感を出すための重要設定） */
.schedule-phase3 table,
.schedule-phase4 table,
.schedule-phase5 table {
    table-layout: fixed !important;
}