/* ========================================
   全局重置 & 设计变量
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* 主色 - 橙红渐变，更显活力 */
    --primary-start: #FF6B35;
    --primary-end: #FF3D00;
    --primary-light: #FF8A65;
    --primary-bg: #FFF3ED;

    /* 中性色 */
    --secondary: #1A1A2E;
    --gray-dark: #3D3D4E;
    --gray: #8E8E9A;
    --gray-light: #E8E8EE;
    --bg: #F2F2F7;        /* iOS 风格背景 */
    --white: #FFFFFF;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    /* 安全区 */
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", system-ui, sans-serif;
    background: var(--bg);
    color: var(--secondary);
    font-size: 15px;
    line-height: 1.5;
    padding-bottom: calc(76px + var(--safe-bottom));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}
img {
    display: block;
    max-width: 100%;
}

/* ========================================
   顶部导航栏 (仿iOS大标题风格)
   ======================================== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 16px rgba(255, 61, 0, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.header-left,
.header-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.header-center {
    flex: 1;
    text-align: center;
    padding: 0 8px;
}

.logo-img {
    height: 32px;
    width: auto;
    border-radius: 6px;
}
.logo-text {
    font-size: 28px;
    line-height: 1;
}

.site-name {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

/* 三条杠菜单按钮 */
.menu-toggle {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 6px 5px;
    cursor: pointer;
    transition: background 0.2s;
}
.menu-toggle:active {
    background: rgba(255, 255, 255, 0.35);
}
.menu-toggle span {
    display: block;
    width: 18px;
    height: 2.5px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}
.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
   侧边菜单 (毛玻璃效果)
   ======================================== */
.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    pointer-events: none;
}
.side-menu.active {
    pointer-events: auto;
}
.side-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.35s ease;
}
.side-menu.active .side-menu-overlay {
    opacity: 1;
}
.side-menu-content {
    position: absolute;
    top: 0;
    right: -300px;
    width: 290px;
    height: 100%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: right 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.side-menu.active .side-menu-content {
    right: 0;
}

.side-menu-header {
    padding: 28px 20px 20px;
    background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
    color: #fff;
    border-radius: 0 0 24px 24px;
    flex-shrink: 0;
}
.side-user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.side-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.side-nickname {
    font-size: 18px;
    font-weight: 700;
    margin-top: 4px;
}
.side-amount {
    font-size: 14px;
    opacity: 0.9;
}
.side-login-btn {
    display: inline-block;
    padding: 8px 28px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    color: #fff;
    font-size: 15px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
}

.side-nav {
    padding: 16px 0 30px;
    flex: 1;
}
.side-nav-item {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 500;
    color: var(--secondary);
    transition: all 0.2s;
    border-left: 4px solid transparent;
}
.side-nav-item:active {
    background: var(--gray-light);
}
.side-nav-item .nav-icon {
    margin-right: 16px;
    font-size: 20px;
    width: 28px;
    text-align: center;
}
.side-nav-item.active {
    border-left-color: var(--primary-start);
    background: var(--primary-bg);
    color: var(--primary-start);
}

/* ========================================
   主体内容
   ======================================== */
.app-main {
    margin-top: 64px;
    min-height: calc(100vh - 64px - 76px);
    padding: 16px 16px 24px;
}

/* ========================================
   底部导航 (仿原生tab)
   ======================================== */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(72px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
}
.tab-bar {
    display: flex;
    height: 72px;
    align-items: stretch;
}
.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    font-size: 11px;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
    padding: 4px 0;
}
.tab-item.active {
    color: var(--primary-start);
}
.tab-item .tab-icon {
    font-size: 26px;
    line-height: 1;
    margin-bottom: 2px;
    transition: transform 0.2s;
}
.tab-item.active .tab-icon {
    transform: scale(1.05);
}
.tab-item .tab-label {
    font-size: 10px;
    letter-spacing: 0.3px;
}
.tab-item .badge {
    position: absolute;
    top: 6px;
    right: 50%;
    transform: translateX(20px);
    background: #FF4757;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
}

/* ========================================
   通用工具类
   ======================================== */
.empty-tip {
    text-align: center;
    padding: 48px 16px;
    color: var(--gray);
    font-size: 15px;
}
.text-center { text-align: center; }
.text-muted { color: var(--gray); }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }

/* ========================================
   响应式 (大屏居中)
   ======================================== */
@media (min-width: 768px) {
    .app-main {
        max-width: 480px;
        margin-left: auto;
        margin-right: auto;
        padding-left: 20px;
        padding-right: 20px;
    }
    .app-footer {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }
    .app-header {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }
}