* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        "Yu Gothic",
        "Meiryo",
        sans-serif;

    background: #f5f7fa;
    color: #333;
}

header {
    text-align: center;
    background: white;
    padding: 25px 15px;
    border-bottom: 1px solid #ddd;
}

header h1 {
    margin: 0;
    font-size: 24px;
}

header p {
    margin: 8px 0 0;
}

main {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 15px;
}

section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.menu {
    text-align: center;
}

.button {
    display: inline-block;
    padding: 14px 30px;
    margin-top: 15px;

    background: #1976d2;
    color: white;

    text-decoration: none;

    border-radius: 6px;

    border: none;

    cursor: pointer;

    font-size: 16px;
}

.notice {
    background: #f0f7ff;
    padding: 12px;
    border-radius: 6px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
}

.calendar-header button {
    border: none;
    background: #eee;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 5px;
}

#calendar table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

#calendar th {
    padding: 10px;
    background: #eee;
}

#calendar td {
    border: 1px solid #ddd;
    height: 85px;
    text-align: center;
    vertical-align: middle;
}

#calendar td.available {
    cursor: pointer;
}

#calendar td.available:hover {
    background: #f0f7ff;
}

#calendar td.full {
    background: #f5f5f5;
    color: #999;
}

#calendar td.holiday {
    background: #eeeeee;
    color: #777;
    font-weight: bold;
}

#calendar td.holiday .day-number {
    font-weight: bold;
}

#calendar td.holiday .reservation-count {
    font-weight: bold;
}


#admin-calendar td.holiday {
    background: #eeeeee;
    color: #777;
    font-weight: bold;
}

#admin-calendar td.holiday .day-number {
    font-weight: bold;
}

#admin-calendar td.holiday .reservation-count {
    font-weight: bold;
}


/* 今日・過去日の表示 */

#calendar td.today {
    font-weight: bold;
    border: 2px solid #999;
}
#calendar td.today .day-number {
    font-weight: bold;
}

#calendar td.today .reservation-count {
    font-weight: bold;
}

#calendar td.past {
    background: #f5f5f5;
    color: #aaa;
}

#calendar td.past .day-number {
    color: #aaa;
}

#calendar td.past .reservation-count {
    color: #aaa;
}

.day-number {
    font-size: 18px;
    font-weight: bold;
}

.reservation-count {
    margin-top: 8px;
    font-size: 13px;
}

.form-container {
    max-width: 500px;
    margin: auto;
}

.selected-date {
    background: #f0f7ff;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
}

form label {
    display: block;
    margin-top: 18px;
    margin-bottom: 5px;
    font-weight: bold;
}

form input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

form button {
    width: 100%;
}

.back {
    display: block;
    margin-top: 20px;
    text-align: center;
}

.complete {
    text-align: center;
    max-width: 500px;
    margin: auto;
}

.reservation-number {
    margin: 25px 0;
    padding: 20px;
    background: #f0f7ff;
    border-radius: 8px;
}

.reservation-number strong {
    font-size: 28px;
    letter-spacing: 2px;
}

.reservation-info {
    text-align: left;
}

.important {
    margin-top: 25px;
    padding: 15px;
    background: #fff8e1;
    border-radius: 6px;
}

footer {
    text-align: center;
    padding: 30px;
    color: #777;
}

@media (max-width: 600px) {

    main {
        margin: 15px auto;
    }

    section {
        padding: 15px;
    }

    #calendar td {
        height: 70px;
    }

    .reservation-count {
        font-size: 11px;
    }

}

.button-secondary {
    background: #555;
    margin-left: 10px;
}

.error {
    margin: 15px 0;
    padding: 12px;

    background: #ffebee;
    color: #c62828;

    border-radius: 6px;
}

@media (max-width: 600px) {

    .button-secondary {
        margin-left: 0;
        margin-top: 10px;
    }

}

/* ========================================
   管理者画面
======================================== */

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.admin-header h2 {
    margin-top: 0;
}

.logout-button {
    display: inline-block;

    padding: 10px 18px;

    background: #555;
    color: white;

    text-decoration: none;

    border-radius: 6px;

    white-space: nowrap;
}

.logout-button:hover {
    background: #333;
}

.back-button {
    display: inline-block;

    padding: 10px 18px;

    background: #eee;
    color: #333;

    text-decoration: none;

    border-radius: 6px;

    white-space: nowrap;
}

.reservation-summary {
    margin: 20px 0;

    padding: 15px;

    background: #f0f7ff;

    border-radius: 6px;
}

.reservation-table-wrapper {
    overflow-x: auto;
}

.reservation-table {
    width: 100%;

    border-collapse: collapse;

    margin-bottom: 25px;

    min-width: 0;

    table-layout: fixed;
}

.reservation-table th,
.reservation-table td {
    border: 1px solid #ddd;

    padding: 8px 6px;

    text-align: left;

    vertical-align: middle;
}

.reservation-table th {
    background: #eee;
    font-weight: bold;
}

.reservation-table tbody tr:hover {
    background: #f8f8f8;
}

/* ============================================================
   予約一覧 コンパクト表示
   ============================================================ */

.reservation-table th:nth-child(1),
.reservation-table td:nth-child(1) {
    width: 90px;
}

.reservation-table th:nth-child(2),
.reservation-table td:nth-child(2) {
    width: 180px;
}

.reservation-table th:nth-child(3),
.reservation-table td:nth-child(3) {
    width: 90px;
}

.reservation-table th:nth-child(4),
.reservation-table td:nth-child(4) {
    width: 125px;
}

.reservation-table th:nth-child(5),
.reservation-table td:nth-child(5) {
    width: 65px;
    text-align: center;
}

.reservation-table th:nth-child(6),
.reservation-table td:nth-child(6) {
    width: 75px;
    text-align: center;
}

.reservation-table th:nth-child(7),
.reservation-table td:nth-child(7) {
    width: 105px;
}

.reservation-table th:nth-child(8),
.reservation-table td:nth-child(8) {
    width: 190px;
}

/* ============================================================
   予約一覧 各項目
   ============================================================ */

.reservation-table td:nth-child(1) {
    font-family: monospace;
    font-weight: bold;
}

.reservation-table td:nth-child(2) {
    min-width: 180px;
}

.reservation-table td:nth-child(3) {
    text-align: center;
}

.reservation-table td:nth-child(4) {
    min-width: 130px;
}

.reservation-table td:nth-child(5),
.reservation-table td:nth-child(6) {
    text-align: center;
}

.reservation-table td:nth-child(7) {
    color: #666;
    font-size: 13px;
}

.reservation-table td:nth-child(8) {
    min-width: 0;
}

.status {
    display: inline-block;

    padding: 5px 10px;

    background: #e3f2fd;

    border-radius: 5px;

    font-size: 13px;
}

.no-reservation {
    padding: 30px;

    text-align: center;

    background: #f5f5f5;

    border-radius: 6px;

    margin-bottom: 25px;
}


/* 管理者カレンダー */

#admin-calendar table {
    width: 100%;

    border-collapse: collapse;

    table-layout: fixed;
}

#admin-calendar th {
    padding: 10px;

    background: #eee;
}

#admin-calendar td {
    border: 1px solid #ddd;

    height: 85px;

    text-align: center;

    vertical-align: middle;
}

#admin-calendar td.available {
    cursor: pointer;
}

#admin-calendar td.available:hover {
    background: #f0f7ff;
}


/* スマートフォン */

@media (max-width: 600px) {

    .admin-header {
        flex-direction: column;

        align-items: stretch;
    }

    .logout-button,
    .back-button {
        text-align: center;
    }

    #admin-calendar td {
        height: 70px;
    }

}

.cancel-button {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.cancelled-label {
    font-size: 14px;
}

/* ============================================================
   接種方法別 集計
   ============================================================ */

.vaccination-summary {
    display: flex;
    gap: 12px;
    margin: 16px 0 24px;
}

.vaccination-summary-item {
    min-width: 120px;
    padding: 12px 20px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f5f5f5;
    text-align: center;
}

.vaccination-summary-item span {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
}

.vaccination-summary-item strong {
    font-size: 1.2em;
}

/* ============================================================
   管理者ページ タブ
   ============================================================ */

.admin-tabs {
    display: flex;
    gap: 8px;
    margin: 20px 0;
}

.admin-tab {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    font-weight: bold;
}

.admin-tab:hover {
    background: #e9e9e9;
}

.admin-tab.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* ============================================================
   予約状態フィルター
   ============================================================ */

.reservation-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 20px;
}

.reservation-filter-label {
    font-weight: bold;
}

.reservation-filter-button {
    padding: 7px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f5f5f5;
    color: #333;
    cursor: pointer;
    font-weight: bold;
}

.reservation-filter-button:hover {
    background: #e9e9e9;
}

.reservation-filter-button.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* ============================================================
   予約一覧 印刷ボタン
   ============================================================ */

.print-button {
    display: inline-block;
    padding: 10px 20px;
    margin-left: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f5f5f5;
    color: #333;
    font-weight: bold;
    cursor: pointer;
}

.print-button:hover {
    background: #e9e9e9;
}

/* ============================================================
   印刷時の表示
   ============================================================ */

@media print {

    body {
        background: #fff;
    }

    .back-button,
    .print-button,
    .reservation-search,
    .reservation-filter,
    .cancel-button,
    .button {
        display: none !important;
    }

    .admin-header {
        margin-bottom: 20px;
    }

    .vaccination-summary {
        margin-bottom: 20px;
    }

    .reservation-table-wrapper {
        overflow: visible;
    }

    .reservation-table {
        width: 100%;
        border-collapse: collapse;
    }

    .reservation-table th,
    .reservation-table td {
        border: 1px solid #000;
        padding: 6px 8px;
        font-size: 11px;
    }

    .reservation-table th {
        background: #eee !important;
        color: #000;
    }

    .reservation-table td:last-child,
    .reservation-table th:last-child {
        display: none;
    }

    .status {
        color: #000;
    }

    .cancelled-label {
        color: #000;
    }

}

.status-summary {
    display: flex;
    gap: 12px;
    margin: 16px 0 24px;
}

.status-summary-item {
    min-width: 120px;
    padding: 12px 20px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f5f5f5;
    text-align: center;
}

.status-summary-item span {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
}

.status-summary-item strong {
    font-size: 1.2em;
}

.person-form {
    margin-top: 24px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
}

.person-form h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

/* ============================================================
   接種方法 ラジオボタン
   ============================================================ */

.vaccination-type {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 5px;
}

.vaccination-type label {
    display: inline-flex;
    align-items: center;
    width: auto;
    margin: 0;
    font-weight: bold;
    white-space: nowrap;
}

.vaccination-type input[type="radio"] {
    width: auto;
    margin: 0 6px 0 0;
    padding: 0;
}

.person-form + .person-form {
    margin-top: 16px;
}

.remove-person-button {
    display: inline-block;
    width: auto;
    padding: 8px 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f5f5f5;
    color: #333;
    cursor: pointer;
}

.remove-person-button:hover {
    background: #e9e9e9;
}

#add-person-button {
    display: inline-block;
    width: auto;
    margin-top: 16px;
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f5f5f5;
    color: #333;
    font-weight: bold;
    cursor: pointer;
}

#add-person-button:hover {
    background: #e9e9e9;
}

#add-person-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.admin-menu-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.admin-menu-buttons .admin-button {
    display: inline-block;
    width: auto;
    min-width: 150px;
    padding: 10px 18px;
    text-decoration: none;
    text-align: center;

    border: 1px solid #aaa;
    border-radius: 8px;

    background: linear-gradient(
        to bottom,
        #ffffff,
        #eeeeee
    );

    color: #333;
    font-weight: bold;

    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.15);

    cursor: pointer;

    transition:
        background 0.15s,
        box-shadow 0.15s,
        transform 0.1s;
}

.admin-menu-buttons .admin-button:hover {
    background: linear-gradient(
        to bottom,
        #f8f8f8,
        #dddddd
    );

    box-shadow:
        0 3px 6px rgba(0, 0, 0, 0.2);
}

.admin-menu-buttons .admin-button:active {
    transform: translateY(1px);

    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.15);
}

/* ============================================================
   管理者：変更・キャンセル履歴
   ============================================================ */

.admin-history-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 20px;
}

.admin-history-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 14px;
}

.admin-history-table th {
    padding: 12px 10px;
    background: #f1f3f5;
    border-bottom: 2px solid #ced4da;
    text-align: left;
    white-space: nowrap;
    font-weight: bold;
}

.admin-history-table td {
    padding: 11px 10px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
    white-space: nowrap;
}

.admin-history-table tbody tr:hover {
    background: #f8f9fa;
}

.history-datetime {
    font-size: 13px;
    color: #555555;
}

.history-number {
    font-weight: bold;
    letter-spacing: 0.5px;
}

.history-name {
    font-weight: bold;
    min-width: 180px;
}

.history-action {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 13px;
}

.history-change {
    background: #e7f1ff;
    color: #1558a6;
}

.history-cancel {
    background: #fdeaea;
    color: #b42318;
}

.history-actor {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
}

.history-admin {
    background: #eeeeee;
    color: #333333;
}

.history-user {
    background: #eef7ee;
    color: #287a2f;
}

.history-change-content {
    font-weight: bold;
}

.history-old {
    color: #666666;
}

.history-arrow {
    margin: 0 6px;
    color: #888888;
    font-weight: normal;
}

.history-new {
    color: #1558a6;
}

/* ============================================================
   管理者：履歴フィルター
   ============================================================ */

.history-filter {
    margin: 12px 0 16px;
    padding: 12px 14px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.history-filter-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.history-filter-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-filter-item label {
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

.history-filter-item input,
.history-filter-item select {
    height: 34px;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    background: #ffffff;
    font-size: 13px;
}

.history-filter-item input[type="text"] {
    width: 130px;
}

.history-filter-item input[type="date"] {
    width: 135px;
}

.history-filter-item select {
    width: 120px;
}

.history-filter-buttons {
    display: flex;
    gap: 6px;
}

.history-filter-buttons button,
.history-filter-buttons a {
    height: 34px;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 13px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 履歴フィルター：ボタンサイズ調整 */

.history-filter-buttons .secondary-button {
    min-width: 90px;
    white-space: nowrap;
    box-sizing: border-box;
}

.history-filter-buttons .primary-button {
    min-width: 75px;
    white-space: nowrap;
    box-sizing: border-box;
}

/* ============================================================
   管理者：履歴ページング
   ============================================================ */

.history-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding: 10px 2px;
}

.history-pagination-info {
    font-size: 13px;
    color: #555555;
}

.history-pagination-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-pagination-buttons .secondary-button {
    min-width: 75px;
    height: 34px;
    padding: 5px 12px;
    white-space: nowrap;
    box-sizing: border-box;
}

.history-page-number {
    min-width: 55px;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    color: #333333;
}

/* ============================================================
   予約一覧 操作ボタン
   ============================================================ */

.reservation-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.reservation-action-row {
    display: flex;
    gap: 5px;
}

.reservation-actions .button,
.reservation-actions .cancel-button {
    width: auto;
    flex: 1;
    margin: 0;
    padding: 5px 8px;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
}

.reservation-actions .status-update-form {
    display: flex;
    gap: 5px;
    margin: 0;
}

.reservation-actions .status-update-form select {
    flex: 1;
    width: auto;
    min-width: 0;
    padding: 5px 4px;
    font-size: 12px;
}

.reservation-actions .status-update-button {
    width: auto;
    padding: 5px 10px;
    font-size: 12px;
    white-space: nowrap;
}

.reservation-actions .cancel-button {
    background: #f5f5f5;
    color: #c62828;
    border: 1px solid #ddd;
}

.reservation-actions .cancel-button:hover {
    background: #ffebee;
}

/* ============================================================
   予約状況サマリー
   ============================================================ */

.reservation-summary-details {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 20px;
    flex-wrap: nowrap;
}

.reservation-summary-details
.vaccination-summary-item,
.reservation-summary-details
.status-summary-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    background: #f5f7fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    white-space: nowrap;
}

.reservation-summary-details
strong {
    font-size: 16px;
}

/* ============================================================
   予約一覧 日付ナビゲーション
   ============================================================ */

.reservation-date-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 10px 0 20px;
}

.date-navigation-button {
    display: inline-block;
    min-width: 90px;
    padding: 8px 18px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

.date-navigation-button:hover {
    background: #e8e8e8;
}

.date-navigation-button.today {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

.date-navigation-button.today:hover {
    background: #1565c0;
}

/* ============================================================
   ヘッダー コンパクト表示
   ============================================================ */

header {
    padding: 12px 15px;
}

header h1 {
    font-size: 20px;
}

header p {
    margin: 3px 0 0;
    font-size: 14px;
}

/* ============================================================
   管理者ページ 上部余白コンパクト化
   ============================================================ */

.admin-header {
    gap: 8px;
}

.admin-header h2 {
    margin: 0;
}

.admin-header p {
    margin: 3px 0;
}

.logout-button {
    padding: 6px 12px;
}

.admin-tabs {
    margin: 5px 0;
}

.admin-tab {
    padding: 6px 14px;
}

.admin-menu-buttons {
    margin: 8px 0;
    gap: 6px;
}

.admin-menu-buttons .admin-button {
    padding: 7px 12px;
}

section > hr {
    margin: 8px 0;
}

.admin-menu-buttons + h2 {
    margin-top: 8px;
    margin-bottom: 6px;
}

.admin-menu-buttons + h2 + .notice {
    margin-top: 4px;
    margin-bottom: 8px;
}

.calendar-header {
    margin: 8px 0;
}

/* ============================================================
   管理者ヘッダーナビゲーション
   ============================================================ */

.admin-header-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.admin-header-navigation > strong {
    font-size: 14px;
}

.admin-header-navigation > span {
    font-size: 13px;
    color: #555;
}

.admin-header-link {
    display: inline-block;
    padding: 5px 12px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

.admin-header-link:hover {
    background: #e8e8e8;
}

.admin-header-link.logout {
    background: #555;
    color: white;
    border-color: #555;
}

.admin-header-link.logout:hover {
    background: #444;
}