/**
 * header-bar.css — ユーティリティバー（会員登録/ログイン/カート 常時表示）
 *
 * 実装方式:
 *   PHP(wp_footer)で #bal-utility-bar を出力し、position:fixed;top:0 で画面最上部に固定。
 *   親テーマの header は position:fixed;top:0;z-index:9999 のため、バーの z-index:10000 で上に重ね、
 *   ホームページでは header の top を --bal-bar-h 分だけ下げる。
 *   非ホームページでは子テーマの body:not(.home) header { position:relative } が効いており
 *   header は通常配置のため、バーが fixed で上に被さる分 main の margin-top を加算する。
 *
 * @package bal-child
 */

/* ==========================================================================
   CSS 変数
   ========================================================================== */

:root {
    --bal-bar-h: 40px;
}

/* ==========================================================================
   バー本体 — 白地 + 下端 1px ボーダーで軽く区切る
   ========================================================================== */

#bal-utility-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--bal-bar-h);
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    z-index: 10000;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    display: none;
}

#bal-utility-bar .bal-bar__inner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    max-width: 1235px;
    margin: 0 auto;
    padding: 0 24px;
    gap: 8px;
    box-sizing: border-box;
}

/* ==========================================================================
   ボタン共通
   ========================================================================== */

.bal-bar__btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 0.15s ease, background-color 0.15s ease;
    border: none;
    cursor: pointer;
    font-family: "noto-sans-cjk-jp", "Noto Sans JP", sans-serif;
}

.bal-bar__btn:hover {
    text-decoration: none;
}

/* 会員登録 — 金の塗りCTA + ネイビー文字。購入導線の主役 */
.bal-bar__btn--register {
    background-color: #f8cf3f;
    color: #162a70;
    border: 1px solid transparent;
}

.bal-bar__btn--register:hover {
    background-color: #f0c430;
    color: #162a70;
    opacity: 1;
}

/* ログイン — 控えめ。ネイビー文字 + 1px アウトライン */
.bal-bar__btn--login {
    background-color: transparent;
    color: #162a70;
    border: 1px solid #162a70;
}

.bal-bar__btn--login:hover {
    background-color: #162a70;
    color: #ffffff;
    opacity: 1;
}

/* マイページ — ログイン済。ネイビー文字 + 1px アウトライン */
.bal-bar__btn--mypage {
    background-color: transparent;
    color: #162a70;
    border: 1px solid #162a70;
}

.bal-bar__btn--mypage:hover {
    background-color: #162a70;
    color: #ffffff;
    opacity: 1;
}

/* ログアウト — 控えめなテキストリンク */
.bal-bar__btn--logout {
    background-color: transparent;
    color: #868daa;
    border: none;
    font-weight: 400;
    padding: 5px 8px;
}

.bal-bar__btn--logout:hover {
    color: #162a70;
    opacity: 1;
}

/* カート — ネイビーアイコン + 件数バッジ */
.bal-bar__btn--cart {
    background-color: transparent;
    color: #162a70;
    border: 1px solid #e5e7eb;
    position: relative;
}

.bal-bar__btn--cart:hover {
    border-color: #162a70;
    color: #162a70;
    opacity: 1;
}

/* カートバッジ */
.bal-bar__cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    background-color: #162a70;
    color: #ffffff;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    padding: 0 4px;
    line-height: 1;
}

/* ==========================================================================
   ホームページ: 固定ヘッダーをバー分押し下げる
   ========================================================================== */

.home header {
    top: var(--bal-bar-h);
}

/* ==========================================================================
   非ホームページ: ヘッダーは relative(top:0) のため、固定バーがヘッダー上部に
   被る。ヘッダー自体をバー分(--bal-bar-h)押し下げて被りを解消する。
   バー分の補正を main ではなくヘッダー側に持たせるため、main は common.css 既定の
   200px に戻す（ヘッダーを下げた分とちょうど相殺し、本文の位置は不変）。
   ========================================================================== */

body:not(.home) header {
    margin-top: var(--bal-bar-h);
}

body:not(.home) main {
    margin-top: 200px;
}

/* ==========================================================================
   モバイル (max-width: 1000px)
   ========================================================================== */

@media screen and (max-width: 1000px) {
    #bal-utility-bar .bal-bar__inner {
        padding: 0 16px;
        gap: 6px;
    }

    /* PC用テキストラベルを隠してアイコンのみ表示 */
    .bal-bar__btn--register .bal-bar__label,
    .bal-bar__btn--login .bal-bar__label,
    .bal-bar__btn--mypage .bal-bar__label,
    .bal-bar__btn--logout .bal-bar__label {
        display: none;
    }

    /* アイコンのみ表示時のフォントサイズ */
    .bal-bar__btn--register .bal-bar__icon,
    .bal-bar__btn--login .bal-bar__icon,
    .bal-bar__btn--mypage .bal-bar__icon,
    .bal-bar__btn--logout .bal-bar__icon {
        font-size: 15px;
    }

    .bal-bar__btn {
        padding: 5px 10px;
    }

    /* 会員登録は SP でもゴールド地で視認性を維持 */
    .bal-bar__btn--register {
        padding: 5px 12px;
    }
}
