/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", sans-serif;
}

body {
    font-family: "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
}

/* 科技感导航栏 */
.nav-bar {
    background: linear-gradient(135deg, #f8f9fa 0%, #e3f2fd 100%);
    padding: 0.8rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(30, 136, 229, 0.15);
}

.nav-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.8) 50%, transparent 100%),
        repeating-linear-gradient(
            -45deg,
            rgba(30, 136, 229, 0.03) 0px,
            rgba(30, 136, 229, 0.03) 10px,
            transparent 10px,
            transparent 20px
        );
    animation: shine 12s linear infinite;
}

.nav-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(30, 136, 229, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(30, 136, 229, 0.05) 0%, transparent 50%);
}

@keyframes shine {
    0% { background-position: -200% 0, 0 0; }
    100% { background-position: 200% 0, 50px 0; }
}

.nav-bar h1 {
    position: relative;
    z-index: 1;
    font-size: 2.4rem;
    text-align: center;
    letter-spacing: 4px;
    font-weight: 600;
    background: linear-gradient(135deg, #0b4182 0%, #1e88e5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 4px rgba(30, 136, 229, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.nav-bar h1::before,
.nav-bar h1::after {
    content: '';
    height: 2px;
    width: 40px;
    background: linear-gradient(90deg, transparent, #1e88e5, transparent);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; width: 40px; }
    50% { opacity: 1; width: 60px; }
}

/* 次级导航栏 */
.sub-nav {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.sub-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    color: #555;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-link:hover {
    background: #e3f2fd;
    color: #1e88e5;
}

.nav-link.active {
    background: linear-gradient(135deg, #0b4182 0%, #1e88e5 100%);
    color: white;
}

.nav-link i {
    font-size: 1rem;
}

/* 主容器布局 */
.container {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    padding-bottom: 0;
    height: calc(100vh - 60px);
}

/* 预览区域样式 */
.preview-section {
    flex: 1;
    background: #f0f2f5;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow-y: auto;
    padding: 2rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.page-wrapper {
    margin-bottom: 2rem;
    transform-origin: top center;
    display: flex;
    justify-content: center;
    position: relative;
    height: calc(297mm * var(--scale, 1));
    overflow: visible;
}

.preview-page {
    background: white;
    margin: 0;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 210mm;
    height: 297mm;
    min-height: auto;
    max-width: none;
    box-sizing: border-box;
    position: absolute;
    top: 0;
    transform: scale(var(--scale, 1));
    transform-origin: top center;
}

/* 控制面板样式 */
.control-panel {
    width: 500px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
    overflow: hidden;
}

.panel-header {
    background: linear-gradient(135deg, #0b4182 0%, #1e88e5 100%);
    color: white;
    padding: 1rem;
    border-radius: 12px 12px 0 0;
    position: relative;
    overflow: hidden;
}

.panel-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shine 2s infinite;
}

.panel-header h1 {
    font-family: "Microsoft YaHei", sans-serif;
    color: white;
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.form-container {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    overflow-y: auto;
}

.form-group {
    margin: 0;
    text-align: left;
    width: 92%;
    margin: 0 auto;
}

.form-group label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 1.05rem;
    color: #126fc0;
    text-align: left;
    font-weight: 500;
    position: relative;
    padding-left: 0.3rem;
    border-left: 3px solid #1e88e5;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #969494;
    border-radius: 4px;
    font-size: 1rem;
    text-align: left;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.range-inputs input {
    flex: 1;
    text-align: center;
    width: 45%;
}

.range-separator {
    color: #666;
    font-size: 0.9rem;
    margin: 0 2px;
}

/* 按钮样式 */
.buttons-container {
    padding: 0.5rem;
    margin: 0.5rem auto 1rem;
    width: 100%;
    border-top: 1px solid rgba(0,0,0,0.1);
    display: flex;
    gap: 0.5rem;
    order: 1;
    position: relative;
    flex-wrap: wrap;
}

.buttons-container::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #fff);
    pointer-events: none;
}

.regenerate-btn,
.generate-btn {
    flex: 1;
    min-width: 120px;
    padding: 0.8rem 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.3s ease;
}

.regenerate-btn {
    background: linear-gradient(135deg, #2e7d32, #43a047);
    color: white;
    box-shadow: 0 4px 15px rgba(67, 160, 71, 0.3);
}

.generate-btn {
    background: linear-gradient(135deg, #0b4182 0%, #1e88e5 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(30, 136, 229, 0.3);
}

/* 调整按钮图标大小 */
.buttons-container i {
    font-size: 1rem;
}

/* 预览区表格样式 */
.preview-page table {
    width: 97%;
    border-collapse: collapse;
    margin-top: 0.1rem;
}

.preview-page td {
    padding: 0.5rem 1.0rem;
    vertical-align: middle;
    font-family: "Microsoft YaHei", sans-serif !important;
    line-height: 1.0;
}

.student-info {
    margin-bottom:0.1rem;
    text-align: center;
    color: #333;
    font-size: 16px !important;
    line-height: 5.5;
}

.page-number {
    position: absolute;
    bottom: 3rem;
    left: 0;
    right: 0;
    text-align: center;
    color: #666;
    font-size: 14px !important;
    font-family: "Microsoft YaHei", sans-serif !important;
}

/* 预览区专用字体 */
.preview-page,
.preview-page td,
.preview-page .student-info,
.preview-page .page-number {
    font-family: "Microsoft YaHei", sans-serif !important;
}

/* 数字范围和结果范围的label独样式 */
.form-group.range-group {
    margin-bottom: 0.5rem;
}

.form-group.range-group label {
    color: #1e88e5;
    margin-bottom: 0.4rem;
}

/* 美化滚动条 */
.preview-section::-webkit-scrollbar {
    width: 8px;
}

.preview-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.preview-section::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #0b4182, #1e88e5);
    border-radius: 4px;
}

.preview-section::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #0a3972, #1976d2);
}

.form-container::-webkit-scrollbar {
    width: 6px;
}

.form-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.form-container::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #0b4182, #1e88e5);
    border-radius: 3px;
}

.form-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #0a3972, #1976d2);
}

/* 添加页面缩放效果 */
@media screen and (max-width: 1200px) {
    .preview-section {
        padding: 1rem;
    }
    
    .preview-page {
        transform: scale(0.9);
        transform-origin: top center;
        margin-bottom: 1rem;
    }
}

@media screen and (max-width: 992px) {
    .preview-page {
        transform: scale(0.8);
    }
}

/* 手机端适配样式 */
@media screen and (max-width: 768px) {
    /* 次级导航栏适配 */
    .sub-nav-container {
        padding: 0.5rem;
        gap: 0.2rem;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-link {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .nav-link i {
        font-size: 0.9rem;
    }

    .nav-link span {
        display: inline;
    }

    /* 导航栏适配 */
    .nav-bar {
        padding: 0.6rem;
    }
    
    .nav-bar h1 {
        font-size: 1.6rem;
        letter-spacing: 2px;
    }
    
    .nav-bar h1::before,
    .nav-bar h1::after {
        display: none;  /* 移除装饰线 */
    }

    /* 主容器布局调整 */
    .container {
        flex-direction: row;
        padding: 0.5rem;
        height: calc(100vh - 50px);
        gap: 0.3rem;
    }

    /* 控制面板适配 */
    .control-panel {
        width: 40%;
        margin-bottom: 0.5rem;
    }

    .panel-header h1 {
        font-size: 0.9rem;
    }

    .form-container {
        padding: 0.5rem;
        gap: 0.35rem;
    }

    .form-group {
        width: 100%;
        margin-bottom: 0.15rem;
    }

    .form-group label {
        font-size: 0.75rem;
        padding-left: 0.5rem;
        border-left: 2px solid #1e88e5;
        margin-bottom: 0.3rem;
    }

    .form-group select,
    .form-group input {
        padding: 0.35rem;
        font-size: 0.75rem;
    }

    /* 预览区域适配 */
    .preview-section {
        flex: 1.5;
        padding: 0.2rem;
        margin-bottom: 0.5rem;
    }

    .page-wrapper {
        height: calc(297mm * 0.35);  /* 移动端初始缩放比例 */
    }

    .preview-page {
        transform: scale(0.35);
        transform-origin: top center;
    }

    /* 最后一页不需要负边距 */
    .preview-page:last-child {
        margin-bottom: 0.5rem;
    }

    /* 按钮容器适配 */
    .buttons-container {
        padding: 0.6rem;
        margin: 0.3rem auto 0.6rem;
        width: 95%;
        gap: 0.4rem;
    }

    .regenerate-btn,
    .generate-btn {
        padding: 0.4rem;
        font-size: 0.7rem;
    }

    /* 范围输入框适配 */
    .range-inputs {
        gap: 0.15rem;
    }

    .range-inputs input {
        padding: 0.35rem;
        font-size: 0.75rem;
    }

    .range-separator {
        font-size: 0.7rem;
    }

    /* 按钮文字适配 */
    .buttons-container i {
        font-size: 0.8rem;
    }

    .buttons-container span {
        font-weight: normal;
    }

    /* 滚动条适配 */
    .preview-section::-webkit-scrollbar,
    .form-container::-webkit-scrollbar {
        width: 3px;
    }
}

/* 超小屏幕适配 */
@media screen and (max-width: 480px) {
    .nav-bar h1 {
        font-size: 1.4rem;
    }

    .page-wrapper {
        height: calc(297mm * 0.32);  /* 更小屏幕的缩放比例 */
    }

    .preview-page {
        transform: scale(0.32);
    }

    .form-group label {
        font-size: 0.8rem;
    }

    .buttons-container {
        width: 100%;
        padding: 0.4rem;
    }

    .control-panel {
        width: 50%;
    }

    .regenerate-btn,
    .generate-btn {
        font-size: 0.65rem;
    }

    .buttons-container i {
        font-size: 0.75rem;
    }
}

/* 横屏模式适配 */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .container {
        height: calc(100vh - 45px);
    }

    .control-panel {
        width: 40%;
    }

    .preview-section {
        flex: 0.7;
    }

    .page-wrapper {
        height: calc(297mm * 0.38);  /* 横屏模式的缩放比例 */
    }

    .preview-page {
        transform: scale(0.38);
    }
}

/* 脚样式 */
.footer {
    background: linear-gradient(135deg, #0b4182 0%, #1e88e5 100%);
    padding: 1rem 0;
    text-align: center;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.05) 0px,
        rgba(255, 255, 255, 0.05) 10px,
        transparent 10px,
        transparent 20px
    );
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
}

.footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #fff;
    text-decoration: underline;
}

/* 页脚响应式适配 */
@media screen and (max-width: 768px) {
    .footer {
        padding: 0.8rem 0;
        margin-top: 0.5rem;
    }

    .footer-content {
        gap: 1rem;
    }

    .footer p {
        font-size: 0.8rem;
    }
}

@media screen and (max-width: 480px) {
    .footer {
        padding: 0.6rem 0;
    }

    .footer-content {
        flex-direction: column;
        gap: 0.3rem;
    }

    .footer p {
        font-size: 0.75rem;
    }
}

/* 缩放控制按钮容器 */
.zoom-controls {
    position: fixed;
    right: calc(1rem + 500px + 50px);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

/* 缩放按钮样式 */
.zoom-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background-color: #1e88e5;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background-color: #1976d2;
    transform: scale(1.1);
}

.zoom-btn:active {
    transform: scale(0.95);
}

.zoom-btn i {
    font-size: 18px;
    line-height: 1;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .zoom-controls {
        right: 45%;
    }

    .zoom-btn {
        width: 36px;
        height: 36px;
    }

    .zoom-btn i {
        font-size: 16px;
    }
}

/* 小屏幕适配 */
@media screen and (max-width: 480px) {
    .zoom-controls {
        right: 55%;
    }

    .zoom-btn {
        width: 32px;
        height: 32px;
    }

    .zoom-btn i {
        font-size: 14px;
    }
}

/* 内容区域样式 */
.content-section {
    background: #f0f2f5;
    padding: 2rem 1rem;
}

.content-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.content-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.content-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.content-card h2 {
    color: #0b4182;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 2px solid #e3f2fd;
    padding-bottom: 0.5rem;
}

.content-card h3 {
    color: #1e88e5;
    font-size: 1.2rem;
    margin: 1.2rem 0 0.6rem 0;
}

.content-card h4 {
    color: #333;
    font-size: 1.05rem;
    margin: 0.8rem 0 0.4rem 0;
}

.content-card p {
    color: #555;
    line-height: 1.8;
    margin-bottom: 0.8rem;
}

.content-card ol,
.content-card ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.content-card li {
    color: #555;
    line-height: 1.8;
    margin-bottom: 0.4rem;
}

.content-card strong {
    color: #0b4182;
    font-weight: 600;
}

/* FAQ 样式 */
.faq-item {
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #1e88e5;
}

.faq-item h4 {
    color: #0b4182;
    margin-bottom: 0.5rem;
}

.faq-item p {
    margin-bottom: 0;
}

/* 年级指南样式 */
.grade-guide {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.grade-item {
    padding: 1rem;
    background: linear-gradient(135deg, #e3f2fd 0%, #f8f9fa 100%);
    border-radius: 8px;
    border-left: 4px solid #1e88e5;
}

.grade-item h4 {
    color: #0b4182;
    margin-bottom: 0.5rem;
}

.grade-item p {
    margin-bottom: 0;
}

/* 页脚链接样式 */
.footer-links {
    margin-top: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0.5rem;
    text-decoration: none;
}

.footer-links a:hover {
    color: #fff;
    text-decoration: underline;
}

/* 内容区域响应式 */
@media screen and (max-width: 768px) {
    .content-section {
        padding: 1rem 0.5rem;
    }

    .content-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .content-card {
        padding: 1.2rem;
    }

    .content-card h2 {
        font-size: 1.2rem;
    }

    .content-card h3 {
        font-size: 1.1rem;
    }
}
/* ============ 资源站公共样式（追加） ============ */

.resource-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.resource-card {
    display: block;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.resource-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
}
.resource-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.resource-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 0.25rem 0.7rem;
    border-radius: 12px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.resource-info {
    padding: 1rem 1.2rem;
}

.resource-title {
    color: #0b4182;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-intro-preview {
    color: #666;
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.6rem;
    border-top: 1px dashed #e0e0e0;
    font-size: 0.8rem;
    color: #888;
}
.resource-cta {
    color: #1976d2;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: #999;
    grid-column: 1 / -1;
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    color: #ccc;
}
.empty-state .empty-sub {
    font-size: 0.85rem;
    color: #aaa;
    margin-top: 0.3rem;
}

@media (max-width: 768px) {
    .resource-list {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
    }
}
@media (max-width: 480px) {
    .resource-list {
        grid-template-columns: 1fr;
    }
    .resource-title { font-size: 0.95rem; }
}

/* ============ 原生广告位 ============ */
/* 默认（手机/平板/笔记本）：二级导航下方的顶部横幅，随文档流排列，不遮挡正文 */
.native-banner-ad {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.9rem 1rem 0;
    text-align: center;
    box-sizing: border-box;
}

/* 超宽屏（≥1780px）：切换为页面左右两侧固定竖幅，脱离文档流、垂直居中，不遮挡内容列 */
@media (min-width: 1780px) {
    .native-banner-ad {
        position: fixed;
        left: calc(50% - 880px);
        top: 50%;
        transform: translateY(-50%);
        width: 160px;
        max-width: none;
        margin: 0;
        padding: 0;
        z-index: 50;
    }
    /* 右侧悬浮：与左侧对称 */
    .native-banner-ad.native-side-ad-right {
        left: auto;
        right: calc(50% - 880px);
    }
}

.native-banner-ad > div {
    margin: 0 auto;
}

.native-banner-ad iframe,
.native-banner-ad img,
.native-banner-ad ins {
    max-width: 100%;
}

@media (max-width: 480px) {
    .native-banner-ad {
        padding: 0.6rem 0.5rem 0;
    }
}
