/* ============================================================
 * layout.css - 布局（顶栏、底栏 Tab、搜索栏、内容区）
 * 完美还原一线天风格截图
 * 移动端优先（375px 基准）
 * ============================================================ */

/* ===== 顶部导航栏 - 首页白色 / 其他页面粉红 ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    color: #333;
    z-index: 100;
}

/* 非首页：粉红背景 + 白色文字/图标 */
.navbar-pink {
    background: #FF5068;
    border-bottom: none;
    color: #fff;
}

.navbar-pink .navbar-title,
.navbar-pink .navbar-back,
.navbar-pink .navbar-icon,
.navbar-pink .navbar-menu-btn {
    color: #fff;
}

.navbar-pink .navbar-icon:hover,
.navbar-pink .navbar-icon:active {
    background: rgba(255, 255, 255, 0.18);
}

@media (min-width: 768px) {
    .navbar {
        max-width: var(--max-width);
        margin: 0 auto;
    }
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 var(--spacing-md);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    min-width: 0;
}

.navbar-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #333;
    transition: var(--transition);
}

.navbar-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #333;
    border-radius: 50%;
    transition: var(--transition);
    flex-shrink: 0;
}

.navbar-title {
    font-size: var(--font-md);
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 首页图片 Logo */
.navbar-logo-link {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.navbar-logo-img {
    height: 50px;
    width: auto;
    display: block;
    flex-shrink: 0;
}

@media (max-width: 375px) {
    .navbar-logo-img {
        height: 42px;
    }
}

/* 站点图标（截图中的小图片图标） */
.navbar-logo-icon {
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 3px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.navbar-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: #333;
    border-radius: 50%;
    transition: var(--transition);
}

.navbar-icon:hover,
.navbar-icon:active {
    background: rgba(0, 0, 0, 0.06);
}

.navbar-notification .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #FFE03A;
    color: var(--primary-dark);
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
}

/* ===== 搜索栏区域（含左侧汉堡菜单）===== */
.search-bar-wrap {
    background: #f5f5f5; /* 浅灰背景 */
    padding: 10px var(--spacing-md) 12px;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    z-index: 99;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* 汉堡菜单按钮（搜索栏左侧）*/
.hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #FF5068; /* 粉红色三条线 */
    flex-shrink: 0;
    cursor: pointer;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border-radius: var(--border-radius-pill);
    padding: 0 12px 0 14px;
    height: 36px;
    flex: 1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.search-input {
    flex: 1;
    font-size: 14px;
    color: #333;
    background: transparent;
    height: 36px;
}

.search-input::placeholder {
    color: #bbb;
}

.search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #999;
    transition: var(--transition);
    flex-shrink: 0;
}

.search-plus-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1.5px solid #ddd;
    border-radius: 50%;
    color: #666;
    font-size: 22px;
    line-height: 1;
    transition: var(--transition);
    flex-shrink: 0;
    cursor: pointer;
}

.search-plus-btn:hover,
.search-plus-btn:active {
    border-color: #FF5068;
    color: #FF5068;
}

/* ===== 首页Tab导航（粉红背景 + 白字）===== */
.home-tabs {
    display: flex;
    background: #FF5068; /* 与导航栏同色 */
    padding: 0 var(--spacing-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: fixed;
    top: calc(var(--navbar-height) + 58px); /* navbar + search-bar-wrap高度 */
    left: 0;
    right: 0;
    z-index: 98;
}

.home-tab-item {
    flex-shrink: 0;
    text-align: center;
    padding: 9px 16px;
    font-size: 15px;
    font-weight: 500;
    color: rgba(255,255,255,0.7); /* 半透明白 */
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
}

.home-tab-item.active {
    color: #fff;
    font-weight: 700;
    position: relative;
}

/* 截图中选中的tab下方有白色下划线或高亮效果 */
.home-tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: #fff;
    border-radius: 2px;
}

.home-tab-item:not(.active):active {
    color: rgba(255,255,255,0.95);
}

/* ===== 主内容区 ===== */
.main-content {
    padding-top: calc(var(--navbar-height) + 58px + 42px); /* navbar(50) + search-bar-wrap(约58) + home-tabs(42) */
    padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
    min-height: 100vh;
}

/* 非首页不需要额外的顶部padding */
body:not(.page-home) .main-content {
    padding-top: var(--navbar-height);
}

/* ===== 底部 Tab 栏（5个Tab）===== */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tabbar-height);
    background: #fff;
    border-top: 1px solid #e8e8e8;
    display: flex;
    z-index: 100;
    box-shadow: 0 -1px 6px rgba(0,0,0,0.04);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (min-width: 768px) {
    .tabbar {
        max-width: var(--max-width);
        margin: 0 auto;
    }
}

.tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #999;
    transition: var(--transition);
    min-height: 44px;
    position: relative;
}

.tabbar-item svg {
    stroke: currentColor;
    fill: none;
}

/* 底部 Tab 图片图标（jpg，原版保留）— 严格限制尺寸 */
.tabbar-icon-img {
    width: 25px !important;
    height: 25px !important;
    max-width: 25px !important;
    max-height: 25px !important;
    object-fit: contain;
    display: block;
}

/* 底部 Tab SVG 图标（实心彩色造型，颜色由 SVG 内部 fill 决定） */
.tabbar-item .tabbar-icon-svg {
    width: 25px;
    height: 25px;
    display: block;
    stroke: none;
}

.tabbar-item span {
    font-size: 11px;
}

.tabbar-item.active {
    color: #FF5068; /* 选中为粉红色 */
}

/* Tab 栏角标（红底白字数字） */
.tabbar-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tabbar-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    padding: 0 4px;
    background: #fa5151;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 5;
    pointer-events: none;
}

.tabbar-badge.hidden {
    display: none;
}

/* ===== 回到顶部按钮 ===== */
.back-to-top {
    position: fixed;
    right: 12px;
    bottom: calc(var(--tabbar-height) + 12px);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    color: #999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
    transition: var(--transition);
}

.back-to-top:hover,
.back-to-top:active {
    background: #FF5068;
    color: #fff;
}

@media (min-width: 768px) {
    .back-to-top {
        right: calc(50% - var(--max-width) / 2 + 12px);
    }
}
