/* =========================================================
   SHOJIN 共通CSS (app.css)
   各テンプレートに直書きされていた<style>を集約したもの。
   layout/default.php の Html->css() に 'app' を追加して読み込む。
   ========================================================= */

:root {
    --shortage-bg: #fdecea;
    --shortage-color: #c0392b;
    --border-color: #ddd;
}

html,
body,
h1, h2, h3, h4, h5, h6,
button, input, select, textarea,
.button {
    font-family: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
}

/* ---------------------------------------------------------
   見出し共通
   --------------------------------------------------------- */
h1.page-title {
    font-size: 20px;
    font-weight: bold;
    margin: 0 0 16px;
}
h1.page-title.schedule-date {
    font-size: 16px;
    margin-bottom: 8px;
}
.schedule-goen-name {
    font-size: 16px;
    color: #555;
    margin-bottom: 20px;
}

h2 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #444;
    margin: 24px 0 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #2d6cdf;
    display: inline-block;
}

/* ---------------------------------------------------------
   共通データテーブル（Goens/index, Members/index, Users/index）
   --------------------------------------------------------- */
table.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}
table.data-table th,
table.data-table td {
    border: 1px solid var(--border-color);
    padding: 6px 8px;
    text-align: left;
}
table.data-table th {
    background: #f2f2f2;
}
table.data-table tr.hidden-row {
    color: #999;
    background: #fafafa;
}
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.status-badge.status-visible {
    background: #e6f4ea;
    color: #1e7e34;
}
.status-badge.status-hidden {
    background: #eee;
    color: #888;
}
table.data-table .actions a,
table.data-table .actions button {
    min-height: 36px;
    margin-right: 4px;
}
table.data-table td a {
    margin-right: 8px;
    font-weight: 600;
    text-decoration: none;
}
table.data-table td a.link-edit {
    color: #2d6cdf;
}
table.data-table td a.link-restore {
    color: #1e7e34;
}
table.data-table td a.link-hide {
    color: #c0392b;
}
table.data-table td a:hover {
    text-decoration: underline;
}

/* ---------------------------------------------------------
   ツールバー（検索・追加リンクなどを横並びにする行）
   --------------------------------------------------------- */
.toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.toolbar input[type="text"] {
    min-height: 40px;
    padding: 6px;
}

/* ---------------------------------------------------------
   ページネーション（Members一覧など）
   --------------------------------------------------------- */
.pagination-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin: 16px 0 4px;
}
.pagination-bar ul {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.pagination-bar a,
.pagination-bar li {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 0 8px;
    border-radius: 4px;
    text-decoration: none;
    color: #2d6cdf;
    font-size: 13px;
}
.pagination-bar .active a,
.pagination-bar .active {
    background: #2d6cdf;
    color: #fff;
}
.pagination-bar .disabled {
    color: #bbb;
}
.pagination-counter {
    font-size: 12px;
    color: #666;
    margin: 0 0 16px;
}

/* ---------------------------------------------------------
   共通ナビ（templates/element/nav.php）
   --------------------------------------------------------- */
.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px;
    background: #2c3e50;
    color: #fff;
    margin-bottom: 16px;
}
.site-nav .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.site-nav a {
    color: #fff;
    text-decoration: none;
    padding: 8px 10px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    border-radius: 4px;
}
.site-nav a:hover,
.site-nav a.active {
    background: rgba(255, 255, 255, 0.15);
}
.site-nav .nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #ddd;
}
.site-nav .nav-user a {
    color: #fff;
    min-height: auto;
    padding: 4px 8px;
}

.mobile-user-bar { display: none; }
.bottom-tab-nav { display: none; }

@media (max-width: 768px) {
    .site-nav .nav-links { display: none; }
    .site-nav .nav-user { display: none; }

    .mobile-user-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 6px 12px;
        background: #2c3e50;
        color: #ddd;
        font-size: 12px;
    }
    .mobile-user-bar a {
        color: #fff;
        text-decoration: none;
        padding: 6px 8px;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
    }

    body {
        padding-bottom: 64px;
    }

    .bottom-tab-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        background: #fff;
        border-top: 1px solid #ddd;
        box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.06);
    }
    .bottom-tab-nav a {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        min-height: 56px;
        padding: 6px 2px;
        color: #7a7a7a;
        text-decoration: none;
        font-size: 10px;
        line-height: 1.2;
    }
    .bottom-tab-nav a svg {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
    .bottom-tab-nav a.active {
        color: #2d6cdf;
    }
}

/* ---------------------------------------------------------
   ログイン画面（templates/Users/login.php）
   --------------------------------------------------------- */
.login-wrap {
    max-width: 360px;
    margin: 60px auto;
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.login-wrap h1 {
    font-size: 18px;
    margin-bottom: 16px;
    text-align: center;
}
.login-wrap input {
    width: 100%;
    min-height: 48px;
    padding: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    box-sizing: border-box;
}
.login-wrap button {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
}

/* ---------------------------------------------------------
   スケジュール一覧（templates/Schedules/index.php）
   --------------------------------------------------------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    margin-bottom: 16px;
}
.filter-bar > * {
    margin: 0;
}
.filter-bar select,
.filter-bar input[type="month"] {
    min-height: 48px;
    padding: 8px;
    font-size: 14px;
    box-sizing: border-box;
}
.filter-bar label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 48px;
    margin: 0;
}
.filter-bar input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}
.filter-bar a {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
}

.header-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.area-card {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    min-width: 140px;
    flex: 0 0 auto;
}
.area-card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    background: #f2f2f2;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    font-weight: bold;
    font-size: 13px;
}
.area-card-head .area-total {
    color: #2d6cdf;
    font-size: 14px;
}
.area-card-body {
    padding: 0;
}
.area-card-body .block-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 10px;
    font-size: 12px;
    color: #555;
    border-bottom: 1px solid #eee;
}
.area-card-body .block-row:last-child {
    border-bottom: none;
}

@media (max-width: 768px) {
    .header-totals {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .area-card {
        min-width: 120px;
    }
}

.schedule-table-wrap { display: block; }
table.schedule-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}
table.schedule-table th,
table.schedule-table td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: left;
    vertical-align: top;
}
table.schedule-table th {
    background: #f2f2f2;
    position: sticky;
    top: 0;
}
table.schedule-table th:first-child,
table.schedule-table td:first-child {
    position: sticky;
    left: 0;
    background: #fff;
}
tr.shortage-row { background: var(--shortage-bg); }
.shortage-label {
    color: var(--shortage-color);
    font-weight: bold;
    margin-left: 4px;
}
.entry-time { color: #666; font-size: 12px; }

.schedule-cards { display: none; }
.location-heading {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #444;
    margin: 16px 0 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #2d6cdf;
    display: inline-block;
}
.schedule-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}
.schedule-card.shortage { background: var(--shortage-bg); border-color: var(--shortage-color); }
.schedule-card .card-top {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-bottom: 6px;
}
.schedule-card .card-entries { font-size: 14px; line-height: 1.6; }
.schedule-card a.edit-link {
    display: inline-block;
    min-height: 48px;
    line-height: 48px;
    padding: 0 12px;
}

@media (max-width: 768px) {
    .schedule-table-wrap { display: none; }
    .schedule-cards { display: block; }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
@media (max-width: 480px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    .image-generate-wrap {
        justify-content: flex-end;
    }
}
.page-header h1 {
    margin: 0;
}

/* ---------------------------------------------------------
   画像データ / スマホ用 生成ボタン
   --------------------------------------------------------- */
.btn-generate-image {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    width: auto;
    height: 44px;
    margin: 0;
    padding: 0 20px;
    border: 1.5px solid transparent;
    border-radius: 8px;
    outline: none;
    text-decoration: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 42px;
    white-space: nowrap;
    cursor: pointer;
    vertical-align: middle;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn-generate-image:active {
    transform: translateY(1px) scale(0.98);
}
.btn-generate-image:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.btn-generate-image::before {
    content: '';
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}
#btn-generate-summary::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8'/%3E%3Cpolyline points='16 6 12 2 8 6'/%3E%3Cline x1='12' y1='2' x2='12' y2='15'/%3E%3C/svg%3E");
}
#btn-generate-mobile::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232d6cdf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='7' y='2' width='10' height='20' rx='2'/%3E%3Cline x1='11' y1='18' x2='13' y2='18'/%3E%3C/svg%3E");
}

#btn-generate-summary {
    background: linear-gradient(135deg, #2d6cdf, #1e56b8);
    color: #fff;
    box-shadow: 0 2px 6px rgba(45, 108, 223, 0.35);
}
#btn-generate-summary:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(45, 108, 223, 0.45);
    transform: translateY(-1px);
}

#btn-generate-mobile {
    background: #fff;
    color: #2d6cdf;
    border: 1.5px solid #2d6cdf;
}
#btn-generate-mobile:hover:not(:disabled) {
    background: #eef4fe;
    box-shadow: 0 2px 8px rgba(45, 108, 223, 0.15);
    transform: translateY(-1px);
}

.image-generate-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}
.generate-progress {
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}
.generate-progress-bar {
    width: 80px;
    height: 8px;
    border-radius: 4px;
    background: #eee;
    overflow: hidden;
    position: relative;
}
.generate-progress-bar::after {
    content: '';
    position: absolute;
    left: -40%;
    width: 40%;
    height: 100%;
    background: #2d6cdf;
    animation: generate-progress-slide 1.1s infinite ease-in-out;
}
@keyframes generate-progress-slide {
    0% { left: -40%; }
    100% { left: 100%; }
}

/* ---------------------------------------------------------
   スケジュール編集（templates/Schedules/edit.php）
   --------------------------------------------------------- */
.schedule-meta {
    background: #f7f7f7;
    border: 1px solid var(--border-color);
    padding: 12px;
    margin-bottom: 16px;
}
.schedule-meta.shortage { border-color: var(--shortage-color); background: var(--shortage-bg); }
.field-row { margin-bottom: 10px; }
.field-row label { display: inline-block; width: 100px; }
.field-row input[type="number"],
.field-row textarea {
    min-height: 40px;
    padding: 6px;
    font-size: 14px;
}

.entry-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}
.entry-row.pending-remove { opacity: 0.4; }
.entry-row.pending-new { background: #fffbe6; }
.entry-row .member-select-wrap { flex: 0 1 280px; min-width: 200px; }
.entry-row button {
    min-height: 48px;
    min-width: 48px;
    padding: 0 12px;
    font-size: 14px;
}
.entry-row .participation-time-input {
    display: none;
    min-height: 40px;
    padding: 6px;
    width: 180px;
}
.entry-row.time-open .participation-time-input { display: inline-block; }
.pending-badge {
    font-size: 11px;
    color: #a67c00;
    background: #fff3cd;
    border-radius: 4px;
    padding: 2px 6px;
}

.confirm-bar {
    position: sticky;
    bottom: 0;
    padding: 12px 0;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.confirm-bar button {
    min-height: 48px;
    padding: 0 20px;
    font-size: 14px;
    background: #2c3e50;
    color: #fff;
    border: none;
    border-radius: 4px;
}
.confirm-bar button:disabled {
    background: #aaa;
}
.confirm-status {
    font-size: 13px;
    color: #2b8a3e;
}
.confirm-status.error { color: var(--shortage-color); }

.btn-delete-schedule {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 16px;
    font-size: 14px;
    line-height: 1;
}

.schedule-meta button {
    font-size: 14px;
}

.select2-container--default .select2-selection--single {
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
    border-radius: 4px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 46px !important;
    font-size: 15px !important;
    padding-left: 10px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 46px !important;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    line-height: 46px !important;
}
.select2-dropdown {
    font-size: 15px !important;
}
.select2-container--default .select2-results__option {
    padding: 10px 12px !important;
    min-height: 44px !important;
}
.select2-search--dropdown .select2-search__field {
    min-height: 40px !important;
    font-size: 15px !important;
    padding: 8px !important;
}
