/* ======================================================
   css/admin/admin_base.css
   ------------------------------------------------------
   役割：
     フクオカギルド管理画面の共通CSS。
     admin_layout.php から読み込まれる基本スタイルを定義する。

   主な対象：
     ・管理画面全体の余白、背景、文字
     ・ヘッダー
     ・管理ナビゲーション
     ・本文カード
     ・テーブル
     ・ボタン
     ・状態表示

   方針：
     ・各ページ固有CSSに頼りすぎない
     ・管理画面の見た目を統一する
     ・一覧、編集、削除、CSV取込で再利用しやすくする
   ====================================================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f6f7f8;
    color: #222;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

a {
    color: #0758a8;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ======================================================
   管理画面レイアウト
   ====================================================== */

.fg-admin-shell {
    max-width: none;
    margin: 0;
    padding: 24px 20px;
}

.fg-admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.fg-admin-title {
    margin: 0;
    font-size: 28px;
    line-height: 1.25;
    font-weight: 700;
}

.fg-admin-subtitle {
    margin: 6px 0 0;
    color: #555;
}

.fg-admin-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.fg-admin-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid #cfd6dd;
    border-radius: 8px;
    background: #fff;
    color: #222;
    font-size: 13px;
}

.fg-admin-nav a:hover {
    background: #eef4fb;
    text-decoration: none;
}

.fg-admin-main {
    display: grid;
    gap: 16px;
}

/* ======================================================
   共通カード
   ====================================================== */

.fg-card {
    background: #fff;
    border: 1px solid #dfe3e6;
    border-radius: 10px;
    padding: 14px;
}

.fg-card-title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
}

.fg-card-subtitle {
    margin: -6px 0 12px;
    color: #666;
    font-size: 13px;
}

/* ======================================================
   テーブル
   ====================================================== */

.fg-table-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid #dfe3e6;
    border-radius: 10px;
}

.fg-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.fg-table th,
.fg-table td {
    border-bottom: 1px solid #e4e7ea;
    padding: 8px 10px;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fg-table th {
    background: #f0f2f4;
    font-weight: 700;
}

.fg-table tr:hover td {
    background: #f8fbff;
}

/* ======================================================
   ボタン
   ====================================================== */

.fg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.fg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid #cfd6dd;
    border-radius: 8px;
    background: #fff;
    color: #222;
    font-size: 13px;
    cursor: pointer;
}

.fg-btn:hover {
    background: #eef4fb;
    text-decoration: none;
}

.fg-btn-primary {
    border-color: #1f6fb2;
    background: #1f6fb2;
    color: #fff;
}

.fg-btn-primary:hover {
    background: #185f99;
}

.fg-btn-danger {
    border-color: #b42318;
    background: #b42318;
    color: #fff;
}

.fg-btn-danger:hover {
    background: #941b12;
}

/* ======================================================
   状態表示
   ====================================================== */

.fg-status-ok {
    color: #007a3d;
    font-weight: 700;
}

.fg-status-ng {
    color: #b00020;
    font-weight: 700;
}

.fg-note {
    color: #666;
    font-size: 13px;
}

/* ======================================================
   フォーム
   ====================================================== */

.fg-form {
    display: grid;
    gap: 14px;
}

.fg-form-row {
    display: grid;
    gap: 6px;
}

.fg-label {
    font-weight: 700;
}

.fg-input,
.fg-select,
.fg-textarea {
    width: 100%;
    max-width: 720px;
    padding: 8px 10px;
    border: 1px solid #cfd6dd;
    border-radius: 8px;
    background: #fff;
    font: inherit;
}

.fg-textarea {
    min-height: 120px;
    resize: vertical;
}

/* ======================================================
   小画面
   ====================================================== */

@media (max-width: 800px) {
    .fg-admin-shell {
        width: min(100% - 24px, 1480px);
        padding-top: 18px;
    }

    .fg-admin-header {
        display: grid;
        gap: 14px;
    }

    .fg-admin-nav {
        justify-content: flex-start;
    }

    .fg-admin-title {
        font-size: 24px;
    }
}
/* ======================================================
   ログアウトフォーム
   ====================================================== */

.fg-admin-logout-form {
    margin: 0;
}

.fg-admin-logout-button {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid #b42318;
    border-radius: 8px;
    background: #fff;
    color: #b42318;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}

.fg-admin-logout-button:hover {
    background: #fff2f0;
}
/* ======================================================
   管理一覧：固定カラム + 2画面切替
====================================================== */

.fg-table-wrap {
    overflow-x: auto;
}

.fg-admin-fixed-table {
    table-layout: fixed;
    min-width: 1200px;
}

.fg-admin-fixed-table th,
.fg-admin-fixed-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fg-admin-fixed-table .fg-fixed-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
}

.fg-admin-fixed-table thead .fg-fixed-col {
    z-index: 3;
    background: #f6f7f8;
}
/* ======================================================
   管理一覧：2画面運用・横スクロール抑制
====================================================== */

.fg-table-wrap {
    width: 100%;
    overflow-x: hidden;
}

.fg-admin-fixed-table {
    width: 100%;
    table-layout: fixed;
}

.fg-admin-fixed-table th,
.fg-admin-fixed-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 操作列 */
.fg-col-actions {
    width: 120px;
    white-space: nowrap;
}

/* 小さい項目 */
.fg-col-id {
    width: 52px;
}

.fg-col-ward {
    width: 64px;
}

.fg-col-public_status,
.fg-col-vacancy_status,
.fg-col-capacity {
    width: 84px;
}

.fg-col-mon_status,
.fg-col-tue_status,
.fg-col-wed_status,
.fg-col-thu_status,
.fg-col-fri_status,
.fg-col-sat_status,
.fg-col-sun_status {
    width: 48px;
}

/* 中くらい */
.fg-col-tel,
.fg-col-fax,
.fg-col-contact_tel {
    width: 110px;
}

.fg-col-care_service_code {
    width: 110px;
}

.fg-col-service_category,
.fg-col-facility_category,
.fg-col-care_facility_category,
.fg-col-short_stay_category,
.fg-col-employment_type,
.fg-col-job_title,
.fg-col-room_type {
    width: 120px;
}

/* 日付 */
.fg-col-updated_at,
.fg-col-created_at,
.fg-col-deleted_at,
.fg-col-confirmed_at,
.fg-col-source_updated_at {
    width: 130px;
}

/* 名称系 */
.fg-col-name,
.fg-col-service_name,
.fg-col-facility_name,
.fg-col-business_name {
    width: 180px;
}

/* やや長い項目 */
.fg-col-address,
.fg-col-address_raw,
.fg-col-target_area,
.fg-col-transport_area,
.fg-col-available_days,
.fg-col-available_time,
.fg-col-business_hours,
.fg-col-closed_days,
.fg-col-work_hours,
.fg-col-holidays,
.fg-col-salary_text,
.fg-col-qualification {
    width: 120px;
}

/* 長文系 */
.fg-col-admin_memo,
.fg-col-acceptance_notes,
.fg-col-remarks,
.fg-col-features,
.fg-col-service_summary,
.fg-col-job_description,
.fg-col-benefits,
.fg-col-use_conditions {
    width: 180px;
}

/* ======================================================
   管理一覧：セル全文ツールチップ（共通）
====================================================== */

.fg-table-wrap {
    overflow: visible;
}

/* ======================================================
   管理一覧：操作リンク
====================================================== */

.fg-action-links {
    display: grid;
    gap: 2px;
    line-height: 1.35;
}

.fg-action-links a {
    font-size: 13px;
}

.fg-action-separator {
    color: #999;
    margin: 0 2px;
}
/* ======================================================
   管理一覧：並び替えリンク
====================================================== */

.fg-sort-link {
    color: inherit;
    text-decoration: none;
    display: inline-block;
    max-width: 100%;
}

.fg-sort-link:hover {
    text-decoration: underline;
}
/* ======================================================
   管理一覧：ビュー切替 + ページ送り
====================================================== */

.fg-list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
    margin: 14px 0 12px;
}

.fg-list-view-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.fg-list-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
    text-align: right;
}

.fg-list-pagination-text {
    color: #555;
    font-size: 13px;
    white-space: nowrap;
}
/* ======================================================
   管理一覧：検索フォーム
====================================================== */

.fg-list-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0 14px;
}

.fg-list-search-input {
    min-width: 320px;
    max-width: 520px;
    width: 38vw;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #cfd6dd;
    border-radius: 8px;
    font-size: 14px;
}

.fg-list-search-input:focus {
    outline: none;
    border-color: #1f6fb2;
    box-shadow: 0 0 0 2px rgba(31, 111, 178, 0.12);
}
.fg-list-search-select {
    min-width: 200px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #cfd6dd;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
}

.fg-list-search-select:focus {
    outline: none;
    border-color: #1f6fb2;
    box-shadow: 0 0 0 2px rgba(31, 111, 178, 0.12);
}

/* ======================================================
   管理一覧：曜日カラムだけを細く固定
   ------------------------------------------------------
   介護保険サービスの2画面目で、月〜日カラムが広がりすぎるのを防ぐ。
   カラムは減らさず、曜日幅だけを圧縮する。
====================================================== */

.fg-table.fg-admin-fixed-table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
}

/* 月〜日・祝 */
.fg-table.fg-admin-fixed-table col.fg-col-monday,
.fg-table.fg-admin-fixed-table col.fg-col-tuesday,
.fg-table.fg-admin-fixed-table col.fg-col-wednesday,
.fg-table.fg-admin-fixed-table col.fg-col-thursday,
.fg-table.fg-admin-fixed-table col.fg-col-friday,
.fg-table.fg-admin-fixed-table col.fg-col-saturday,
.fg-table.fg-admin-fixed-table col.fg-col-sunday,
.fg-table.fg-admin-fixed-table col.fg-col-holiday {
    width: 25px !important;
}

.fg-table.fg-admin-fixed-table th.fg-col-monday,
.fg-table.fg-admin-fixed-table td.fg-col-monday,
.fg-table.fg-admin-fixed-table th.fg-col-tuesday,
.fg-table.fg-admin-fixed-table td.fg-col-tuesday,
.fg-table.fg-admin-fixed-table th.fg-col-wednesday,
.fg-table.fg-admin-fixed-table td.fg-col-wednesday,
.fg-table.fg-admin-fixed-table th.fg-col-thursday,
.fg-table.fg-admin-fixed-table td.fg-col-thursday,
.fg-table.fg-admin-fixed-table th.fg-col-friday,
.fg-table.fg-admin-fixed-table td.fg-col-friday,
.fg-table.fg-admin-fixed-table th.fg-col-saturday,
.fg-table.fg-admin-fixed-table td.fg-col-saturday,
.fg-table.fg-admin-fixed-table th.fg-col-sunday,
.fg-table.fg-admin-fixed-table td.fg-col-sunday,
.fg-table.fg-admin-fixed-table th.fg-col-holiday,
.fg-table.fg-admin-fixed-table td.fg-col-holiday {
    width: 25px !important;
    min-width: 25px !important;
    max-width: 25px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    text-align: center !important;
}
/* ======================================================
   操作ログ：一覧表示調整
====================================================== */

.fg-log-cell-nowrap {
    white-space: nowrap;
}

.fg-log-cell-wrap {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.fg-log-detail {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.6;
}
/* ======================================================
   操作ログ：詳細カラム折り返し表示
====================================================== */

.fg-table td.fg-log-detail {
    width: 320px !important;
    max-width: 320px !important;

    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;

    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    line-height: 1.6;
}
/* ======================================================
   管理一覧：固定幅テーブル + 長文セル省略
   ------------------------------------------------------
   colgroup の width を優先し、セル本文で列幅が広がらないようにする。
   本文は省略表示、全文は独自ツールチップで確認する。
====================================================== */

.fg-table.fg-admin-fixed-table {
    table-layout: fixed;
}

.fg-table.fg-admin-fixed-table td,
.fg-table.fg-admin-fixed-table th {
    box-sizing: border-box;
}

.fg-table.fg-admin-fixed-table .fg-cell-ellipsis {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
/* ======================================================
   管理一覧：独自ツールチップ
   ------------------------------------------------------
   セル本文は省略表示、全文は黒いツールチップで表示する。
====================================================== */

.fg-tooltip-cell {
    position: relative;
}

.fg-tooltip-cell:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 8px;
    top: calc(100% + 6px);
    z-index: 1000;

    max-width: 420px;
    min-width: 160px;
    padding: 8px 10px;

    color: #fff;
    background: rgba(17, 24, 39, 0.95);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);

    font-size: 12px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
    pointer-events: none;
}

.fg-tooltip-cell:hover::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 100%;
    z-index: 1001;

    border-width: 0 6px 6px 6px;
    border-style: solid;
    border-color: transparent transparent rgba(17, 24, 39, 0.95) transparent;
}

/* ======================================================
   管理一覧：省略本文 + 黒ツールチップの両立
   ------------------------------------------------------
   td本体はツールチップを外に出すため visible。
   文字列の省略は中の span.fg-cell-ellipsis 側で行う。
====================================================== */

.fg-table.fg-admin-fixed-table td.fg-tooltip-cell {
    position: relative;
    overflow: visible !important;
}

.fg-table.fg-admin-fixed-table td.fg-tooltip-cell .fg-cell-ellipsis {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.fg-table.fg-admin-fixed-table td.fg-tooltip-cell:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 8px;
    top: calc(100% + 6px);
    z-index: 9999;

    max-width: 420px;
    min-width: 160px;
    padding: 8px 10px;

    color: #fff;
    background: rgba(17, 24, 39, 0.95);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);

    font-size: 12px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
    pointer-events: none;
}

.fg-table.fg-admin-fixed-table td.fg-tooltip-cell:hover::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 100%;
    z-index: 10000;

    border-width: 0 6px 6px 6px;
    border-style: solid;
    border-color: transparent transparent rgba(17, 24, 39, 0.95) transparent;
}
.fg-table.fg-admin-fixed-table td.fg-tooltip-cell:hover::after {
    white-space: pre-line;
    line-height: 1.7;
}

/* ======================================================
   business/login.php
   事業所ログイン画面用
   中央寄せシンプルレイアウト
====================================================== */
.business-login-page {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.business-login-card {
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
    padding: 28px 24px;
}

.business-login-title {
    margin: 0 0 8px;
    font-size: 1.9rem;
    font-weight: 700;
    text-align: center;
    color: #101828;
}

.business-login-subtitle {
    margin: 0 0 24px;
    text-align: center;
    color: #475467;
    font-size: 0.95rem;
}

.business-login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.business-login-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    color: #344054;
}

.business-login-field input[type="text"],
.business-login-field input[type="password"] {
    width: 100%;
    height: 44px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    padding: 0 12px;
    font-size: 1rem;
    box-sizing: border-box;
}

.business-login-field input:focus {
    outline: none;
    border-color: #175cd3;
    box-shadow: 0 0 0 3px rgba(23, 92, 211, 0.12);
}

.business-login-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.business-login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border: none;
    border-radius: 10px;
    background: #175cd3;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.business-login-button:hover {
    opacity: 0.92;
}

.business-login-links {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.business-login-links a {
    color: #175cd3;
    text-decoration: none;
    font-weight: 700;
}
    
.business-login-links a:hover {
    text-decoration: underline;
}

.business-login-error {
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fef3f2;
    border: 1px solid #fecdca;
    color: #b42318;
    font-size: 0.92rem;
}
/* ======================================================
   管理トップ：カード横並びレイアウト
====================================================== */
.fg-dashboard-card-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 16px;
    align-items: stretch;
}

.fg-dashboard-card-grid .fg-card {
    margin-top: 0;
}

.fg-dashboard-logout-form {
    display: inline-flex;
    margin: 0;
}

/* スマホでは縦並び */
@media (max-width: 800px) {
    .fg-dashboard-card-grid {
        grid-template-columns: 1fr;
    }
}