/* ==========================================================
   page-facilities.css
   入居施設ページ専用（列幅の調整だけ）
   ========================================================== */

/* ---- 基本 ---- */
.fg-table {
    table-layout: fixed;
    width: 100%;
}

/* ==========================================================
   ▼ 未ログイン（一般公開）
   ※ 実際は 15 列ある（先頭 3 列は fg-hide で非表示）
   ========================================================== */

/* 1: ID（非表示だけどカラムとして存在） */
body:not(.admin-mode) .fg-table th:nth-child(1),
body:not(.admin-mode) .fg-table td:nth-child(1) {
    width: 3%;
}

/* 2: トークン（非表示） */
body:not(.admin-mode) .fg-table th:nth-child(2),
body:not(.admin-mode) .fg-table td:nth-child(2) {
    width: 5%;
}

/* 3: 更新日（非表示） */
body:not(.admin-mode) .fg-table th:nth-child(3),
body:not(.admin-mode) .fg-table td:nth-child(3) {
    width: 7%;
}

/* 4: カテゴリ */
body:not(.admin-mode) .fg-table th:nth-child(4),
body:not(.admin-mode) .fg-table td:nth-child(4) {
    width: 6%;
}

/* 5: 施設名 */
body:not(.admin-mode) .fg-table th:nth-child(5),
body:not(.admin-mode) .fg-table td:nth-child(5) {
    width: 18%;
}

/* 6: 住所 */
body:not(.admin-mode) .fg-table th:nth-child(6),
body:not(.admin-mode) .fg-table td:nth-child(6) {
    width: 13%;
}

/* 7: TEL */
body:not(.admin-mode) .fg-table th:nth-child(7),
body:not(.admin-mode) .fg-table td:nth-child(7) {
    width: 7%;
}

/* 8: 空き */
body:not(.admin-mode) .fg-table th:nth-child(8),
body:not(.admin-mode) .fg-table td:nth-child(8) {
    width: 5%;
}

/* 9: 個室/夫婦 */
body:not(.admin-mode) .fg-table th:nth-child(9),
body:not(.admin-mode) .fg-table td:nth-child(9) {
    width: 5%;
}

/* 10: 初期費用 */
body:not(.admin-mode) .fg-table th:nth-child(10),
body:not(.admin-mode) .fg-table td:nth-child(10) {
    width: 5%;
}

/* 11: 月額 */
body:not(.admin-mode) .fg-table th:nth-child(11),
body:not(.admin-mode) .fg-table td:nth-child(11) {
    width: 5%;
}

/* 12: 受入 */
body:not(.admin-mode) .fg-table th:nth-child(12),
body:not(.admin-mode) .fg-table td:nth-child(12) {
    width: 8%;
}

/* 13: 生活保護 */
body:not(.admin-mode) .fg-table th:nth-child(13),
body:not(.admin-mode) .fg-table td:nth-child(13) {
    width: 5%;
}

/* 14: 備考 */
body:not(.admin-mode) .fg-table th:nth-child(14),
body:not(.admin-mode) .fg-table td:nth-child(14) {
    width: 5%;
}

/* 15: WEB */
body:not(.admin-mode) .fg-table th:nth-child(15),
body:not(.admin-mode) .fg-table td:nth-child(15) {
    width: 2%;
}


/* ==========================================================
   ▼ 管理者モード（.admin-mode）15列
   ========================================================== */

/* --- 管理者の最初の3列（ID, token, next_update） --- */
body.admin-mode .fg-table th:nth-child(1),
body.admin-mode .fg-table td:nth-child(1) {
    width: 5%;   /* ID */
}

body.admin-mode .fg-table th:nth-child(2),
body.admin-mode .fg-table td:nth-child(2) {
    width: 10%;  /* トークン */
}

body.admin-mode .fg-table th:nth-child(3),
body.admin-mode .fg-table td:nth-child(3) {
    width: 10%;  /* 更新日 */
}


/* --- 通常列（12列） --- */
body.admin-mode .fg-table th:nth-child(4),
body.admin-mode .fg-table td:nth-child(4) {
    width: 7%;   /* カテゴリ */
}

body.admin-mode .fg-table th:nth-child(5),
body.admin-mode .fg-table td:nth-child(5) {
    width: 15%;  /* 施設名 */
}

body.admin-mode .fg-table th:nth-child(6),
body.admin-mode .fg-table td:nth-child(6) {
    width: 15%;  /* 住所 */
}

body.admin-mode .fg-table th:nth-child(7),
body.admin-mode .fg-table td:nth-child(7) {
    width: 7%;   /* TEL */
}

body.admin-mode .fg-table th:nth-child(8),
body.admin-mode .fg-table td:nth-child(8) {
    width: 6%;   /* 空き */
}

body.admin-mode .fg-table th:nth-child(9),
body.admin-mode .fg-table td:nth-child(9) {
    width: 6%;   /* 個室/夫婦 */
}

body.admin-mode .fg-table th:nth-child(10),
body.admin-mode .fg-table td:nth-child(10) {
    width: 7%;   /* 初期費用 */
}

body.admin-mode .fg-table th:nth-child(11),
body.admin-mode .fg-table td:nth-child(11) {
    width: 7%;   /* 月額 */
}

body.admin-mode .fg-table th:nth-child(12),
body.admin-mode .fg-table td:nth-child(12) {
    width: 12%;   /* 受入 */
}

body.admin-mode .fg-table th:nth-child(13),
body.admin-mode .fg-table td:nth-child(13) {
    width: 6%;   /* 生活保護 */
}

body.admin-mode .fg-table th:nth-child(14),
body.admin-mode .fg-table td:nth-child(14) {
    width: 6%;   /* 備考 */
}

body.admin-mode .fg-table th:nth-child(15),
body.admin-mode .fg-table td:nth-child(15) {
    width: 4%;   /* WEB */
}

/* =============================================
   施設ページ専用：標準モーダルUI（共通仕様）
============================================= */

.fg-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.fg-modal.open {
    display: flex;
}

.fg-modal-content {
    background: #fff;
    width: 540px; /* 施設は項目多いので少し広げる */
    padding: 28px 32px;
    border-radius: 12px;

    border: 1px solid #dadada;
    box-shadow: 0px 4px 16px rgba(0,0,0,0.08);
}

.fg-modal-title {
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 24px;
    color: #333;
}

.fg-modal-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.fg-modal-row label {
    width: 120px; /* ← 項目が多い施設ページは少し広めにする */
    font-size: 13px;
    font-weight: bold;
    color: #555;
    text-align: right;
}

.fg-modal-row input,
.fg-modal-row textarea,
.fg-modal-row select {
    flex: 1;
    padding: 8px 10px;
    font-size: 14px;

    background: #fafafa;
    border: 1px solid #ccc;
    border-radius: 6px;

    transition: border-color 0.2s, background 0.2s;
}

.fg-modal-row textarea {
    height: 80px;
    resize: vertical;
}

.fg-modal-buttons {
    margin-top: 24px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.fg-modal-buttons button {
    flex: 1;
    padding: 8px 0;
    font-size: 14px;

    border-radius: 6px;
    border: 1px solid #bbb;
    background: #f7f7f7;

    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.fg-btn-save {
    background: #dfefff;
    border-color: #8fb6ff;
}

.fg-btn-delete {
    background: #ffe0e0;
    border-color: #ff9999;
}
.fg-modal-content {
    background: #fff;
    width: 540px;
    padding: 28px 32px;
    border-radius: 12px;
    border: 1px solid #dadada;
    box-shadow: 0px 4px 16px rgba(0,0,0,0.08);

    /* ▼ 追加（スクロール可能にする） */
    max-height: 85vh;
    overflow-y: auto;
}
.fg-table td[title] {
    position: relative;
    cursor: pointer; /* これ重要。Safariでtooltipが出る */
}
.fg-tip { position: relative; }

.fg-tip:hover::after {
    content: attr(data-full);
    display: block;
    position: absolute;
    top: -4px;
    left: 105%;
    white-space: normal;
    padding: 6px 10px;
    max-width: 260px;

    background: #333;
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;

    z-index: 999;
    opacity: 0;
    animation: fg-tip-fade 0.15s forwards;
}

.fg-tip:hover::before {
    content: "";
    position: absolute;
    top: 4px;
    left: calc(105% - 6px);
    width: 0; height: 0;
    border-left: 6px solid #333;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

@keyframes fg-tip-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}


/* モーダル内の行を完全に非表示にする */
.fg-modal-row.hidden-field {
    display: none !important;
}
