/**
 * 万核基因 - Components CSS
 * 公共组件样式：Header、Footer、Float Tools
 * 版本: 1.0.0
 * 更新: 2026-01-25
 */

/* ==================== Topbar 顶部信息栏 ==================== */
.topbar {
    background: var(--bg-topbar);
    color: #fff;
    font-size: var(--text-base);
    padding: 5px 0;
}

.topbar .wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar-l,
.topbar-r {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-r a {
    color: #fff;
    opacity: 0.85;
}

.topbar-r a:hover {
    opacity: 1;
    color: #fff;
}

.topbar .hotline {
    background: var(--r);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

/* 登录注册 */
.topbar .auth {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topbar .auth a {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.topbar .auth .login {
    background: rgba(255,255,255,0.15);
}

.topbar .auth .login:hover {
    background: rgba(255,255,255,0.25);
}

.topbar .auth .reg {
    background: var(--y);
    opacity: 1;
}

.topbar .auth .reg:hover {
    background: #D97706;
}

.topbar .auth .sep {
    opacity: 0.5;
}

/* ==================== City Switcher 城市切换 ==================== */
.city-switch {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.city-switch svg {
    width: 14px;
    height: 14px;
    opacity: 0.8;
}

.city-switch:hover {
    opacity: 1;
}

.city-switch .arrow {
    width: 10px;
    height: 10px;
    transition: transform var(--transition-normal);
}

.city-switch.open .arrow {
    transform: rotate(180deg);
}

.city-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    min-width: 380px;
    z-index: var(--z-modal);
}

.city-popup::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    width: 12px;
    height: 12px;
    background: var(--white);
    transform: rotate(45deg);
    box-shadow: -2px -2px 4px rgba(0,0,0,0.05);
}

.city-switch.open .city-popup {
    display: block;
}

.city-popup-hd {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--c2);
}

.city-popup-hd span {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--c9);
}

.city-popup-hd a {
    font-size: var(--text-sm);
    color: var(--b);
}

.city-popup-hd a:hover {
    text-decoration: underline;
}

.city-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.city-grid a {
    display: block;
    padding: 5px 6px;
    font-size: var(--text-base);
    color: var(--c7);
    border-radius: var(--radius-sm);
    text-align: center;
    transition: var(--transition-fast);
}

.city-grid a:hover {
    background: var(--bb);
    color: var(--b);
}

.city-grid a.hot {
    color: var(--r);
    font-weight: 600;
}

/* ==================== Header 主头部 ==================== */
.header {
    background: var(--bg-header);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.header .wrap {
    display: flex;
    align-items: center;
    height: var(--header-height);
    gap: 12px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 5px;
}

.logo-box {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--b), var(--bl));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-blue);
}

.logo-box svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

.logo-txt {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--b);
}

/* Search 搜索框 */
.search {
    flex: 1;
    max-width: 260px;
    position: relative;
}

.search input {
    width: 100%;
    height: 30px;
    border: 1px solid var(--c3);
    border-radius: var(--radius-sm);
    padding: 0 55px 0 12px;
    font-size: var(--text-base);
    background: var(--c0);
    transition: var(--transition-normal);
}

.search input:focus {
    outline: none;
    border-color: var(--b);
    background: var(--white);
}

.search input::placeholder {
    color: var(--c4);
}

.search-btn {
    position: absolute;
    right: 2px;
    top: 2px;
    height: 26px;
    padding: 0 12px;
    background: var(--b);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.search-btn:hover {
    background: var(--bd);
}

/* Nav 导航 */
.nav {
    display: flex;
    gap: 4px;
}

.nav-item {
    position: relative;
}

.nav-item > a {
    display: block;
    padding: 4px 10px;
    font-size: var(--text-md);
    font-weight: 500;
    color: var(--c6);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.nav-item > a:hover {
    color: var(--b);
    background: var(--bb);
}

.nav-item > a.on {
    color: var(--b);
    font-weight: 700;
}

/* Nav Dropdown */
.nav-item.has-child:hover .nav-drop {
    display: block;
}

.nav-drop {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 8px 0;
    min-width: 140px;
    z-index: var(--z-dropdown);
}

.nav-drop a {
    display: block;
    padding: 6px 16px;
    font-size: var(--text-base);
    color: var(--c6);
}

.nav-drop a:hover {
    background: var(--bb);
    color: var(--b);
}

/* ==================== Citybar 城市快捷栏 ==================== */
.citybar {
    background: var(--white);
    border-bottom: 1px solid var(--c1);
    padding: 6px 0;
    font-size: var(--text-sm);
}

.citybar .wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.city-label {
    color: var(--c9);
    font-weight: 700;
    background: var(--c1);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.city-list {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
}

.city-list a {
    color: var(--c6);
}

.city-list a:hover {
    color: var(--b);
}

.city-list a.hot {
    color: var(--r);
    font-weight: 600;
}

/* ==================== Footer 底部 ==================== */
.footer {
    background: var(--bg-footer);
    color: rgba(255,255,255,0.6);
    padding: 30px 0 16px;
    margin-top: 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr repeat(4, 1fr);
    gap: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.footer-brand h3 {
    font-size: var(--text-xl);
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.footer-brand p {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    margin-bottom: 10px;
}

.footer-phone {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: #fff;
    font-family: var(--font-mono);
}

.footer-col-tt {
    font-size: var(--text-base);
    font-weight: 600;
    color: #fff;
    margin-bottom: 10px;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-links a {
    font-size: var(--text-sm);
    color: rgba(255,255,255,0.6);
}

.footer-links a:hover {
    color: #fff;
}

.footer-bottom {
    padding-top: 16px;
    text-align: center;
    font-size: var(--text-xs);
    opacity: 0.5;
}

.footer-bottom a {
    color: rgba(255,255,255,0.6);
}

.footer-bottom a:hover {
    color: #fff;
}

/* ==================== Float Tools 悬浮工具 ==================== */
.float-tools {
    position: fixed;
    right: 20px;
    bottom: 100px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.float-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-slow);
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    position: relative;
}

.float-btn svg {
    width: 22px;
    height: 22px;
}

.float-btn.calc {
    background: var(--o);
    color: #fff;
}

.float-btn.wechat {
    background: #07C160;
    color: #fff;
}

.float-btn.phone {
    background: var(--b);
    color: #fff;
}

.float-btn.top {
    background: var(--white);
    color: var(--c6);
    border: 1px solid var(--c3);
}

.float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.float-btn.top:hover {
    color: var(--b);
    border-color: var(--b);
}

/* Tooltip */
.float-btn .tip {
    position: absolute;
    right: 58px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: #fff;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-slow);
}

.float-btn .tip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #333;
}

.float-btn:hover .tip {
    opacity: 1;
    visibility: visible;
}

/* QR Code Popup */
.float-btn .qrcode {
    position: absolute;
    right: 58px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--white);
    padding: 10px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-slow);
}

.float-btn .qrcode img {
    width: 120px;
    height: 120px;
    display: block;
}

.float-btn .qrcode p {
    text-align: center;
    font-size: var(--text-sm);
    color: var(--c6);
    margin-top: 6px;
}

.float-btn:hover .qrcode {
    opacity: 1;
    visibility: visible;
}

/* ==================== Responsive 响应式 ==================== */
@media (max-width: 768px) {
    /* Topbar */
    .topbar-l {
        display: none;
    }
    
    /* Header */
    .header .wrap {
        height: 44px;
    }
    
    .nav {
        display: none;
    }
    
    .search {
        max-width: none;
    }
    
    /* City Popup */
    .city-popup {
        min-width: 300px;
        left: -10px;
    }
    
    .city-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Float Tools */
    .float-tools {
        right: 10px;
        bottom: 80px;
    }
    
    .float-btn {
        width: 40px;
        height: 40px;
    }
    
    .float-btn svg {
        width: 18px;
        height: 18px;
    }
}
