/* =============================================
   GEAL Header & Sub-bar
   ============================================= */

body {
    background-color: var(--geal-bg-primary);
    color: var(--geal-text-primary-full);
    margin: 0;
    padding-top: 0;
}

.main-header {
    position: relative;
    width: 100%;
    min-height: var(--geal-header-height);
    height: auto;
    background-color: var(--geal-bg-header);
    display: flex;
    align-items: center;
    padding: 8px 40px 10px;
    z-index: 1000;
}

.logo-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-right: 30px;
    flex-shrink: 0;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    border: none;
    background: transparent;
    margin-right: 0;
}

.circular-banner-link {
    display: block;
    overflow: hidden;
    border-radius: var(--geal-radius-pill);
    line-height: 0;
    width: 148px;
    height: 38px;
    flex-shrink: 0;
    transition: opacity var(--geal-transition), transform var(--geal-transition);
    margin-left: 12px;
}

.circular-banner-link:hover {
    opacity: 0.85;
    transform: scale(1.03);
}

.circular-banner-img {
    display: block;
    width: calc(100% + 48px);
    height: calc(100% + 32px);
    margin: -16px -24px;
    object-fit: cover;
    object-position: center;
}

.geal-return-banner {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 12px;
    text-decoration: none;
    height: 44px;
    width: 148px;
    overflow: hidden;
    border-radius: var(--radius-xl);
    transition: opacity var(--geal-transition), transform var(--geal-transition);
}

/* PCではラッパーを透過させ、バナーが従来通り main-header の直接子としてレイアウト */
.header-row-2 {
    display: contents;
}

/* スマホ専用の1段目ラッパー (PCでは非表示) */
.mobile-header-top {
    display: none;
}

/* Circularワールド時の1段目ロゴ（PC: 44px） */
.circular-world-logo {
    display: block;
    height: 44px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    border: none;
}

.geal-return-banner:hover {
    opacity: 0.85;
    transform: scale(1.03);
}

.geal-return-banner-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.2);
}

.header-logo {
    height: 40px;
    width: auto;
    margin-right: 0;
    background: transparent;
    transition: transform var(--geal-transition);
    display: block;
    border: none;
}

.logo-link:hover .header-logo {
    opacity: 0.9;
    transform: scale(1.02);
}

.header-circular-link-wrap {
    display: none;
    align-items: center;
    margin-left: 12px;
    flex-shrink: 0;
}

.header-circular-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: var(--geal-radius-pill);
    background: var(--geal-gradient-accent);
    color: #fff;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

/* --- Search --- */

.search-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--geal-bg-primary);
    border-radius: var(--geal-radius-sm);
    width: 100%;
    max-width: 700px;
    height: 44px;
    overflow: hidden;
}

.search-input {
    flex-grow: 1;
    border: none;
    padding: 0 15px;
    outline: none;
    font-size: 16px;
    background: transparent;
    color: var(--geal-text-primary);
}

.adv-search-link {
    display: inline-flex;
    align-items: center;
    color: var(--geal-accent);
    font-size: 13px;
    white-space: nowrap;
    padding: 0 12px;
    cursor: pointer;
    font-weight: 600;
    border-left: 1px solid var(--geal-border);
}

.adv-search-link:hover {
    color: var(--geal-accent-hover);
}

.adv-search-link-icon {
    display: none;
}

.search-action-btn {
    background-color: var(--geal-accent);
    border: none;
    padding: 0 20px;
    color: white;
    height: 100%;
    cursor: pointer;
}

/* --- Sub Navigation Bar --- */

.geal-sub-bar {
    background-color: var(--geal-bg-header);
    width: 100%;
    height: 34px;
    display: flex;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid var(--geal-border-header);
    z-index: 998;
    scrollbar-width: none;
    margin-bottom: 0;
}

.geal-sub-bar::-webkit-scrollbar {
    display: none;
}

.sub-bar-container {
    display: flex;
    align-items: center;
    width: 100%;
}

.sub-item {
    color: #ffffff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    margin-right: 18px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    opacity: 0.9;
    transition: opacity var(--geal-transition);
    flex-shrink: 0;
}

.sub-item:hover {
    opacity: 1;
    border-bottom: 1px solid white;
}

.sub-item.active {
    opacity: 1;
    border-bottom: 2px solid white;
    font-weight: 900;
}

/* --- Header Actions (Cart) --- */

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: 20px;
}

.header-cart-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: white;
    text-decoration: none;
    transition: transform var(--geal-transition);
}

.header-cart-link:hover {
    transform: scale(1.1);
}

.header-cart-icon {
    font-size: 24px;
}

/* --- Mobile-only Circular Link --- */

.circular-mobile-only-link {
    display: none;
    overflow: hidden;
    border-radius: var(--geal-radius-pill);
    width: 96px;
    height: 24px;
    flex-shrink: 0;
    transition: opacity var(--geal-transition);
    line-height: 0;
}

.circular-mobile-only-link:hover {
    opacity: 0.85;
}

.circular-mobile-only-img {
    display: block;
    width: calc(100% + 32px);
    height: calc(100% + 16px);
    margin: -8px -16px;
    object-fit: cover;
    object-position: center;
}

/* --- Sub-bar Conditional Display --- */

#sub-bar-placeholder {
    margin-bottom: 0;
    padding: 0;
}

#sub-bar-placeholder .geal-sub-bar {
    display: block;
}

.sub-bar-seeds-link:hover {
    opacity: 1;
    filter: brightness(1.15);
}

/* --- Theme Toggle Button --- */

.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background var(--geal-transition), transform var(--geal-transition);
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* Light mode: show moon icon, hide sun */
.theme-icon-light {
    display: none;
}

.theme-icon-dark {
    display: inline;
}

/* Dark mode: show sun icon, hide moon */
[data-theme="dark"] .theme-icon-light {
    display: inline;
}

[data-theme="dark"] .theme-icon-dark {
    display: none;
}

[data-theme="dark"] .search-input-wrapper {
    background: var(--geal-bg-muted);
}

[data-theme="dark"] .search-input {
    background: transparent;
    color: var(--geal-text-primary);
}

/* =============================================
   Seller Mode Switch (header)
   ローダー判定後に動的に表示。バイヤーには非表示。
   ============================================= */
.header-seller-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    margin-left: 8px;
    border-radius: 4px;
    background: linear-gradient(135deg, #6B21A8 0%, #7c3aed 100%);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: opacity var(--geal-transition), transform var(--geal-transition);
    flex-shrink: 0;
    white-space: nowrap;
}

.header-seller-switch-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.header-seller-switch-btn i {
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .header-seller-switch-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        min-height: 44px;
        min-width: 44px;
    }
    .header-seller-switch-btn .header-seller-switch-label {
        display: none;
    }
}

/* =============================================
   Notification Bell & Panel
   ============================================= */
.notification-bell-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background var(--geal-transition), transform var(--geal-transition);
    flex-shrink: 0;
    margin-right: 8px;
}

.notification-bell-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-sm);
    background: var(--geal-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    pointer-events: none;
    box-shadow: 0 0 0 2px var(--geal-bg-header);
}

.notification-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 12px;
    width: 360px;
    max-width: calc(100vw - 24px);
    max-height: 480px;
    background: var(--geal-bg-card);
    color: var(--geal-text-primary);
    border: 1px solid var(--geal-border);
    border-radius: var(--geal-radius-lg);
    box-shadow: var(--geal-shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1100;
}

.notification-panel.open {
    display: flex;
}

.notification-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--geal-border);
    background: var(--geal-bg-subtle);
}

.notification-panel-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--geal-text-primary);
}

.notification-mark-all-btn {
    background: transparent;
    border: none;
    color: var(--geal-accent);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--geal-radius-sm);
    transition: background var(--geal-transition);
}

.notification-mark-all-btn:hover {
    background: var(--geal-bg-muted);
}

.notification-panel-body {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 80px;
    max-height: 360px;
}

.notification-panel-placeholder,
.notification-panel-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--geal-text-muted);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.notification-panel-empty i {
    font-size: 1.5rem;
    color: var(--geal-text-faint);
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--geal-border-subtle);
    text-decoration: none;
    color: var(--geal-text-primary);
    transition: background var(--geal-transition);
    position: relative;
}

.notification-item:hover {
    background: var(--geal-bg-subtle);
}

.notification-item.unread {
    background: var(--geal-gradient-accent-pale);
}

.notification-item-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--geal-bg-muted);
    color: var(--geal-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.notification-item-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.notification-item-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--geal-text-primary);
    line-height: 1.3;
}

.notification-item-body {
    font-size: 0.8rem;
    color: var(--geal-text-secondary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-item-time {
    font-size: 0.7rem;
    color: var(--geal-text-faint);
    margin-top: 2px;
}

.notification-item-dot {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--geal-accent);
    flex-shrink: 0;
}

/* 既読の薄表示（2026-05-05: Yahoo型・「視界から消す」UX）*/
.notification-item:not(.unread) {
    opacity: 0.65;
}

.notification-item:not(.unread) .notification-item-title {
    font-weight: 400;
    color: var(--geal-text-secondary);
}

.notification-item:not(.unread) .notification-item-body {
    color: var(--geal-text-faint);
}

/* タブUI (seller-dashboard 専用 / tabbed=true 時のみ JS で挿入される) */
.notification-panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--geal-border);
    background: var(--geal-bg-card);
}

.notification-tab {
    flex: 1 1 50%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--geal-text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--geal-transition), border-color var(--geal-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.notification-tab:hover {
    color: var(--geal-text-primary);
}

.notification-tab.is-active {
    color: var(--geal-accent);
    border-bottom-color: var(--geal-accent);
}

.notification-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: var(--geal-accent);
    border-radius: var(--geal-radius-sm);
    line-height: 1;
}

.notification-panel-footer {
    border-top: 1px solid var(--geal-border);
    padding: 10px 16px;
    text-align: center;
    background: var(--geal-bg-subtle);
}

.notification-see-all-link {
    color: var(--geal-accent);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.notification-see-all-link:hover {
    text-decoration: underline;
}

[data-theme="dark"] .notification-badge {
    box-shadow: 0 0 0 2px var(--geal-bg-header);
}

/* =============================================
   Header - Responsive
   ============================================= */

@media (max-width: 768px) {
    .main-header {
        height: auto;
        min-height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 6px 10px;
        padding-top: calc(6px + env(safe-area-inset-top, 0px));
        position: sticky;
        top: 0;
        z-index: 1000;
        gap: 6px;
        background-color: var(--geal-bg-header);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    /* スマホ2段レイアウト: 1段目=左ロゴ+右ボタン / 2段目=検索+テーマ。PC用 logo-area と header-row-2 は非表示 */
    .logo-area {
        display: none;
    }

    .header-row-2 {
        display: none;
    }

    /* 1段目ラッパー: 左右に space-between で配置、幅100%で単独行 */
    .mobile-header-top {
        display: flex;
        flex-basis: 100%;
        align-items: center;
        justify-content: space-between;
        order: -1;
        gap: 8px;
        margin: 0;
        padding: 0;
        background: transparent;
    }

    /* 左: 現在ワールドのロゴ (ボタン枠なし画像) */
    .mobile-world-logo-link {
        display: inline-flex;
        align-items: center;
        margin: 0;
        padding: 0;
        border: none;
        background: transparent;
        text-decoration: none;
        line-height: 0;
        flex-shrink: 0;
    }

    .mobile-world-logo {
        display: block;
        height: 44px;
        width: auto;
        object-fit: contain;
        margin: 0;
        padding: 0;
        border: none;
        background: transparent;
    }

    /* 右: もう一方のワールドへのボタン (親でピル型にクリップし、画像は scale(1.25) で余白を枠外へ押し出す) */
    .mobile-world-button-link {
        display: inline-block;
        height: 44px;
        width: 120px;
        border-radius: var(--radius-xl);
        overflow: hidden;
        margin: 0;
        padding: 0;
        border: none;
        background: transparent;
        text-decoration: none;
        line-height: 0;
        flex-shrink: 0;
    }

    .mobile-world-button {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        transform: scale(1.25);
        margin: 0;
        padding: 0;
        border: none;
        background: transparent;
    }

    .logo-area {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        margin-right: 0;
        flex-shrink: 0;
    }

    .logo-link {
        width: auto;
        display: flex;
        align-items: center;
        margin-right: 0;
        padding-bottom: 0;
    }

    /* 1段目: 現在ワールドのロゴ (GEAL world) */
    .header-logo {
        height: 38px;
        width: auto;
    }

    /* 1段目: 現在ワールドのロゴ (Circular world) */
    .circular-world-logo {
        height: 38px;
    }

    .circular-mobile-only-link {
        display: none;
    }

    .header-circular-link-wrap {
        display: none;
    }

    /* 2段目: GEAL→Circular ボタン (ピル型画像を自然なアスペクト比で表示) */
    .circular-banner-link {
        display: inline-block;
        width: auto;
        height: 38px;
        margin: 0;
        border-radius: 0;
        overflow: visible;
        line-height: 0;
        flex-shrink: 0;
    }

    .circular-banner-img {
        display: block;
        width: auto;
        height: 38px;
        margin: 0;
        object-fit: contain;
    }

    /* 2段目: Circular→GEAL 戻るボタン */
    .geal-return-banner {
        width: auto;
        height: 38px;
        margin: 0;
        border-radius: 0;
        overflow: visible;
    }

    .geal-return-banner-img {
        width: auto;
        height: 38px;
        transform: none;
        object-fit: contain;
    }

    .search-container {
        flex: 1 1 auto;
        min-width: 0;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0;
    }

    .search-input-wrapper {
        width: 100%;
        max-width: 100%;
        height: 38px;
        min-height: 38px;
        border-radius: var(--radius-xl);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
        background: var(--geal-bg-primary);
        flex-shrink: 1;
    }

    .search-input {
        font-size: 16px;
        padding: 0 12px;
        flex-grow: 1;
        background: transparent;
        min-width: 0;
    }

    .adv-search-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 36px;
        min-height: 36px;
        flex-shrink: 0;
        padding: 0 8px;
        border-left: 1px solid var(--geal-border);
        color: var(--geal-accent);
        font-weight: 600;
    }

    .adv-search-link-text {
        display: none;
    }

    .adv-search-link-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
    }

    .adv-search-link:active {
        background: rgba(124, 58, 237, 0.08);
    }

    .adv-search-mobile-row {
        display: none;
    }

    .search-action-btn {
        min-width: 40px;
        height: 100%;
        border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
        padding: 0 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .theme-toggle-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        flex-shrink: 0;
    }

    .notification-bell-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        margin-right: 6px;
    }

    @keyframes notifSlideDown {
        from { opacity: 0; transform: translateY(-12px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .notification-panel {
        position: fixed;
        top: 8px;
        left: 8px;
        right: 8px;
        bottom: auto;
        width: auto;
        max-width: none;
        max-height: 80vh;
        border-radius: var(--radius-xl);
        box-shadow: 0 8px 32px rgba(0,0,0,0.24);
        animation: notifSlideDown 0.25s ease;
    }

    .notification-panel-body {
        max-height: calc(80vh - 120px);
    }

    .geal-sub-bar {
        height: 40px;
        padding: 0;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .geal-sub-bar::-webkit-scrollbar {
        display: none;
    }

    .sub-bar-container {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 12px;
        padding: 0 16px;
        height: 100%;
    }

    .sub-item {
        font-size: 11px;
        padding: 4px 10px;
        min-height: 28px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.12);
        flex-shrink: 0;
        transition: all var(--geal-transition);
    }

    .sub-item:active {
        background: rgba(255, 255, 255, 0.25);
        transform: scale(0.95);
    }

    .sub-item.status-sprout {
        background: rgba(168, 85, 247, 0.2);
    }

    #sub-bar-placeholder[data-page-type="other"] .geal-sub-bar,
    #sub-bar-placeholder[data-page-type="dashboard"] .geal-sub-bar {
        display: flex;
    }
}

@media (max-width: 375px) {
    .main-header {
        padding: 6px 8px;
        gap: 4px;
    }

    .header-logo {
        height: 36px;
    }

    .circular-world-logo {
        height: 36px;
    }

    .mobile-world-logo {
        height: 44px;
    }

    .mobile-world-button-link {
        height: 44px;
        width: 120px;
    }

    .search-input-wrapper {
        height: 36px;
    }

    .circular-banner-link,
    .circular-banner-img,
    .geal-return-banner,
    .geal-return-banner-img {
        height: 36px;
    }

    .sub-item {
        font-size: 11px;
        padding: 4px 8px;
    }
}

@media (min-width: 376px) and (max-width: 768px) {
    .main-header {
        min-height: auto;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .main-header {
        height: 50px;
    }

    .header-logo {
        height: 35px;
    }

    .geal-sub-bar {
        height: 40px;
    }
}

/* =============================================
   Circular Header Logos (専用クラス)
   既存の circular-banner-link 等とは完全に独立。
   メディアクエリで非表示にしない。
   ============================================= */

/* 左: GEAL Circularロゴ（四角・横長） */
.circular-logo-left {
    display: block !important;
    height: 44px;
    width: auto;
    object-fit: contain;
    border: none;
}

/* 右: GEALに戻るボタン（丸アイコン） */
.circular-logo-right {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    margin-left: 8px;
    text-decoration: none;
    transition: opacity 0.2s ease;
}
.circular-logo-right:hover {
    opacity: 0.85;
}
.circular-logo-right-img {
    display: block !important;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}
