/* ============================================================
 * shell.css — サイト共通レイアウト（Header / Sidebar / 全体シェル）
 *
 * 上部バー・左アイコンレール・左スライドパネル・右下FAB・アカウントメニュー
 * の構造とスタイルを一元管理する。root(/) ・ salon(/salon/) の静的ページ
 * と、各Reactアプリ（AppShell.jsx）が全く同じクラス名（.shell-*）で
 * このファイルを使う。ページ固有のコンポーネント（EnemySettingsや
 * サロンの検索フォームなど）のスタイルはここに置かず、各ページ側に残す。
 *
 * デザイントークン（色・形状・サイズ・フォント）は theme.css を参照。
 * ============================================================ */
@import url("./theme.css");

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

.shell {
    min-height: 100vh;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-sans);
}

/* ---------------- Top bar (Header) ---------------- */
.shell-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--shell-topbar-h);
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 16px;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}

.shell-brand {
    display: flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    color: var(--c-primary);
    flex-shrink: 0;
}
.shell-brand-mark { font-size: 17px; line-height: 1; }
.shell-brand-text {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.shell-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
}
.shell-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--c-text-muted);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}
.shell-nav-link:hover { background: var(--c-surface-alt); color: var(--c-text); }
.shell-nav-link.active { background: var(--c-primary-bg); color: var(--c-primary-dark); }
.shell-nav-dev-badge {
    font-size: 9px;
    font-weight: 700;
    color: var(--c-dev);
    background: var(--c-dev-bg);
    border-radius: 999px;
    padding: 1px 6px;
}

.shell-account {
    position: relative;
    margin-left: auto;
    flex-shrink: 0;
}
.shell-account-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 6px;
    background: var(--c-surface-alt);
    border: 1px solid var(--c-border);
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--c-text);
}
.shell-account-btn:hover { background: #e9ecef; }
.shell-account-btn--login { background: var(--c-primary); border-color: var(--c-primary); color: #fff; padding: 7px 14px; }
.shell-account-btn--login:hover { background: var(--c-primary-dark); }
.shell-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--c-primary-bg);
    color: var(--c-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}
.shell-account-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.shell-account-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 6px;
    z-index: 110;
}
.shell-account-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    color: var(--c-text);
    text-decoration: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.shell-account-menu-item:hover { background: var(--c-surface-alt); }
.shell-account-menu-note { padding: 8px 10px; font-size: 11.5px; color: var(--c-text-faint); }

/* ---------------- Body: rail + panel(overlay) + main (Sidebar) ---------------- */
.shell-body {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - var(--shell-topbar-h));
}

.shell-rail {
    position: sticky;
    top: var(--shell-topbar-h);
    align-self: flex-start;
    height: calc(100vh - var(--shell-topbar-h));
    width: var(--shell-rail-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 6px;
    background: var(--c-surface);
    border-right: 1px solid var(--c-border);
    z-index: 97;
}
.shell-rail-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 9px 2px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--c-text-muted);
    cursor: pointer;
}
.shell-rail-btn:hover { background: var(--c-surface-alt); color: var(--c-text); }
.shell-rail-btn.active { background: var(--c-primary-bg); color: var(--c-primary-dark); }
.shell-rail-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

/* パネルが開いている間、レール自体は暗くならず、その奥（メイン領域と、パネルが
   これから重なる場所も含めて）を最初から薄暗くする。パネル（不透明な白背景）が
   その上に重なって見えるだけなので、開く瞬間に暗くなっていない隙間が見えたり
   しない。メインの幅は変わらない（パネルは position:fixed のオーバーレイ）。
   常にDOMに置いたまま transform+opacity を transition させ、.is-open で表示
   する（開閉どちらも滑らかにアニメーションする）。
   重なり順は「レール(最前面) > パネル > バックドロップ > メイン」で、パネルは
   レールの下を通ってスライドするように見える。 */
.shell-panel-backdrop {
    position: fixed;
    top: var(--shell-topbar-h);
    left: var(--shell-rail-w);
    right: 0;
    bottom: 0;
    background: rgba(20, 24, 40, 0.28);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.shell-panel-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}
.shell-panel {
    position: fixed;
    top: var(--shell-topbar-h);
    left: var(--shell-rail-w);
    height: calc(100vh - var(--shell-topbar-h));
    width: min(var(--shell-panel-w), calc(100vw - var(--shell-rail-w)));
    background: var(--c-surface);
    border-right: 1px solid var(--c-border);
    box-shadow: var(--shadow-lg);
    z-index: 93;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.18s ease, opacity 0.15s ease;
}
.shell-panel.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}
.shell-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--c-border);
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.shell-panel-close {
    border: none;
    background: var(--c-surface-alt);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--c-text-muted);
}
.shell-panel-close:hover { background: #e9ecef; color: var(--c-text); }
.shell-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.shell-main {
    flex: 1;
    min-width: 0;
    padding: 22px 24px 100px;
}

/* ---------------- FAB ---------------- */
.shell-fab {
    position: fixed;
    right: 26px;
    bottom: 26px;
    z-index: 98;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border: none;
    border-radius: 999px;
    background: var(--c-primary);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
}
.shell-fab:hover { background: var(--c-primary-dark); }
.shell-fab:disabled { background: #b7c1d6; cursor: not-allowed; box-shadow: var(--shadow-sm); }
.shell-fab.danger { background: var(--c-danger); }

/* ---------------- 汎用UIキット（複数ページで再利用するもの） ----------------
 * ここから下は「シェル」そのものではないが、MyPage / BuddySearchPage /
 * ダメージ計算機の保存パネルなど複数箇所で共通に使う小さな部品。
 * 1ページだけでしか使わないスタイルはここに置かず、各ページ側に残すこと。 */
.surface-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--c-primary);
    color: #fff;
    font-weight: 700;
    font-size: 12.5px;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-primary:disabled { background: #b7c1d6; cursor: not-allowed; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    color: var(--c-text);
    font-weight: 600;
    font-size: 12.5px;
    cursor: pointer;
    text-decoration: none;
}
.btn-secondary:hover { background: var(--c-surface-alt); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
}
.badge-success { background: var(--c-success-bg); color: var(--c-success); }
.badge-muted { background: var(--c-surface-alt); color: var(--c-text-muted); }
.badge-dev { background: var(--c-dev-bg); color: var(--c-dev); }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 16px;
    color: var(--c-text-faint);
    font-size: 12px;
    text-align: center;
}

.saved-list { display: flex; flex-direction: column; gap: 8px; }
.saved-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-surface-alt);
}
.saved-list-item-title {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.saved-list-item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    border-radius: 50%;
    color: var(--c-text-muted);
    cursor: pointer;
}
.icon-btn:hover { background: #e7eaf2; color: var(--c-text); }
.icon-btn.danger:hover { background: var(--c-danger-bg); color: var(--c-danger); }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
    .shell-brand-text { display: none; }
    .shell-nav-link span:last-child:not(.shell-nav-dev-badge) { display: none; }
    .shell-nav-link { padding: 8px; }
    .shell-account-name { display: none; }
}

@media (max-width: 640px) {
    .shell-main { padding: 16px 14px 110px; }
    .shell-fab-label { display: none; }
    .shell-fab { padding: 14px; right: 16px; bottom: 16px; }
}
