﻿/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(23,43,92,0.03);
    padding: 14px 0;
}

    .header .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

.header-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo {
    font-size: 25px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-img {
    height: 28px;
    width: auto;
    flex-shrink: 0;
}

.nav {
    display: flex;
    gap: 32px;
}

    .nav a {
        font-size: 16px;
        color: var(--text-3);
        font-weight: 500;
        padding: 6px 0;
        position: relative;
        transition: color 0.2s ease;
    }

        .nav a::after {
            content: '';
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            height: 2px;
            background: var(--brand);
            transform: scaleX(0);
            transform-origin: center;
            transition: transform 0.25s ease;
        }

        .nav a.active {
            color: var(--brand);
            font-weight: 600;
        }

            .nav a.active::after {
                transform: scaleX(1);
            }

        .nav a:hover {
            color: var(--brand);
        }

            .nav a:hover::after {
                transform: scaleX(1);
            }

.btn-login {
    background: var(--brand);
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

    .btn-login:hover {
        background: var(--brand-600);
        box-shadow: var(--shadow-md);
    }

/* Header actions group (right side) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Register button - outline style */
.btn-register {
    background: transparent;
    color: var(--brand);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border: 1px solid var(--brand);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

    .btn-register:hover {
        background: var(--brand-50);
        box-shadow: var(--shadow-sm);
    }

/* User info area */
.user-info {
    gap: 10px;
}

.user-avatar {
    color: var(--brand);
    flex-shrink: 0;
}

.user-name {
    font-size: 14px;
    color: var(--text-2);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s ease;
}

    .user-name:hover {
        color: var(--brand);
    }

/* Logout button - outline style */
.btn-logout {
    background: transparent;
    color: var(--text-3);
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

    .btn-logout:hover {
        color: #e53e3e;
        border-color: #e53e3e;
        background: #fef2f2;
    }

/* 账号悬停下拉菜单（订阅有效期/会员中心/退出登录） */
.uhm-wrap {
    position: relative;
}

/* 触发器与下拉之间 8px 空隙的透明桥：鼠标下移经过空隙时仍视为悬停在容器上，下拉不会消失 */
.uhm-wrap::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 8px;
}

.uhm-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.uhm-trigger:hover {
    background: var(--brand-50);
}

.uhm-caret {
    font-style: normal;
    font-size: 12px;
    color: var(--text-3);
    transition: transform 0.2s ease;
}

.uhm-wrap:hover .uhm-caret {
    transform: rotate(180deg);
}

.uhm-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 200px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(23, 43, 92, 0.14);
    border: 1px solid var(--border);
    padding: 6px;
    z-index: 200;
    animation: uhmIn 0.16s ease-out;
}

@keyframes uhmIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.uhm-wrap:hover .uhm-dropdown {
    display: block;
}

.uhm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-2);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.uhm-item:hover {
    background: var(--brand-50);
    color: var(--brand);
}

.uhm-ico {
    font-style: normal;
    width: 16px;
    text-align: center;
    color: #9aa3b5;
}

.uhm-item.uhm-sub {
    cursor: default;
}

.uhm-item.uhm-sub:hover {
    background: transparent;
    color: var(--text-2);
}

.uhm-item.uhm-sub .uhm-sub-date {
    margin-left: auto;
    color: #e6a23c;
    font-weight: 600;
    font-size: 14px;
}

.uhm-item.uhm-logout {
    color: #e53e3e;
}

.uhm-item.uhm-logout:hover {
    background: #fef2f2;
    color: #e53e3e;
}

/* Responsive */
@media (max-width: 900px) {
    .header-actions {
        gap: 8px;
    }

    .btn-login,
    .btn-register {
        padding: 8px 16px;
        font-size: 14px;
    }

    .user-name {
        font-size: 13px;
    }

    .btn-logout {
        padding: 5px 12px;
        font-size: 12px;
    }
}

/* 平板 / 大手机 */
@media (max-width: 768px) {
    .header {
        padding: 10px 0;
    }
    .header-left {
        gap: 16px;
    }
    .logo {
        font-size: 18px;
        gap: 6px;
    }
    .logo-img {
        height: 22px;
    }
    .nav {
        gap: 16px;
    }
    .nav a {
        font-size: 14px;
        padding: 4px 0;
    }
    .btn-login,
    .btn-register {
        padding: 7px 14px;
        font-size: 13px;
    }
    .header-actions {
        gap: 6px;
    }
}

/* 手机 */
@media (max-width: 480px) {
    .header {
        padding: 8px 0;
    }
    .header-left {
        gap: 10px;
    }
    .logo {
        font-size: 15px;
        gap: 4px;
        /* 隐藏 logo 后文字，只保留图片 */
    }
    /* 很窄时隐藏"造价建材库网"文字只留图片，给导航腾空间 */
    .logo {
        font-size: 0;
    }
    .logo-img {
        height: 22px;
    }
    .nav {
        gap: 12px;
    }
    .nav a {
        font-size: 13px;
        padding: 6px 0;
    }
    .btn-login,
    .btn-register {
        padding: 6px 10px;
        font-size: 12px;
    }
    .btn-login svg,
    .btn-register svg {
        width: 13px;
        height: 13px;
    }
    .btn-login {
        gap: 3px;
    }
    .btn-register {
        gap: 3px;
    }
    .header-actions {
        gap: 5px;
    }
    .user-name {
        font-size: 12px;
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .btn-logout {
        padding: 4px 8px;
        font-size: 11px;
    }
}
