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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacMacFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

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

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #b91c1c, #991b1b);
}

.btn-blue {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
}

.btn-blue:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.btn-red {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
}

.btn-red:hover {
    background: linear-gradient(135deg, #b91c1c, #991b1b);
}

.btn-gray {
    background: #6b7280;
    color: white;
}

.btn-gray:hover {
    background: #4b5563;
}

.btn-gray:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* 顶部导航 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #dc2626;
    display: flex;
    align-items: center;
}

/* FIX: 控制LOGO图片大小 */
.logo img {
    max-height: 50px;
    width: auto;
}

.nav-desktop {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: #dc2626;
    background: #fef2f2;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-btn span {
    width: 24px;
    height: 3px;
    background: #374151;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-mobile {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 16px 0;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.nav-mobile .nav-link {
    display: block;
    padding: 12px 16px;
}

/* 主页英雄区域 */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fef2f2, #ffffff);
    padding-top: 80px;
}

.hero-content {
    text-align: center;
    max-width: 800px;
}

.hero-images {
    margin-bottom: 48px;
}

.hero-image {
    margin-bottom: 32px;
}

.hero-image img {
    width: 100%;
    height: auto;
    border-radius: 15px;
    background: transparent;
    /* 移除边框和阴影 */
}

.hero-text {
    text-align: center;
    margin-bottom: 48px;
}

.hero-text p {
    font-size: 20px;
    color: #6b7280;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.8s ease-out;
}

.fade-in-delay {
    animation: fadeIn 0.8s ease-out 0.3s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 区块样式 */
.section {
    padding: 80px 0;
}

.section-title {
    font-size: 36px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 48px;
    color: #1f2937;
}

/* 画师信息 */
.artist-info {
    background: #f9fafb;
}

.artist-content {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.artist-avatar img {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.artist-details {
    flex: 1;
}

.artist-name {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 16px;
    color: #1f2937;
}

.artist-alias {
    font-size: 20px;
    color: #6b7280;
    font-weight: normal;
}

.artist-bio {
    margin-bottom: 24px;
    line-height: 1.8;
    color: #4b5563;
}

.artist-actions {
    display: flex;
    gap: 16px;
}

/* 手书故事 */
.story-section {
    background: white;
}

.story-text {
    font-size: 18px;
    line-height: 1.8;
    color: #4b5563;
    text-align: center;
}

/* 作品展示 */
.works-section {
    background: #f9fafb;
}

.works-container {
    display: grid;
    gap: 32px;
    margin-bottom: 48px;
}

.work-item {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.work-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.work-content {
    display: flex;
    gap: 24px;
}

.work-preview {
    flex-shrink: 0;
    width: 200px;
}

.work-preview img {
    width: 100%;
    height: 150px;
    /* FIX: 确保图片完整显示 */
    object-fit: contain;
    background-color: #f8f9fa; /* 为不等比例图片添加背景色 */
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
}

.work-preview img:hover {
    border-color: #dc2626;
    transform: scale(1.02);
}

.work-details {
    flex: 1;
}

.work-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 24px;
    color: #1f2937;
}

.work-section {
    margin-bottom: 20px;
}

.work-section:last-child {
    margin-bottom: 0;
}

.work-section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #374151;
}

.work-actions {
    display: flex;
    gap: 12px;
}

.work-actions .btn {
    padding: 8px 16px;
    font-size: 14px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
}

.page-info {
    font-size: 16px;
    color: #6b7280;
}

/* 授权信息 */
.authorization-section {
    background: white;
}

.authorization-text {
    margin-bottom: 32px;
    line-height: 1.8;
    color: #4b5563;
}

.authorization-text p {
    margin-bottom: 16px;
}

.authorization-action {
    text-align: center;
}

/* 评论区域 */
.comments-section {
    background: #f9fafb;
}


.form-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 24px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-form {
    display: grid;
    gap: 20px;
}

.form-group {
    display: grid;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #374151;
}

.form-group input,
.form-group textarea {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #dc2626;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.comments-list-card {
    margin-bottom: 32px;
    position: relative; /* 为内部的绝对定位按钮提供参考 */
}

.list-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 24px;
    color: #1f2937;
}

.comments-list {
    min-height: 200px;
}

.comment-item {
    padding: 20px 0;
    border-bottom: 1px solid #e5e7eb;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-user {
    font-weight: 600;
    color: #1f2937;
}

.comment-time {
    font-size: 14px;
    color: #6b7280;
}

.comment-content {
    color: #4b5563;
    line-height: 1.6;
}

.no-comments {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 40px 0;
}

.comments-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    /* FIX: 确保分页与留言按钮不会重叠 */
    margin-bottom: 60px; /* 留出底部按钮的空间 */
}

.page-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-input input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    text-align: center;
}

/* 新增：发表留言按钮的容器样式 */
.post-comment-button-container {
    position: absolute;
    bottom: 24px; /* 距离卡片底部的距离 */
    right: 24px; /* 距离卡片右侧的距离 */
    z-index: 10; /* 确保按钮在其他内容之上 */
}

/* 底部 */
.footer {
    background: #1f2937;
    color: white;
    padding: 48px 0;
}

.footer-content {
    text-align: center;
}

.footer-links {
    margin-bottom: 32px;
}

.footer-links h3 {
    font-size: 20px;
    margin-bottom: 16px;
}

.links {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.links a {
    color: #60a5fa;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

.links a:hover {
    color: #93c5fd;
}

.footer-copyright {
    color: #9ca3af;
    border-top: 1px solid #374151;
    padding-top: 24px;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh; /* Base modal content max height */
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

.modal-large {
    max-width: 800px;
}

/* FIX: 修复图片弹窗显示问题，确保图片自适应不溢出，特别是竖图不裁剪 */
.modal-content.modal-image { /* 使用更具体的选择器确保覆盖 */
    max-width: 90vw; /* 弹窗内容最大宽度为视口宽度的90% */
    max-height: 90vh; /* 弹窗内容最大高度为视口高度的90% */
    width: auto; /* 宽度根据内容自适应，但受max-width限制 */
    height: auto; /* 高度根据内容自适应，但受max-height限制 */
    background: white;
    display: flex;
    flex-direction: column;
    overflow: auto; /* 关键：如果弹窗内容（包括图片、头部、底部）溢出，弹窗自身显示滚动条 */
}

/* FIX: 确保modal-body区域可伸缩以容纳图片并居中 */
.modal-image .modal-body {
    flex: 1; /* 允许 body 区域伸缩，占据剩余空间 */
    min-height: 0; /* Flex 容器内元素收缩的必要条件 */
    display: flex; /* 使用 Flexbox 布局 */
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
    padding: 0; /* 移除 padding，确保图片有最大空间 */
    overflow: hidden; /* 防止modal-body自身出现滚动条，交由父级modal-content处理 */
}

/* FIX: 让图片在可伸缩的body内自适应，并适配竖图不裁剪 */
.modal-image img {
    max-width: 100%; /* 图片最大宽度为其父容器的100% */
    /* 核心修改：明确计算图片的最大高度，减去头部和底部的固定高度。
       估算：弹窗关闭按钮和其上方填充约 50px，弹窗底部（确定按钮和其上下填充）约 100px。
       所以从 90vh 中减去大约 150px 来确保图片能完全显示。
       这个 150px 是一个经验值，可能需要根据实际渲染效果微调，以达到最佳效果。 */
    max-height: calc(90vh - 150px);
    object-fit: contain; /* 保持图片宽高比，同时完整显示图片（不裁剪） */
    width: auto; /* 宽度自适应，保持比例 */
    height: auto; /* 高度自适应，保持比例 */
    display: block; /* 移除图片下方可能存在的额外空间 */
    margin: 1rem auto; /* 添加外边距以提供视觉间距，并水平居中 */
    border-radius: 8px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 24px;
    font-weight: bold;
    color: #1f2937;
}

.modal-tip {
    font-size: 14px;
    color: #6b7280;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* 通用弹窗的 modal-body 样式 */
.modal-body {
    padding: 0 24px 24px;
}

.modal-footer {
    padding: 0 24px 24px;
    text-align: center;
    border-top: 1px solid #e5e7eb;
    margin-top: 24px;
    padding-top: 24px;
}

.authorization-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.image-info {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 10;
}

/* 图标 */
.icon {
    font-size: 16px;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #dc2626;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}