/* CSS变量定义 - 增强版 */
:root {
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --primary-light: #7f9cf5;
    --secondary-color: #48bb78;
    --accent-color: #ed8936;
    --danger-color: #f56565;
    --text-dark: #1a202c;
    --text-light: #718096;
    --bg-light: #f7fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 50px -5px rgba(0, 0, 0, 0.15);
}

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    overflow-x: hidden;
    max-width: 100vw;
    padding-bottom: 70px; /* 为底部导航预留空间 */
}

/* 按钮基础样式 */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    grid-column: 1 / -1; /* 占满整行 */
}

.empty-state i {
    font-size: 64px;
    color: var(--border-color);
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* 个人中心模态框 */
.personal-center {
    height: 80vh;
    max-height: 600px;
}

.personal-center .modal-body {
    padding: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.user-profile .avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.user-profile .user-info {
    flex: 1;
}

.user-profile .user-info h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
}

.user-profile .user-info p {
    font-size: 14px;
    opacity: 0.9;
}

.personal-menu {
    padding: 10px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.menu-item:active {
    background: var(--bg-light);
}

.menu-item i:first-child {
    width: 20px;
    text-align: center;
    color: var(--primary-color);
}

.menu-item span {
    flex: 1;
    font-size: 16px;
    color: var(--text-dark);
}

.menu-item .fa-chevron-right {
    font-size: 14px;
    color: var(--text-light);
}

.personal-actions {
    padding: 20px;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1003;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(50px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:active {
    background: var(--bg-light);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 60px);
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 36, 66, 0.1);
}

/* 移动端顶部搜索栏样式 - 增强版 */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    padding: 10px 15px;
}

.search-container {
    position: relative;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-light);
    border-radius: 24px;
    padding: 10px 16px;
    transition: all 0.3s ease;
}

.search-bar:focus-within {
    background: white;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.search-bar i {
    color: var(--primary-color);
    font-size: 16px;
    margin-right: 10px;
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    color: var(--text-dark);
}

.search-bar input::placeholder {
    color: var(--text-light);
}

/* 搜索提示词轮播 - 增强版 */
.search-suggestions {
    display: none; /* 默认隐藏 */
    gap: 10px;
    margin-top: 12px;
    overflow-x: auto;
    padding: 5px 0;
    -webkit-overflow-scrolling: touch;
    transition: all 0.3s ease;
    flex-wrap: wrap;
}

.search-suggestions.focus-mode {
    display: flex; /* 聚焦时显示 */
}

.search-suggestions::-webkit-scrollbar {
    display: none;
}

.suggestion-tag {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(127, 156, 245, 0.15));
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.suggestion-tag:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(127, 156, 245, 0.25));
}

/* 分类标签（横向滚动）- 增强版 */
.category-tabs {
    display: flex;
    gap: 12px;
    padding: 15px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    position: fixed;
    top: 88px;
    left: 0;
    right: 0;
    z-index: 999;
    -webkit-overflow-scrolling: touch;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    flex: 0 0 auto;
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    background: var(--bg-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.tab:active {
    transform: scale(0.95);
}

.tab.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    border-color: var(--primary-color);
}

.tab i {
    font-size: 14px;
}

.hot-icon {
    color: #ff6b6b;
    font-size: 12px;
    margin-left: 4px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* 文章信息流 - 增强版（双列瀑布流布局） */
.article-feed {
    margin-top: 148px;
    padding: 10px;
    margin-bottom: 80px; /* 为底部导航预留空间 */
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-items: start;
}

.article-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    cursor: pointer;
    break-inside: avoid;
}

.article-card:active {
    transform: scale(0.98);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.article-cover {
    width: 100%;
    height: auto;
    aspect-ratio: 3/4;
    object-fit: cover;
    background: var(--bg-light);
}

.article-info {
    padding: 10px;
}

.article-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.article-summary {
    display: none; /* 双列布局隐藏摘要，节省空间 */
}

.article-meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--text-light);
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.article-meta i {
    color: var(--primary-color);
    font-size: 12px;
}

/* 点赞按钮样式 */
.article-meta .like-btn {
    cursor: pointer;
    transition: transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.article-meta .like-btn:hover {
    transform: scale(1.1);
}

.article-meta .like-btn i {
    transition: color 0.3s ease;
}

/* 已点赞的爱心 - 使用!important确保优先级 */
.article-meta .like-btn .fas.fa-heart {
    color: #ff4757 !important;
}

/* 点赞动画 */
@keyframes floatHeart {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-30px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.5);
    }
}

/* 搜索结果页面样式 - 增强版 */
.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 88px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    grid-column: 1 / -1; /* 占满整行 */
}

.search-results-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.related-articles-section {
    padding: 20px 15px;
    background: var(--bg-light);
    margin-top: 20px;
    border-radius: 12px;
    grid-column: 1 / -1; /* 占满整行 */
}

.related-articles-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.related-articles-section h3::before {
    content: '\1F525'; /* 火焰emoji */
    font-size: 18px;
}

/* 相关推荐区域也用双列布局 */
.related-articles-section .article-card {
    display: inline-block;
    width: calc(50% - 5px);
    margin-right: 10px;
    margin-bottom: 10px;
    vertical-align: top;
}

.related-articles-section .article-card:nth-child(2n) {
    margin-right: 0;
}

.btn-secondary {
    background: white;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-secondary:active {
    transform: scale(0.95);
    background: var(--bg-light);
}

/* 底部导航栏样式 - 增强版 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    flex: 1;
    text-decoration: none;
    color: var(--text-light);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.nav-item:active {
    transform: scale(0.9);
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 2px;
}

.nav-item i {
    font-size: 22px;
    transition: all 0.3s ease;
}

.nav-item.active i {
    transform: scale(1.1);
}

.nav-item span {
    font-size: 11px;
    font-weight: 500;
}

/* 固定联系栏 - 增强版 */
.fixed-contact-bar {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 2px solid var(--primary-color);
}

.fixed-contact-bar.show {
    transform: translateY(0);
}

.contact-actions {
    display: flex;
    justify-content: space-around;
    padding: 12px 15px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn i {
    font-size: 20px;
}

.action-btn.phone {
    background: linear-gradient(135deg, #48bb78, #38a169);
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

.action-btn.wechat {
    background: linear-gradient(135deg, #38b2ac, #319795);
    box-shadow: 0 4px 15px rgba(56, 178, 172, 0.3);
}
