/* 
 * 自学及集中学习蒙医药理论著作文献平台 - 主样式
 * 蒙古族蓝天白云画风设计
 */

/* ===== CSS变量 ===== */
:root {
    --primary-color: #1e88e5;
    --primary-dark: #1565c0;
    --primary-light: #64b5f6;
    --sky-top: #87CEEB;
    --sky-bottom: #E0F4FF;
    --cloud-white: #ffffff;
    --gold-accent: #D4AF37;
    --mongolian-red: #C41E3A;
    --mongolian-blue: #1e3a5f;
    --text-dark: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --border-color: #e0e0e0;
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.15);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    min-height: 100vh;
    background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 50%, #f5f5f5 100%);
    background-attachment: fixed;
}

/* ===== 工具类 ===== */
.hidden {
    display: none !important;
}

/* ===== 蓝天白云背景 ===== */
.sky-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: linear-gradient(180deg, 
        #4FA4E8 0%, 
        #87CEEB 30%, 
        #B8E0F7 60%, 
        #E8F4FC 100%);
    overflow: hidden;
}

/* 云朵动画 */
.cloud {
    position: absolute;
    background: white;
    border-radius: 100px;
    opacity: 0.9;
    animation: float-cloud 30s linear infinite;
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: white;
    border-radius: 50%;
}

.cloud-1 {
    width: 120px;
    height: 40px;
    top: 10%;
    left: -120px;
    animation-duration: 35s;
}
.cloud-1::before { width: 50px; height: 50px; top: -25px; left: 20px; }
.cloud-1::after { width: 70px; height: 70px; top: -35px; left: 50px; }

.cloud-2 {
    width: 100px;
    height: 35px;
    top: 20%;
    left: -100px;
    animation-duration: 40s;
    animation-delay: 5s;
}
.cloud-2::before { width: 45px; height: 45px; top: -22px; left: 15px; }
.cloud-2::after { width: 60px; height: 60px; top: -30px; left: 40px; }

.cloud-3 {
    width: 80px;
    height: 30px;
    top: 5%;
    left: -80px;
    animation-duration: 45s;
    animation-delay: 10s;
}
.cloud-3::before { width: 35px; height: 35px; top: -18px; left: 10px; }
.cloud-3::after { width: 50px; height: 50px; top: -25px; left: 30px; }

@keyframes float-cloud {
    from { transform: translateX(0); }
    to { transform: translateX(calc(100vw + 150px)); }
}

/* ===== 蒙古族装饰边框 ===== */
.mongolian-border {
    border: 2px solid var(--gold-accent);
    position: relative;
}

.mongolian-border::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border: 1px solid var(--gold-accent);
    pointer-events: none;
}

/* 蒙古族纹样装饰 */
.mongolian-pattern {
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 0L25 10L35 10L27 17L30 27L20 21L10 27L13 17L5 10L15 10Z' fill='%23D4AF37' fill-opacity='0.1'/%3E%3C/svg%3E");
}

/* ===== 页面容器 ===== */
.container {
    max-width: 750px;
    margin: 0 auto;
    padding: 0 15px;
    position: relative;
    z-index: 1;
}

/* ===== 头部样式 ===== */
.header {
    padding: 20px 15px;
    text-align: center;
    position: relative;
}

.header-inner {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 2px solid var(--gold-accent);
}

.site-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--mongolian-blue);
    line-height: 1.4;
    margin-bottom: 8px;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.site-subtitle {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* 我的按钮 */
.profile-btn {
    position: absolute;
    top: 30px;
    right: 25px;
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.profile-btn:hover,
.profile-btn:active {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.profile-btn svg {
    width: 22px;
    height: 22px;
}

/* ===== 返回页头样式 ===== */
.back-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    padding: 0 15px;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.back-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: white;
    text-decoration: none;
    border-radius: 50%;
    transition: background 0.3s;
}

.back-btn:hover,
.back-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

.back-header-title {
    flex: 1;
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
    color: white;
    padding-right: 36px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 里程碑奖励 ===== */
.milestone-banner {
    background: linear-gradient(135deg, var(--gold-accent), #FFC107);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin: 15px 0;
    text-align: center;
    box-shadow: var(--shadow);
    animation: pulse-glow 2s ease-in-out infinite;
}

.milestone-banner.hidden {
    display: none;
}

.milestone-banner h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.milestone-banner p {
    font-size: 0.9rem;
    opacity: 0.95;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(212, 175, 55, 0.5); }
    50% { box-shadow: 0 0 25px rgba(212, 175, 55, 0.8); }
}

/* ===== 图书列表 ===== */
.book-list {
    padding: 10px 0 30px;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

/* 图书卡片 */
.book-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.book-card:hover,
.book-card:active {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.book-cover {
    position: relative;
    padding-top: 140%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    overflow: hidden;
}

.book-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-cover-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 2rem;
    opacity: 0.7;
}

/* 阅读状态标签 */
.book-status {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.book-status.unread {
    background: var(--text-muted);
    color: white;
}

.book-status.reading {
    background: var(--primary-color);
    color: white;
}

.book-status.completed {
    background: #4CAF50;
    color: white;
}

.book-info {
    padding: 12px;
}

.book-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    height: 2.8em;
}

/* 进度条 */
.progress-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-fill.unread {
    width: 0;
    background: var(--text-muted);
}

.progress-fill.reading {
    background: linear-gradient(90deg, var(--primary-light), var(--primary-color));
}

.progress-fill.completed {
    width: 100%;
    background: linear-gradient(90deg, #66BB6A, #4CAF50);
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: right;
}

/* ===== 加载更多 ===== */
.loading-more {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
}

.loading-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.no-more-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 20px 0;
    text-align: center;
}

/* ===== 按钮样式 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(30, 136, 229, 0.3);
}

.btn-primary:hover,
.btn-primary:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 136, 229, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold-accent), #FFC107);
    color: white;
}

.btn-block {
    width: 100%;
}

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

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 8px;
}

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

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
}

.form-select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

/* ===== 卡片容器 ===== */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* ===== 用户头像 ===== */
.user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--gold-accent);
    margin: 0 auto;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

/* ===== 统计数据 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    text-align: center;
}

.stat-item {
    padding: 15px 10px;
    background: linear-gradient(135deg, #f5f5f5, #fafafa);
    border-radius: 12px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== 响应式调整 ===== */
@media screen and (max-width: 375px) {
    html {
        font-size: 14px;
    }
    
    .site-title {
        font-size: 1.2rem;
    }
    
    .book-grid {
        gap: 10px;
    }
}

@media screen and (min-width: 768px) {
    .book-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
