/* ========================
   亲子时光 - 全局样式
   ======================== */

/* CSS 变量 */
:root {
    --primary: #FF7B89;
    --primary-dark: #E86574;
    --primary-light: #FFF0F2;
    --secondary: #8ECAE6;
    --secondary-light: #E8F4FA;
    --bg: #FFF8F6;
    --bg-white: #FFFFFF;
    --text: #2D3436;
    --text-light: #636E72;
    --text-lighter: #B2BEC3;
    --border: #EEE5E3;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --success: #00B894;
    --warning: #FDCB6E;
    --danger: #E17055;
    --max-width: 1200px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 16px;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }
a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }

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

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}
.logo:hover { color: var(--primary); }
.logo-icon { font-size: 1.8rem; }

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 8px;
}

.main-nav a {
    padding: 8px 16px;
    border-radius: 20px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
}
.main-nav a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-form {
    display: flex;
    border: 2px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.search-form:focus-within { border-color: var(--primary); }

.search-form input {
    border: none;
    padding: 8px 16px;
    width: 180px;
    font-size: 0.9rem;
    outline: none;
    background: transparent;
}
.search-form button {
    background: var(--primary);
    border: none;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 1rem;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
}

/* ==================== Hero ==================== */
.hero {
    background: linear-gradient(135deg, #FFF0F2 0%, #FFF8F6 50%, #E8F4FA 100%);
    padding: 80px 20px;
    text-align: center;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 16px;
}
.hero .highlight {
    color: var(--primary);
    position: relative;
}
.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 36px;
}

.hero-search {
    max-width: 520px;
    margin: 0 auto;
}
.hero-search form {
    display: flex;
    box-shadow: var(--shadow-lg);
    border-radius: 32px;
    overflow: hidden;
}
.hero-search input {
    flex: 1;
    border: none;
    padding: 16px 24px;
    font-size: 1.05rem;
    outline: none;
}
.hero-search button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 16px 32px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.hero-search button:hover { background: var(--primary-dark); }

/* ==================== 阶段导航卡片 ==================== */
.stage-cards { padding: 60px 0; }

.section-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 36px;
    color: var(--text);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.stage-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    color: var(--text);
    display: block;
}
.stage-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    color: var(--text);
}
.stage-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}
.stage-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text);
}
.stage-card p {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ==================== 文章列表 ==================== */
.latest-articles, .popular-articles, .articles-section {
    padding: 0 0 60px;
}
.popular-articles { background: var(--bg-white); padding: 60px 0; }

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.article-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.article-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.article-cover {
    height: 200px;
    overflow: hidden;
}
.article-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.article-info {
    padding: 20px;
}
.article-category {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 10px;
}
.article-info h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    line-height: 1.5;
}
.article-info h3 a { color: var(--text); }
.article-info h3 a:hover { color: var(--primary); }
.article-summary {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}
.article-meta {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-lighter);
}

/* ==================== 文章详情 ==================== */
.article-detail { padding: 40px 0 60px; }
.article-detail .container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    align-items: start;
}

.breadcrumb {
    font-size: 0.9rem;
    margin-bottom: 24px;
    color: var(--text-lighter);
}
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 4px; }

.article-header {
    margin-bottom: 24px;
}
.article-header h1 {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.4;
    margin-bottom: 16px;
}

.article-meta-detail {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 4px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.article-cover-full {
    margin-bottom: 32px;
    border-radius: var(--radius);
    overflow: hidden;
}
.article-cover-full img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

.article-content {
    background: var(--bg-white);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    line-height: 1.9;
    font-size: 1.05rem;
}

.article-content h2 {
    font-size: 1.5rem;
    margin: 32px 0 16px;
    color: var(--primary-dark);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}
.article-content h3 {
    font-size: 1.2rem;
    margin: 24px 0 12px;
}
.article-content p { margin-bottom: 16px; }
.article-content ul, .article-content ol {
    margin: 12px 0 16px 24px;
}
.article-content li { margin-bottom: 8px; }
.article-content strong { color: var(--primary-dark); }

/* 富文本内容样式 */
.article-content .video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin: 20px 0;
    border-radius: var(--radius-sm);
}
.article-content .video-wrapper iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}
.article-content .audio-wrapper {
    margin: 16px 0;
    padding: 16px;
    background: #f9f9f9;
    border-radius: var(--radius-sm);
}
.article-content .audio-wrapper audio {
    width: 100%;
    border-radius: 4px;
}
.article-content img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 12px 0;
}
.article-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 8px 16px;
    margin: 16px 0;
    color: var(--text-light);
    background: var(--primary-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.article-content pre {
    background: #282c34;
    color: #abb2bf;
    padding: 20px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 16px 0;
    font-size: 0.9em;
    line-height: 1.6;
}
.article-content code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}
.article-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* 相关推荐 */
.related-articles {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 84px;
}
.related-articles h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}
.related-item {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.related-item:last-child { border-bottom: none; }
.related-item h4 {
    font-size: 0.95rem;
    margin-bottom: 4px;
    line-height: 1.5;
}
.related-item span {
    font-size: 0.8rem;
    color: var(--text-lighter);
}
.related-item:hover h4 { color: var(--primary); }

/* ==================== 搜索页 ==================== */
.search-page { padding: 40px 0 60px; }
.search-page-header {
    text-align: center;
    margin-bottom: 40px;
}
.search-page-header h1 { font-size: 2rem; margin-bottom: 24px; }
.search-form-large {
    display: flex;
    max-width: 520px;
    margin: 0 auto;
    border: 2px solid var(--border);
    border-radius: 32px;
    overflow: hidden;
}
.search-form-large:focus-within { border-color: var(--primary); }
.search-form-large input {
    flex: 1;
    border: none;
    padding: 14px 24px;
    font-size: 1.05rem;
    outline: none;
}
.search-form-large button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 28px;
    font-size: 1rem;
    cursor: pointer;
}
.search-count { text-align: center; margin-bottom: 24px; color: var(--text-light); }
.search-empty, .empty-results {
    text-align: center;
    padding: 60px 0;
    color: var(--text-light);
    font-size: 1.1rem;
}

/* ==================== 页脚 ==================== */
.site-footer {
    background: #2D3436;
    color: #B2BEC3;
    padding: 48px 0 24px;
}
.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 32px;
}
.footer-about h3 { color: white; margin-bottom: 12px; font-size: 1.2rem; }
.footer-links h4 { color: white; margin-bottom: 12px; font-size: 1rem; }
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: #B2BEC3; font-size: 0.9rem; }
.footer-links a:hover { color: var(--primary); }
.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid #3D4648;
    text-align: center;
    font-size: 0.85rem;
}
.footer-bottom .icp {
    margin-top: 6px;
    font-size: 0.8rem;
}
.footer-bottom .icp a {
    color: #636E72;
}
.footer-bottom .icp a:hover {
    color: var(--primary);
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
}
.page-btn {
    padding: 8px 24px;
    background: var(--bg-white);
    border-radius: 24px;
    color: var(--text);
    box-shadow: var(--shadow);
    font-size: 0.9rem;
}
.page-btn:hover { background: var(--primary-light); color: var(--primary); }
.page-info { color: var(--text-light); font-size: 0.9rem; }

.empty-text {
    text-align: center;
    padding: 60px 0;
    color: var(--text-lighter);
    font-size: 1rem;
}
.empty-text a { color: var(--primary); }

/* ==================== Page Header ==================== */
.page-header {
    background: linear-gradient(135deg, #FFF0F2, #E8F4FA);
    padding: 48px 0;
    text-align: center;
}
.page-header h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 8px; }
.page-desc { color: var(--text-light); font-size: 1.05rem; }

/* ==================== 后台通用样式 ==================== */
.admin-body { background: #F5F6FA; }

.admin-header {
    background: #2D3436;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}
.admin-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.admin-logo {
    color: white;
    font-weight: 700;
    font-size: 1.05rem;
}
.admin-nav { display: flex; gap: 4px; }
.admin-nav a {
    color: #B2BEC3;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}
.admin-nav a:hover, .admin-nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}
.admin-nav .logout-link { color: var(--danger); }
.admin-nav .logout-link:hover { background: rgba(225, 112, 85, 0.2); }

.admin-main { padding: 32px 0 60px; }

.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 24px; }

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header-row .page-title { margin-bottom: 0; }

/* Flash 消息 */
.flash-messages { margin-top: 16px; }
.flash-message {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.flash-info { background: #E8F4FA; color: #0984E3; }
.flash-error { background: #FFE0DC; color: #D63031; }
.flash-success { background: #DFFFE0; color: #00B894; }

/* ==================== 仪表盘 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}
.stat-published { border-left-color: var(--success); }
.stat-draft { border-left-color: var(--warning); }
.stat-categories { border-left-color: var(--secondary); }

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}
.stat-label { color: var(--text-light); font-size: 0.9rem; }

.dashboard-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
}

/* ==================== 按钮 ==================== */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-align: center;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-secondary { background: var(--bg-white); color: var(--text); box-shadow: var(--shadow); }
.btn-secondary:hover { background: var(--bg); }
.btn-warning { background: var(--warning); color: #6D5E00; }
.btn-warning:hover { background: #F0C060; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #D05A45; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: 16px; }
.btn-lg { padding: 14px 36px; font-size: 1.05rem; }
.btn-full { width: 100%; }

/* ==================== 表格 ==================== */
.data-table {
    width: 100%;
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border-collapse: collapse;
}
.data-table th {
    background: #F5F6FA;
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.data-table td {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}
.data-table tr:hover td { background: #FFFAFA; }
.table-title { max-width: 300px; }
.table-title a { color: var(--text); font-weight: 500; }
.table-title a:hover { color: var(--primary); }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.status-tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}
.status-published { background: #DFFFE0; color: #00B894; }
.status-draft { background: #FFF3D0; color: #B89400; }

/* ==================== 筛选栏 ==================== */
.filter-bar { margin-bottom: 20px; }
.filter-form { display: flex; gap: 12px; }
.filter-form select {
    padding: 8px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    background: var(--bg-white);
    cursor: pointer;
}
.filter-form select:focus { border-color: var(--primary); }

/* ==================== 表单 ==================== */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}
.form-group textarea {
    resize: vertical;
    min-height: 120px;
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}
.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}
.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-lighter);
}
.required { color: var(--danger); }
.form-actions { display: flex; gap: 12px; margin-top: 28px; }

.article-edit-form {
    background: var(--bg-white);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ==================== 弹窗表单 ==================== */
.modal-form {
    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: 200;
}
.modal-content {
    background: var(--bg-white);
    padding: 32px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
}
.modal-content h3 { margin-bottom: 20px; }

/* ==================== 登录页 ==================== */
.login-body {
    background: linear-gradient(135deg, #FFF0F2, #E8F4FA);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
    background: var(--bg-white);
    padding: 48px 36px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.login-header {
    text-align: center;
    margin-bottom: 32px;
}
.login-header h1 { font-size: 3rem; margin-bottom: 8px; }
.login-header h2 { font-size: 1.5rem; color: var(--text); }
.login-header p { color: var(--text-light); margin-top: 4px; }
.login-form .form-group { margin-bottom: 16px; }

/* ==================== 近期文章区域 ==================== */
.recent-section { margin-top: 40px; }
.recent-section h2 { font-size: 1.2rem; margin-bottom: 16px; }

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .hero-subtitle { font-size: 1rem; }

    .main-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-white);
        box-shadow: var(--shadow-lg);
        padding: 16px;
    }
    .main-nav.active { display: block; }
    .main-nav ul { flex-direction: column; gap: 4px; }

    .mobile-menu-btn { display: block; }

    .search-form input { width: 120px; }

    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

    .articles-grid {
        grid-template-columns: 1fr;
    }

    .article-detail .container {
        grid-template-columns: 1fr;
    }
    .related-articles { position: static; margin-top: 32px; }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .form-row { grid-template-columns: 1fr; }

    .page-header-row { flex-direction: column; gap: 12px; align-items: flex-start; }

    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 10px 8px; }
    .table-actions { flex-direction: column; }

    .hero-search form { flex-direction: column; border-radius: var(--radius); }
    .hero-search input { border-radius: var(--radius) var(--radius) 0 0; }
    .hero-search button { border-radius: 0 0 var(--radius) var(--radius); }

    .article-content { padding: 20px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .article-detail .container {
        grid-template-columns: 1fr 250px;
    }
}
