/* ==========================================================================
   Corporate Web App Gallery - style.css
   白基調のコーポレートデザイン。カード型UI・落ち着いたグレー・余白を重視。
   アクセントカラーは --accent（PHP 側で :root に注入）に集約。
   ※ グラデーション / ネオン / 派手なアニメーション / 絵文字は不使用。
   ========================================================================== */

:root {
    --accent: #3dbbc3;               /* 既定値（PHP が上書き） */
    --color-bg: #f5f6f7;
    --color-surface: #ffffff;
    --color-border: #e2e4e7;
    --color-border-strong: #d0d3d7;
    --color-text: #2b2f33;
    --color-text-sub: #6b7178;
    --color-text-muted: #9aa0a6;
    --color-danger: #c0392b;
    --color-danger-bg: #fdecea;
    --color-success: #1e7e5a;
    --color-success-bg: #e8f5ee;
    --color-info-bg: #eef6f7;
    --radius: 8px;
    --radius-sm: 5px;
    --shadow: 0 1px 2px rgba(20, 24, 28, .05), 0 1px 3px rgba(20, 24, 28, .04);
    --shadow-hover: 0 4px 14px rgba(20, 24, 28, .08);
    --maxw: 1120px;
    --font: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic",
            "Meiryo", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
}

code {
    background: #f0f2f4;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: .88em;
    font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
    color: #444;
}

/* ---- ヘッダ / ナビ ------------------------------------------------------- */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--color-text);
    font-size: 16px;
}
.brand:hover { text-decoration: none; }
.brand__mark {
    width: 18px; height: 18px;
    border-radius: 4px;
    background: var(--accent);
    display: inline-block;
}
.brand__text small { color: var(--color-text-muted); font-weight: 600; font-size: 12px; }

.site-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 14px;
}
.site-nav a { color: var(--color-text-sub); }
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.site-nav__user { color: var(--color-text-muted); font-size: 13px; }
.site-nav__logout { color: var(--color-text-sub); }

/* ---- ページ本体 --------------------------------------------------------- */
.page { padding-top: 28px; padding-bottom: 60px; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 20px;
}
.page-head__title { font-size: 22px; margin: 0 0 4px; }
.page-head__sub { margin: 0; color: var(--color-text-sub); font-size: 14px; }

.breadcrumb { color: var(--color-text-muted); font-size: 13px; margin: 0 0 16px; }

/* ---- フラッシュ --------------------------------------------------------- */
.flash {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid transparent;
}
.flash--success { background: var(--color-success-bg); color: var(--color-success); border-color: #bfe3d0; }
.flash--error   { background: var(--color-danger-bg);  color: var(--color-danger);  border-color: #f3c6c1; }
.flash--info    { background: var(--color-info-bg);    color: #2b6d73;               border-color: #cfe6e8; }

.error-list { margin: 0; padding-left: 18px; }
.error-list li { margin: 2px 0; }

/* ---- カードグリッド（ギャラリー）---------------------------------------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow .15s ease, transform .15s ease;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card__thumb {
    aspect-ratio: 5 / 3;
    background: #fafbfc;
    border-bottom: 1px solid var(--color-border);
    overflow: hidden;
}
.card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__body { padding: 16px; flex: 1; }
.card__title { font-size: 16px; margin: 0 0 6px; }
.card__purpose { color: var(--color-text-sub); font-size: 13px; margin: 0 0 12px; min-height: 40px; }
.card__meta { display: flex; gap: 18px; margin: 0; }
.card__meta dt { font-size: 11px; color: var(--color-text-muted); margin-bottom: 3px; letter-spacing: .04em; }
.card__meta dd { margin: 0; font-size: 13px; }
.card__category {
    display: inline-block;
    margin-top: 12px;
    font-size: 12px;
    color: var(--color-text-sub);
    background: #f0f2f4;
    border-radius: 4px;
    padding: 2px 8px;
}
.card__footer { padding: 12px 16px; border-top: 1px solid var(--color-border); }

/* ---- バッジ ------------------------------------------------------------- */
.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    line-height: 1.6;
}
.badge--active    { background: var(--color-success-bg); color: var(--color-success); border-color: #bfe3d0; }
.badge--beta      { background: #eef6f7; color: #2b6d73; border-color: #cfe6e8; }
.badge--dev       { background: #fff5e6; color: #a9761d; border-color: #f0dcb8; }
.badge--stopped   { background: #f2f3f4; color: #6b7178; border-color: #dfe1e4; }
.badge--abolished { background: #fdecea; color: var(--color-danger); border-color: #f3c6c1; }
.badge--default   { background: #f0f2f4; color: #5c6166; border-color: #dfe1e4; }

/* ---- フィルターバー ----------------------------------------------------- */
.filter-bar {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 24px;
}
.filter-bar__row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.filter-bar input[type="text"] { flex: 1 1 240px; }
.filter-bar select { flex: 0 0 auto; }

/* ---- 詳細画面 ----------------------------------------------------------- */
.detail {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 32px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}
.detail__media img {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    display: block;
}
.detail__title { font-size: 22px; margin: 0 0 12px; }
.detail__badges { display: flex; gap: 8px; margin-bottom: 20px; }
.detail__specs { margin: 0; }
.detail__specs > div {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--color-border);
}
.detail__specs dt { color: var(--color-text-muted); font-size: 13px; margin: 0; }
.detail__specs dd { margin: 0; font-size: 14px; }
.detail__actions { margin-top: 24px; display: flex; gap: 10px; }
.link-list { margin: 0; padding-left: 18px; }
.link-list li { margin: 4px 0; word-break: break-all; }

/* ---- ボタン ------------------------------------------------------------- */
.btn {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-align: center;
    line-height: 1.4;
    background: #eceef0;
    color: var(--color-text);
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { filter: brightness(.94); }
.btn--outline { background: var(--color-surface); border-color: var(--color-border-strong); color: var(--color-text); }
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }
.btn--ghost { background: transparent; color: var(--color-text-sub); }
.btn--ghost:hover { background: #eceef0; }
.btn--danger { background: var(--color-danger); color: #fff; }
.btn--danger:hover { filter: brightness(.94); }
.btn--danger[disabled] { background: #e6c9c5; cursor: not-allowed; filter: none; }
.btn--block { display: block; width: 100%; }
.btn--sm { font-size: 12px; padding: 5px 12px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---- フォーム ----------------------------------------------------------- */
.form { max-width: 720px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--color-text-sub); margin-bottom: 6px; }
.field .req { color: var(--color-danger); }
.field__hint { color: var(--color-text-muted); font-size: 12px; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 200px; }
.field--checkbox label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--color-text); }
.field--checkbox small { color: var(--color-text-muted); }

input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="file"], select, textarea {
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(61, 187, 195, .15);
}
textarea { resize: vertical; }
.input-inline { width: auto; display: inline-block; padding: 6px 10px; font-size: 13px; }

.form__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ---- ログイン情報入力ブロック（フォーム）------------------------------- */
.cred-block {
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    background: #fafbfc;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.cred-block.is-hidden { display: none; }
.cred-block__note { margin: 0 0 10px; font-size: 12px; color: var(--color-text-muted); }

/* ---- ログイン情報の表示（詳細画面）------------------------------------- */
.cred-view { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.cred-view__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cred-view__key { font-size: 12px; color: var(--color-text-muted); min-width: 72px; }
.cred-view__val { font-size: 13px; word-break: break-all; }

/* ---- メインURL 起動 ----------------------------------------------------- */
.detail__launch { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 20px; }
.detail__url { color: var(--color-text-muted); font-size: 12px; word-break: break-all; }

/* ---- 認証・インストールカード ------------------------------------------- */
.auth-body {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card, .install-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px;
    width: 100%;
}
.auth-card { max-width: 400px; }
.install-card { max-width: 640px; }
.auth-card__brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 18px; margin-bottom: 8px;
}
.auth-card__lead { color: var(--color-text-sub); font-size: 14px; margin: 0 0 24px; }
.install-card__title { font-size: 20px; margin: 0 0 24px; }

.req-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.req-table td { padding: 8px 6px; border-bottom: 1px solid var(--color-border); font-size: 14px; }
.req-table__status { width: 48px; }
.req-table .ok { color: var(--color-success); font-weight: 700; }
.req-table .ng { color: var(--color-danger); font-weight: 700; }

/* ---- 管理レイアウト ----------------------------------------------------- */
.site-header--admin { border-bottom: 2px solid var(--accent); }
.admin-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 28px;
    padding-top: 28px;
    padding-bottom: 60px;
    align-items: start;
}
.admin-sidebar {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 10px;
    position: sticky;
    top: 20px;
}
.admin-sidebar ul { list-style: none; margin: 0; padding: 0; }
.admin-sidebar a {
    display: block;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text-sub);
    font-size: 14px;
    font-weight: 500;
}
.admin-sidebar a:hover { background: #f0f2f4; text-decoration: none; color: var(--color-text); }
.admin-sidebar a.is-active { background: var(--accent); color: #fff; }
.admin-content { min-width: 0; }
.admin-title { font-size: 22px; margin: 0 0 20px; }
.admin-title small { color: var(--color-text-muted); font-weight: 500; font-size: 15px; }
.admin-subtitle { font-size: 15px; margin: 0 0 14px; color: var(--color-text-sub); }

/* ---- 統計カード --------------------------------------------------------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-card__label { font-size: 13px; color: var(--color-text-sub); }
.stat-card__value { font-size: 30px; font-weight: 700; color: var(--color-text); line-height: 1; }

/* ---- ツールバー --------------------------------------------------------- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.toolbar__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- データテーブル ----------------------------------------------------- */
.table-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: var(--shadow);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--color-border); }
.data-table thead th {
    background: #fafbfc;
    color: var(--color-text-sub);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table .row--error { background: var(--color-danger-bg); }
.data-table .row--error:hover { background: #fbe0dc; }

.ta-right { text-align: right; }
.ta-center { text-align: center; }
.ta-nowrap { white-space: nowrap; }
.inline-form { display: inline-block; margin: 0 0 0 4px; }
.inline-add { display: flex; gap: 10px; align-items: center; max-width: 480px; }
.inline-add input[type="text"] { flex: 1; }

/* ---- パネル ------------------------------------------------------------- */
.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.panel--highlight { border-left: 3px solid var(--accent); }
.panel__lead { color: var(--color-text-sub); font-size: 14px; margin: 0 0 16px; }
.copy-row { display: flex; gap: 8px; align-items: center; }

/* ---- ページネーション --------------------------------------------------- */
.pagination { display: flex; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pagination__item {
    display: inline-block;
    min-width: 34px;
    text-align: center;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-sub);
    background: var(--color-surface);
    font-size: 13px;
}
.pagination__item:hover { border-color: var(--accent); text-decoration: none; }
.pagination__item.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- 補助 --------------------------------------------------------------- */
.empty {
    background: var(--color-surface);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius);
    padding: 48px;
    text-align: center;
    color: var(--color-text-muted);
}
.text-muted { color: var(--color-text-muted); }
.text-danger { color: var(--color-danger); }

/* ---- フッタ ------------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    padding: 20px 0;
    margin-top: 40px;
}
.site-footer p { margin: 0; color: var(--color-text-muted); font-size: 13px; text-align: center; }

/* ---- レスポンシブ ------------------------------------------------------- */
@media (max-width: 820px) {
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; }
    .admin-sidebar ul { display: flex; flex-wrap: wrap; gap: 4px; }
    .detail { grid-template-columns: 1fr; }
    .detail__specs > div { grid-template-columns: 100px 1fr; }
}
@media (max-width: 560px) {
    .container { padding: 0 16px; }
    .site-nav { gap: 12px; }
    .site-nav__user { display: none; }
    .form__actions { flex-direction: column-reverse; }
    .form__actions .btn { width: 100%; }
}
