/* ============================================
   公共样式 - 全站共享
   ============================================ */

/* --- CSS 变量 --- */
:root {
    --primary: #1e88e5;
    --primary-dark: #1565c0;
    --primary-light: #64b5f6;
    --accent: #ff6f00;
    --accent-light: #ff8f00;
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #666666;
    --border: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset + Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overscroll-behavior: contain;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

/* --- 容器 --- */
.box { max-width: 1400px; margin: 0 auto; padding: 20px; }

/* ============================================
   导航栏
   ============================================ */
.site-header {
    background: #fff;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
    position: relative;
}

.site-header__brand {
    flex-shrink: 0;
}

.site-header__logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    transition: var(--transition);
}

.site-header__logo:hover {
    color: var(--primary);
}

/* 汉堡菜单 - 默认隐藏 */
.site-header__toggle-checkbox {
    display: none;
}

.site-header__toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    width: 44px;
    height: 44px;
    padding: 11px;
    z-index: 10;
}

.site-header__toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

.site-header__toggle-bar + .site-header__toggle-bar {
    margin-top: 5px;
}

/* 汉堡 → X 动画 */
.site-header__toggle-checkbox:checked ~ .site-header__toggle .site-header__toggle-bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.site-header__toggle-checkbox:checked ~ .site-header__toggle .site-header__toggle-bar:nth-child(2) {
    opacity: 0;
}
.site-header__toggle-checkbox:checked ~ .site-header__toggle .site-header__toggle-bar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* 导航链接 */
.site-header__nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

/* 移动端品牌链接 - 桌面端隐藏 */
.site-header__nav .nav-brand-mobile {
    display: none;
}

.site-header__nav-link {
    padding: 8px 16px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    white-space: nowrap;
}

.site-header__nav-link:hover {
    color: var(--primary);
    background: rgba(30, 136, 229, 0.08);
}

.site-header__nav-link--active {
    color: var(--primary);
    font-weight: 600;
}

/* 认证区域 */
.site-header__auth {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-header__auth-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ============================================
   按钮组件
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn--primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn--ghost {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn--ghost:hover {
    background: var(--primary);
    color: #fff;
}

.btn--sm {
    padding: 6px 16px;
    font-size: 13px;
}

.btn--lg {
    padding: 14px 40px;
    font-size: 16px;
    border-radius: var(--radius-md);
}

/* ============================================
   用户头像下拉菜单
   ============================================ */
.user-avatar-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 30px;
    transition: background-color 0.3s;
}

.user-avatar-container:hover {
    background-color: rgba(0,0,0,0.04);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 16px;
    font-weight: bold;
    transition: var(--transition);
}

.user-avatar:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.user-name {
    display: inline-block;
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.user-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-item {
    display: block;
    padding: 12px 20px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
    border-bottom: 1px solid #f0f0f0;
}

.user-dropdown-item:last-child { border-bottom: none; }
.user-dropdown-item:hover { background: #f5f5f5; color: var(--primary); }

/* ============================================
   页面标题栏（统一渐变头部）
   ============================================ */
.page-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 30px 40px;
    border-radius: var(--radius-md);
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
}

.page-header h1, .page-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header p {
    font-size: 15px;
    opacity: 0.9;
    margin-top: 8px;
    position: relative;
    z-index: 1;
}

/* ============================================
   轮播图
   ============================================ */
.layui-carousel {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}
.layui-carousel > * { height: 100% !important; }

/* ============================================
   底部
   ============================================ */
.site-footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #ecf0f1;
    padding: 30px 0;
    margin-top: 40px;
    border-top: 3px solid var(--primary);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-info {
    margin-bottom: 20px;
}

.footer-company,
.footer-icp {
    font-size: 14px;
    line-height: 2;
    margin: 0;
    color: #bdc3c7;
}

.footer-icp a {
    color: #bdc3c7;
    text-decoration: none;
}

.footer-icp a:hover {
    color: #ecf0f1;
    text-decoration: underline;
}

.footer-label {
    color: #95a5a6;
    font-weight: 500;
}

.footer-value {
    color: #ecf0f1;
    font-weight: 600;
}

.footer-divider {
    margin: 0 15px;
    color: #7f8c8d;
}

.footer-link {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #5dade2;
    text-decoration: underline;
}

.footer-copyright {
    padding-top: 20px;
    border-top: 1px solid #4a6278;
    font-size: 13px;
    color: #7f8c8d;
}

.footer-copyright p {
    margin: 0;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 768px) {
    .box { padding: 15px; }

    /* 轮播图缩小 */
    .layui-carousel { margin-bottom: 20px; height: 200px !important; }
    .layui-carousel > * { height: 100% !important; }

    /* 汉堡按钮显示 */
    .site-header__toggle {
        display: flex;
    }

    .site-header__inner {
        flex-wrap: wrap;
        height: auto;
        padding: 0;
        gap: 0;
    }

    /* 顶部栏：汉堡 + 认证 */
    .site-header__brand {
        display: none;
    }

    .site-header__auth {
        margin-left: auto;
    }

    .site-header__auth-buttons .btn {
        padding: 8px 14px;
        font-size: 13px;
        min-height: 36px;
    }

    /* 导航展开面板 */
    .site-header__nav {
        display: none;
        width: 100%;
        flex-direction: column;
        padding: 0;
        gap: 0;
        background: #fff;
        border-top: 1px solid var(--border);
    }

    .site-header__toggle-checkbox:checked ~ .site-header__nav {
        display: flex;
    }

    /* 站点名称 - 仅在展开菜单中显示 */
    .site-header__nav .nav-brand-mobile {
        display: block;
        padding: 16px 20px 12px;
        font-size: 18px;
        font-weight: 700;
        color: var(--text);
        border-bottom: 1px solid var(--border);
        text-decoration: none;
    }

    /* 隐藏独立首页链接（nav-brand-mobile 已覆盖） */
    .site-header__nav .nav-home-link {
        display: none;
    }

    .site-header__nav-link {
        padding: 14px 20px;
        border-radius: 0;
        font-size: 15px;
        border-bottom: 1px solid #f5f5f5;
    }

    .site-header__nav-link:active {
        background: #f0f7ff;
    }

    /* 页面标题栏 */
    .page-header {
        padding: 25px 20px;
    }

    .page-header h1, .page-header h2 {
        font-size: 1.5rem;
    }

    /* 底部 */
    .site-footer { padding: 20px 0; }
    .footer-divider { display: none; }
    .footer-company, .footer-icp { font-size: 13px; line-height: 1.8; }
}

@media (max-width: 480px) {
    .page-header {
        padding: 20px 15px;
    }
    .page-header h1, .page-header h2 {
        font-size: 1.3rem;
    }
}
