/*
 * 管理者用ページ（ログイン・ユーザ画面・ユーザー追加・CSV結合・結合結果）の共通調整（2026-10-01）
 * 各ページ固有の CSS の後に読み込み、スマホ幅でも読みやすく・押しやすくする。
 */
*, *::before, *::after { box-sizing: border-box; }

body { -webkit-text-size-adjust: 100%; overflow-wrap: anywhere; }

/* 入力欄は 16px 以上（iPhone で入力時に画面が拡大されないように） */
input[type="text"],
input[type="password"],
input[type="file"],
select { font-size: 16px; max-width: 100%; }

/* ボタン・リンクを指で押しやすい高さに */
button,
a.button,
.form-button,
.map-button,
#home-button,
#user-button,
.action-links a {
    min-height: 44px;
}
.action-links a,
.login-container p > a,
.container > p > a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; }

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 3px solid #ffb300;
    outline-offset: 2px;
}

/* ---------- スマホ（〜599px） ---------- */
@media (max-width: 599px) {
    body { padding: 12px !important; align-items: flex-start !important; }
    .container,
    .login-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 20px 16px !important;
        margin: 0 auto !important;
    }
    h1 { font-size: 1.4rem !important; }
    h2 { font-size: 1.3rem !important; margin-bottom: 16px !important; }

    /* 下部のボタンは縦に並べ、横幅いっぱいに */
    .header-actions,
    .button-actions {
        flex-direction: column !important;
        gap: 10px !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    .header-actions a,
    .button-actions a {
        width: 100% !important;
        justify-content: center;
        text-align: center;
        display: flex !important;
        align-items: center;
    }
    #description-container { font-size: 0.95rem; }
}

/* ---------- ボタンの統一（2026-10-02） ----------
 *   主ボタン（緑の塗り）  ：そのページでいちばん大事な操作（ログイン・追加する・結合して保存・地図で確認する）
 *   副ボタン（青の枠線）  ：別の作業へ進む（管理メニューの各項目、結果画面の次の操作）
 *   戻るリンク（文字）    ：各ページの下に「管理メニューに戻る」を同じ形で置く
 *   ログアウト（灰の枠線）：管理メニューの下にだけ置く
 * 各ページ固有の CSS より詳細度を上げるため html body を付けている。 */
html body .btn { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    width: 100%; min-height: 48px; padding: 10px 16px; border-radius: 6px; font-size: 1rem; font-weight: bold;
    text-decoration: none; cursor: pointer; box-shadow: none; transition: background-color 0.2s; }
html body .btn-primary { background: #28a745; color: #fff; border: none; }
html body .btn-primary:hover { background: #218838; }
html body .btn-secondary { background: #fff; color: #0056b3; border: 2px solid #007bff; }
html body .btn-secondary:hover { background: #eef5ff; }
html body .btn-quiet { background: #fff; color: #555; border: 1px solid #aaa; width: auto; min-width: 140px; display: inline-flex; }
html body .btn-quiet:hover { background: #f3f3f3; }
html body .btn .btn-sub { font-size: 0.8rem; font-weight: normal; opacity: 0.85; margin-top: 2px; }
.admin-back { text-align: center; margin: 24px 0 0; }
.admin-back a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: #555; }
.admin-back a::before { content: "←"; margin-right: 6px; }
html body .admin-back a { color: #555; text-decoration: none; }
html body .admin-back a:hover { text-decoration: underline; }

/* ---------- 管理画面の共通ヘッダー・フッター（2026-10-02） ----------
 * 各ページの CSS は body を中央寄せにしているため、admin-page では上から並べる形に直す。 */
html body.admin-page {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    min-height: 100vh;
    margin: 0;
    padding: 0 !important;
}
.admin-header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
    padding: 8px 20px; background: #fff; border-bottom: 1px solid #e3d9d2; box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.admin-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; }
.admin-brand img { height: 30px; width: auto; display: block; }
.admin-badge { font-size: 0.8rem; font-weight: bold; color: #555; background: #f1f1f1; border-radius: 4px; padding: 2px 8px; }
.admin-user { display: inline-flex; align-items: center; gap: 12px; font-size: 0.9rem; color: #555; }
.admin-logout { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border: 1px solid #aaa; border-radius: 4px; color: #555; text-decoration: none; background: #fff; }
.admin-logout:hover { background: #f3f3f3; }
.admin-main { flex: 1 0 auto; width: 100%; padding: 32px 16px; display: flex; flex-direction: column; align-items: center; }
.admin-main > .container { margin: 0 auto !important; width: 100%; }
.admin-footer { padding: 14px 16px 18px; text-align: center; font-size: 0.8rem; color: #777; background: #f3efec; border-top: 1px solid #e3d9d2; }
.admin-footer p { margin: 2px 0; }
.admin-footer a { color: #666; margin: 0 8px; display: inline-flex; align-items: center; min-height: 32px; }
@media (max-width: 599px) {
    .admin-header { padding: 6px 12px; }
    .admin-name { display: none; } /* スマホではログアウトだけ残す */
    .admin-main { padding: 12px !important; }
}
