/* 全局样式重置 & 变量 */
:root {
    --primary-color: #07c160;
    --bg-color: #f7f7f7;
    --card-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #888888;
    --border-color: #e5e5e5;
    --tab-active: #07c160;
    --tab-inactive: #999;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --safe-area-bottom: env(safe-area-inset-bottom, 0);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    background-color: var(--bg-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(56px + var(--safe-area-bottom));
    position: relative;
}

/* 折叠文章卡片 - 收起状态 */
.article-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
}

.article-card.collapsed {
    padding-bottom: 14px;
}

/* 卡片头部 (永远显示) */
.article-card-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.article-card-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-primary);
}

.article-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.article-card-meta .account-name {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

/* 展开内容 (折叠时隐藏) */
.article-card-expanded {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.article-card-expanded.show {
    max-height: 500px;
    opacity: 1;
    padding-top: 12px;
}

.article-summary {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.article-card-actions {
    display: flex;
    gap: 8px;
}

.article-card-actions .btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}

.article-card-actions .btn:hover {
    background: var(--bg-color);
}

.article-card-actions .btn.primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.article-card-actions .btn.collect.active {
    background: #fffbe6;
    border-color: #faad14;
    color: #faad14;
}

.article-card:active {
    transform: scale(0.98);
}

/* Tab 内容区 */
#tab-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-page {
    display: none;
    height: 100%;
}

.tab-page.active {
    display: block;
}

.page-header {
    background: var(--card-bg);
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

/* 文章列表 */
.article-list {
    padding: 8px 12px;
}

/* 公众号列表 */
.account-list {
    padding: 8px 12px;
}

.account-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s;
}

.account-card:active {
    transform: scale(0.98);
}

.account-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

.account-info {
    flex: 1;
}

.account-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.account-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.account-article-count {
    color: var(--text-secondary);
    font-size: 12px;
}

/* 我的页面 - 内部顶部分页 */
.my-inner-tabs {
    display: flex;
    background: var(--card-bg);
    margin: 8px 12px 12px;
    border-radius: 12px;
    padding: 4px;
    box-shadow: var(--shadow);
}

.my-inner-tab {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.my-inner-tab.active {
    background: var(--primary-color);
    color: white;
}

.my-inner-content {
    padding-bottom: 12px;
}

.my-inner-page {
    display: none;
}

.my-inner-page.active {
    display: block;
}

.article-list-my {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 12px;
}

.empty-tip {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 24px 0;
}

/* 底部 Tab 栏 */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding-bottom: var(--safe-area-bottom);
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 99;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    color: var(--tab-inactive);
    transition: color 0.2s;
}

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

.tab-icon {
    font-size: 22px;
    line-height: 1;
}

.tab-label {
    font-size: 10px;
    line-height: 1;
}

/* Loading */
.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 0;
    font-size: 14px;
}

/* 适配 iPhone 安全区域 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .tab-bar {
        height: calc(56px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
    }
    #app {
        padding-bottom: calc(56px + env(safe-area-inset-bottom));
    }
}

/* 深色模式可选 */
@media (prefers-color-scheme: dark) {
    /* 保持浅色，微信阅读更舒服 */
}
