/* Smartmart ヘッダー */

.dev-mode-banner {
    background: #ff9800;
    color: white;
    text-align: center;
    padding: 5px;
    font-size: 12px;
}

.site-header {
    background: var(--sm-black, #1a1a1a);
    position: sticky;
    top: 0;
    z-index: 9999;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    isolation: isolate;
}

.navbar {
    padding: 0;
    display: block;
    overflow: visible;
}

.navbar-top-wrapper {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

.navbar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 8px 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.navbar-bottom {
    background: var(--gray-midashi, #374151);
    padding: 0;
}

.navbar-bottom-inner {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    padding: 4px 20px 6px;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    align-items: center;
}

.logo-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 3px;
    flex-shrink: 0;
    height: 40px;
}

.logo-tagline {
    color: #cbd5e1;
    font-size: 10px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    line-height: 1;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    height: 24px;
}

.logo img {
    height: 100%;
    width: auto;
    display: block;
    filter: brightness(0) invert(1);
}

/* 検索バー */
.search-container {
    flex: 1;
    max-width: 800px;
    position: relative;
}

/* 検索サジェスト */
.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 640px;
    overflow-y: auto;
    display: none;
    z-index: 99999;
}

@media (max-width: 768px) {
    .search-suggestions {
        top: calc(100% + 4px);
        border-radius: 12px;
        max-height: 70vh;
    }
}

.suggest-section-title {
    padding: 8px 12px;
    color: #666;
    font-size: 12px;
    border-bottom: 1px solid #eee;
}

.suggest-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
    text-decoration: none;
    transition: background 0.15s;
}

.suggest-item:hover {
    background: #f5f5f5;
}

.suggest-icon {
    font-size: 14px;
    color: #888;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.suggest-label {
    flex: 1;
    font-size: 14px;
}

.suggest-type {
    font-size: 11px;
    color: #aaa;
}

.suggest-product-group {
    border-bottom: 1px solid #f0f0f0;
}

.suggest-product-group:last-child {
    border-bottom: none;
}

.suggest-product-name {
    padding: 8px 12px 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
}

a.suggest-product-name {
    cursor: pointer;
    transition: background 0.15s;
}

a.suggest-product-name:hover {
    background: #f5f5f5;
}

.suggest-arrow {
    margin-left: auto;
    color: #bbb;
    font-size: 11px;
}

.suggest-brand-icon {
    border-radius: 2px;
    vertical-align: middle;
}

.suggest-product-name .suggest-icon {
    color: #555;
}

.suggest-services {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 12px 14px 38px;
}

.suggest-service-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #555;
    background: #f5f7fa;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.suggest-service-link:hover {
    background: var(--primary-color, #0668E1);
    color: white;
}

.suggest-service-icon {
    font-size: 11px;
    width: 14px;
    text-align: center;
}

.suggest-service-name {
    font-weight: 500;
}

.suggest-service-price {
    font-size: 11px;
    color: #888;
    margin-left: 2px;
}

.suggest-service-link:hover .suggest-service-price {
    color: rgba(255,255,255,0.8);
}

.suggest-footer {
    padding: 8px 12px;
    border-top: 1px solid #eee;
}

.suggest-footer .clear-history {
    background: none;
    border: none;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
}

.suggest-footer .clear-history:hover {
    color: #666;
}

.search-form {
    display: flex;
    align-items: center;
    height: 40px;
    border-radius: 20px;
    background: white;
}

.search-icon-btn {
    background: transparent;
    border: none;
    padding: 0 6px 0 12px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.2s;
    height: 100%;
}

.search-icon-btn:hover {
    color: var(--primary-color, #0668E1);
}

.search-icon-btn .lucide-icon {
    width: 18px;
    height: 18px;
}

.search-input {
    flex: 1;
    border: none;
    padding: 0 12px 0 4px;
    font-size: 14px;
    color: var(--text-primary, #333);
    background: transparent;
    height: 100%;
}

.search-input:focus {
    outline: none;
}

/* ナビゲーション */
.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
}

.nav-user:hover,
.header-cart:hover {
    opacity: 0.8;
}

.nav-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.nav-greeting {
    font-size: 12px;
    color: #ccc;
}

.nav-name {
    font-size: 14px;
    font-weight: 600;
}

.header-cart,
.header-favorites {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
}

.header-favorites:hover {
    opacity: 0.8;
}

.cart-wrapper {
    position: relative;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary-color, #0668E1);
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.cart-text {
    font-size: 14px;
    font-weight: 600;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 4px;
    transition: all 0.2s;
    letter-spacing: 0.04rem;
}

.navbar-bottom-inner > .nav-link:first-child,
.navbar-bottom-inner > .nav-dropdown:first-child > .nav-link {
    padding-left: 0;
}

.dropdown-toggle {
    padding-right: 6px;
}

.nav-link:hover {
    color: white;
    opacity: 0.8;
}

/* ドロップダウン */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle::after {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 6px;
    vertical-align: middle;
    position: relative;
    top: -1px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat center/contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat center/contain;
    opacity: 0.7;
    border: none;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 4px;
    display: none;
    z-index: 99999;
    margin-top: 4px;
    padding: 8px 0;
}

/* マウス移動中にドロップダウンが消えないよう、トグルとメニューの間に透明なブリッジを追加 */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
}

/* 念のためドロップダウン親の overflow と stacking を強制 */
.nav-dropdown {
    overflow: visible;
    z-index: 1;
}

.navbar-bottom,
.navbar-bottom-inner {
    overflow: visible;
}

.nav-dropdown:hover .dropdown-menu {
    display: block;
}

@media (max-width: 768px) {
    .dropdown-menu {
        display: none !important;
    }

    .dropdown-toggle::after {
        display: none;
    }
}

.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text-primary, #333);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-secondary, #f8f9fa);
    color: var(--primary-color, #0668E1);
}

/* ユーザーメニュー（PC のみ hover でドロップダウン） */
.nav-user-dropdown {
    position: relative;
}

.nav-user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    display: none;
    z-index: 9999;
    margin-top: 8px;
    padding: 8px 0;
}

/* マウス移動時の hover 切れ防止用ブリッジ */
.nav-user-menu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.nav-user-dropdown:hover .nav-user-menu {
    display: block;
}

.nav-user-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary, #333);
    font-size: 14px;
}

.nav-user-menu .dropdown-item i {
    width: 16px;
    height: 16px;
    color: #6b7280;
}

.nav-user-menu .dropdown-item:hover i {
    color: var(--primary-color, #0668E1);
}

.nav-user-menu .dropdown-item-danger {
    border-top: 1px solid #f3f4f6;
    margin-top: 4px;
    color: #dc2626;
}

.nav-user-menu .dropdown-item-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

.nav-user-menu .dropdown-item-danger:hover i {
    color: #dc2626;
}

/* SP ではドロップダウンを無効化（タップで直接遷移） */
@media (max-width: 768px) {
    .nav-user-menu {
        display: none !important;
    }
}

/* SPハンバーガーボタン（PCでは非表示） */
.sp-menu-toggle {
    display: none;
}

/* SPドロワー */
.sp-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.sp-drawer-backdrop[hidden] {
    display: none;
}

.sp-drawer-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.sp-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 80%;
    max-width: 320px;
    background: #fff;
    z-index: 10001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sp-drawer.is-open {
    transform: translateX(0);
}

.sp-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    background: var(--sm-black, #1a1a1a);
}

.sp-drawer-logo img {
    height: 26px;
    width: auto;
    filter: brightness(0) invert(1);
    display: block;
}

.sp-drawer-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sp-drawer-nav {
    padding: 8px 0;
}

.sp-drawer-link {
    display: block;
    padding: 12px 18px;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 1px solid #f3f4f6;
}

.sp-drawer-link:hover {
    background: #f8f9fa;
    color: var(--primary-color, #0668E1);
}

.sp-drawer-link.sp-drawer-sub {
    padding-left: 32px;
    font-size: 14px;
    color: #4b5563;
    font-weight: 400;
}

.sp-drawer-section-title {
    padding: 14px 18px 6px;
    color: #9ca3af;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .sp-menu-toggle {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1px;
        background: transparent;
        color: #fff;
        border: 1px solid rgba(255,255,255,0.6);
        border-radius: 6px;
        padding: 4px 8px 3px;
        cursor: pointer;
        line-height: 1;
    }

    .sp-menu-icon {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sp-menu-icon .lucide-icon {
        width: 18px;
        height: 18px;
    }

    .sp-menu-label {
        font-size: 9px;
        font-weight: 600;
        letter-spacing: 0.06em;
    }
}

@media (max-width: 768px) {
    .navbar-top-wrapper {
        padding: 0 12px;
    }

    .navbar-top {
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 0 12px 0;
    }

    .search-container {
        width: 100%;
        order: 3;
        margin-top: 4px;
    }

    .search-form {
        height: 34px;
    }

    .search-input {
        font-size: 16px;
    }

    .navbar-bottom {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .navbar-bottom::-webkit-scrollbar {
        display: none;
    }

    .navbar-bottom-inner {
        padding: 2px 12px 4px;
        gap: 0;
    }

    .navbar-bottom-inner > .nav-link,
    .navbar-bottom-inner > .nav-dropdown > .nav-link {
        padding-left: 8px;
        padding-right: 8px;
    }

    .navbar-bottom-inner > .nav-link:first-child,
    .navbar-bottom-inner > .nav-dropdown:first-child > .nav-link {
        padding-left: 0;
    }

    .nav-actions {
        gap: 4px;
    }

    .nav-user,
    .header-cart,
    .header-favorites {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1px;
        padding: 3px 4px 2px;
        line-height: 1;
    }

    .nav-user:hover,
    .header-cart:hover,
    .header-favorites:hover {
        background: transparent;
    }

    .nav-user .lucide-icon,
    .header-cart .lucide-icon,
    .header-favorites .lucide-icon {
        width: 16px;
        height: 16px;
    }

    .favorites-text {
        font-size: 9px;
        font-weight: 600;
        letter-spacing: 0.04em;
    }

    .nav-text {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .nav-greeting {
        display: none;
    }

    .nav-name {
        font-size: 9px;
        font-weight: 600;
        letter-spacing: 0.04em;
        white-space: nowrap;
    }

    .cart-text {
        display: block;
        font-size: 9px;
        font-weight: 600;
        letter-spacing: 0.04em;
    }

    .cart-count {
        top: -4px;
        right: -4px;
        font-size: 10px;
        padding: 1px 4px;
        min-width: 16px;
    }

    .sp-menu-toggle {
        padding: 3px 5px 2px;
    }

    .sp-menu-icon .lucide-icon {
        width: 16px;
        height: 16px;
    }

    .logo-wrap {
        flex-shrink: 1;
        min-width: 0;
        height: 32px;
        gap: 1px;
    }

    .logo {
        height: 18px;
    }

    .logo-tagline {
        font-size: 9px;
    }
}

/* =====================================================
   ログイン誘導モーダル
   ===================================================== */
.sm-login-modal[hidden] {
    display: none;
}

.sm-login-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.sm-login-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    cursor: pointer;
    animation: smModalFade 0.18s ease-out;
}

.sm-login-modal-dialog {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
    padding: 36px 28px 28px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: smModalRise 0.22s ease-out;
}

.sm-login-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.sm-login-modal-close:hover {
    background: #f1f5f9;
}

.sm-login-modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.sm-login-modal-icon .lucide-icon {
    width: 32px;
    height: 32px;
}

.sm-login-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 10px;
    line-height: 1.4;
}

.sm-login-modal-feature {
    color: #dc2626;
}

.sm-login-modal-desc {
    font-size: 14px;
    color: #475569;
    margin: 0 0 24px;
    line-height: 1.6;
}

.sm-login-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sm-login-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s, background 0.15s;
}

.sm-login-modal-btn .lucide-icon {
    width: 18px;
    height: 18px;
}

.sm-login-modal-btn-primary {
    background: var(--primary-color, #2563eb);
    color: #fff;
}

.sm-login-modal-btn-primary:hover {
    opacity: 0.9;
}

.sm-login-modal-btn-secondary {
    background: #f1f5f9;
    color: #0f172a;
}

.sm-login-modal-btn-secondary:hover {
    background: #e2e8f0;
}

body.sm-modal-open {
    overflow: hidden;
}

@keyframes smModalFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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