/**
 * 电子报系统 - 公共样式
 * 主刊和子刊共用
 * 版本: 2.0.0
 */

/* ============================================================
   1. 重置样式
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f7fa;
    color: #1a2332;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: #1a2332;
    text-decoration: none;
    transition: color 0.3s;
}
a:hover {
    color: #4fc3f7;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
    padding: 0;
}

/* ============================================================
   2. 容器
   ============================================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ============================================================
   3. 头部
   ============================================================ */
.header {
    background: #1a2332;
    color: #fff;
    padding: 12px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    flex-shrink: 0;
}
.logo a {
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo a:hover {
    color: #4fc3f7;
}
.logo img {
    max-height: 50px;
    width: auto;
    display: block;
}

.nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}
.nav a {
    color: rgba(255,255,255,0.7);
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s;
}
.nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
.nav a.active {
    color: #fff;
    background: #4fc3f7;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    flex-direction: column;
    gap: 4px;
}
.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s;
}
.nav-toggle:hover {
    background: rgba(255,255,255,0.1);
}
.nav-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}
.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* ============================================================
   4. 搜索栏
   ============================================================ */
.search-section {
    background: #fff;
    padding: 15px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.search-form {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}
.search-form input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #dce1e8;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.3s;
    outline: none;
    background: #fff;
}
.search-form input:focus {
    border-color: #4fc3f7;
}
.search-form input::placeholder {
    color: #bbb;
}
.search-form button {
    padding: 10px 28px;
    background: #4fc3f7;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
}
.search-form button:hover {
    background: #3ba8d6;
}

/* ============================================================
   5. 版面头部
   ============================================================ */
.edition-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}
.edition-header h2 {
    font-size: 18px;
    margin: 0;
}

.btn-pdf {
    display: inline-block;
    padding: 5px 14px;
    background: #e74c3c;
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
    transition: background 0.3s;
}
.btn-pdf:hover {
    background: #c0392b;
    color: #fff;
}

/* ============================================================
   6. 文章列表
   ============================================================ */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}
.panel-header h2 {
    font-size: 18px;
    margin: 0;
}
.panel-header .article-count {
    font-size: 13px;
    color: #999;
}

.article-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}
.article-list li:last-child {
    border-bottom: none;
}
.article-list .article-title {
    font-size: 15px;
    font-weight: 500;
    color: #1a2332;
    display: block;
    margin-bottom: 4px;
    transition: color 0.3s;
}
.article-list .article-title:hover {
    color: #4fc3f7;
}
.article-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.article-meta .source { color: #666; }
.article-meta .author { color: #666; }
.article-meta .date { color: #bbb; }

/* ============================================================
   7. 版面列表
   ============================================================ */
.edition-list li {
    margin-bottom: 4px;
}
.edition-list a {
    display: block;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s;
    color: #333;
}
.edition-list a:hover {
    background: #f0f2f5;
}
.edition-list a.active {
    background: #4fc3f7;
    color: #fff;
}
.edition-list a.active:hover {
    background: #3ba8d6;
}

/* ============================================================
   8. 分享区域
   ============================================================ */
.share-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.share-label {
    font-size: 13px;
    color: #666;
}
.share-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.share-btn {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    border: none;
    transition: opacity 0.3s;
}
.share-btn:hover {
    opacity: 0.8;
    color: #fff;
}
.share-btn.wechat { background: #07c160; }
.share-btn.weibo { background: #e6162d; }
.share-btn.qq { background: #12b7f5; }
.share-btn.qzone { background: #fdb933; color: #333; }
.share-btn.qzone:hover { color: #333; }

/* ============================================================
   9. 空状态
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: #999;
}
.empty-state .icon {
    font-size: 40px;
    margin-bottom: 10px;
}

/* ============================================================
   10. 加载状态
   ============================================================ */
.loading-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}
.loading-placeholder .spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f0f0f0;
    border-top-color: #4fc3f7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   11. 友情链接
   ============================================================ */
.links-section {
    background: #fff;
    padding: 20px 0;
    margin: 20px 0;
}
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
.link-group h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}
.link-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}
.link-list a {
    font-size: 13px;
    color: #666;
    transition: color 0.3s;
}
.link-list a:hover {
    color: #4fc3f7;
}
.link-list a small {
    color: #bbb;
}

/* ============================================================
   12. 底部
   ============================================================ */
.footer {
    background: #1a2332;
    color: rgba(255,255,255,0.6);
    padding: 40px 0 20px;
    margin-top: 30px;
}
.footer-content {
    margin-bottom: 20px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}
.footer-col h4 {
    color: #fff;
    font-size: 16px;
    margin-bottom: 12px;
    font-weight: 600;
}
.footer-col p {
    font-size: 13px;
    line-height: 1.8;
    color: rgba(255,255,255,0.6);
    margin-bottom: 4px;
}
.footer-col a {
    display: block;
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    padding: 3px 0;
    transition: color 0.3s;
}
.footer-col a:hover {
    color: #4fc3f7;
}
.footer-col .social-links {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.footer-col .social-links a {
    display: inline-block;
    padding: 4px 14px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: all 0.3s;
}
.footer-col .social-links a:hover {
    background: #4fc3f7;
    color: #fff;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 16px;
    text-align: center;
    font-size: 13px;
}
.footer-bottom a {
    color: rgba(255,255,255,0.5);
    transition: color 0.3s;
    margin: 0 4px;
}
.footer-bottom a:hover {
    color: #4fc3f7;
}
.footer-bottom .powered-by {
    color: rgba(255,255,255,0.3);
    margin-left: 10px;
    font-size: 12px;
}

/* ============================================================
   13. Toast 提示
   ============================================================ */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s;
}

/* ============================================================
   14. 回到顶部
   ============================================================ */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: #4fc3f7;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}
.back-to-top:hover {
    background: #3ba8d6;
    transform: translateY(-3px);
}

/* ============================================================
   15. 期刊日历
   ============================================================ */
.journal-calendar {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}
.calendar-header h3 {
    font-size: 16px;
    color: #1a2332;
    margin: 0;
}
.calendar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.calendar-nav .nav-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #dce1e8;
    border-radius: 4px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: #333;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.calendar-nav .nav-btn:hover {
    background: #4fc3f7;
    color: #fff;
    border-color: #4fc3f7;
}
.calendar-nav #calendarTitle {
    font-size: 15px;
    font-weight: 500;
    color: #1a2332;
    min-width: 100px;
    text-align: center;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.calendar-table th {
    font-size: 12px;
    color: #6b7a8a;
    font-weight: 500;
    padding: 4px 0;
    text-align: center;
    border-bottom: 1px solid #e8ecf0;
}
.calendar-table td {
    text-align: center;
    padding: 2px 0;
    font-size: 14px;
    vertical-align: middle;
}
.calendar-table td .day-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    position: relative;
}
.calendar-table td .day-cell:hover {
    background: #f0f2f5;
    transform: scale(1.05);
}
.calendar-table td .day-cell.empty {
    cursor: default;
    color: #ccc;
}
.calendar-table td .day-cell.empty:hover {
    background: transparent;
    transform: none;
}
.calendar-table td .day-cell.has-journal {
    background: #ffebee;
    color: #c62828;
    font-weight: 600;
}
.calendar-table td .day-cell.has-journal:hover {
    background: #ffcdd2;
    transform: scale(1.08);
}
.calendar-table td .day-cell.today {
    border: 2px solid #4fc3f7;
    font-weight: 600;
}
.calendar-table td .day-cell.has-journal.today {
    background: #ffcdd2;
    border-color: #4fc3f7;
}
.calendar-table td .day-cell .journal-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 10;
    margin-bottom: 4px;
}
.calendar-table td .day-cell.has-journal:hover .journal-tooltip {
    display: block;
}

.calendar-legend {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    justify-content: center;
    font-size: 12px;
    color: #6b7a8a;
}
.calendar-legend .legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 4px;
}
.calendar-legend .legend-dot.has-journal {
    background: #ffebee;
    border: 2px solid #c62828;
}
.calendar-legend .legend-dot.today {
    border: 2px solid #4fc3f7;
    background: transparent;
}

/* ============================================================
   16. 微信分享弹窗
   ============================================================ */
.wechat-share-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}
.wechat-share-modal {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    max-width: 380px;
    width: 90%;
    text-align: center;
}
.wechat-share-modal h3 {
    margin-bottom: 10px;
    color: #1a2332;
}
.wechat-share-modal .qr-container {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    margin: 15px 0;
}
.wechat-share-modal .qr-container img {
    max-width: 200px;
    height: auto;
}
.wechat-share-modal .url-display {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    word-break: break-all;
    font-size: 12px;
    color: #999;
}
.wechat-share-modal .close-btn {
    padding: 8px 30px;
    background: #4fc3f7;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}
.wechat-share-modal .close-btn:hover {
    background: #3ba8d6;
}
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ============================================================
   17. 响应式
   ============================================================ */
@media (max-width: 992px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    .nav {
        display: none;
        width: 100%;
        flex-direction: column;
        padding: 10px 0;
    }
    .nav.open {
        display: flex;
    }
    .nav a {
        padding: 10px 14px;
        width: 100%;
        border-radius: 4px;
    }
    .header-inner {
        flex-wrap: wrap;
    }
    .search-form {
        flex-direction: column;
    }
    .search-form button {
        width: 100%;
    }
    .links-grid {
        grid-template-columns: 1fr;
    }
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
    .calendar-table td .day-cell {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    .calendar-nav #calendarTitle {
        font-size: 13px;
        min-width: 80px;
    }
}

@media (max-width: 576px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .wechat-share-modal {
        padding: 20px;
    }
    .back-to-top {
        bottom: 16px;
        right: 16px;
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
}