/* ==========================================================================
   帮助中心独立样式 - Apple 风格
   命名空间：.hc- 前缀
   ========================================================================== */

:root {
    --hc-primary: #C8102E;
    --hc-primary-hover: #a00d25;
    --hc-primary-light: rgba(200, 16, 46, 0.08);
    --hc-primary-gradient: linear-gradient(135deg, #C8102E 0%, #881818 100%);
    --hc-bg: #f8fafc;
    --hc-white: #ffffff;
    --hc-text: #1d1d1f;
    --hc-text-secondary: #6e6e73;
    --hc-border: #d2d2d7;
    --hc-radius: 12px;
    --hc-radius-sm: 8px;
    --hc-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --hc-shadow-lg: 0 8px 32px rgba(200, 16, 46, 0.12);
    --hc-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", sans-serif;
    --hc-max-width: 1080px;
    --hc-content-width: 720px;
    --hc-green: #34c759;
    --hc-orange: #ff9500;
    --hc-red: #ff3b30;
    --hc-info: #5ac8fa;

    /* footer.css 依赖的变量（教师端由 style.css 提供） */
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --info-color: #3B82F6;
    --overlay-100: rgba(0, 0, 0, 0.1);
    --apple-brand: #C8102E;
}

/* Reset */
.hc-body {
    margin: 0;
    padding: 0;
    font-family: var(--hc-font);
    background: var(--hc-bg);
    color: var(--hc-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.hc-body *, .hc-body *::before, .hc-body *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   返回系统胶囊链接（首页 hero 右上角，右边缘对齐卡片网格右边缘）
   ========================================================================== */
.hc-back-link {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--hc-text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 980px;
    border: 1px solid var(--hc-border);
    background: var(--hc-white);
    transition: all 0.2s;
    z-index: 10;
}

.hc-back-link:hover {
    color: var(--hc-primary);
    border-color: var(--hc-primary);
    box-shadow: 0 2px 8px rgba(200, 16, 46, 0.1);
}

/* ==========================================================================
   Main
   ========================================================================== */
.hc-main {
    position: relative;
    min-height: calc(100vh - 120px);
    padding: 56px 24px 48px;
}

/* ==========================================================================
   首页 - Hero（左对齐）与卡片
   ========================================================================== */
.hc-hero {
    position: relative;
    max-width: var(--hc-max-width);
    margin: 0 auto 48px;
    text-align: left;
}

.hc-hero-title {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0 0 28px;
}

.hc-search-box {
    max-width: 560px;
    margin: 0;
    position: relative;
}

.hc-search-input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    font-size: 16px;
    border: 1px solid var(--hc-border);
    border-radius: 980px;
    background: var(--hc-white);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--hc-font);
}

.hc-search-input:focus {
    border-color: var(--hc-primary);
    box-shadow: 0 0 0 4px rgba(200, 16, 46, 0.1);
}

.hc-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--hc-text-secondary);
    font-size: 16px;
}

.hc-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--hc-white);
    border-radius: var(--hc-radius);
    box-shadow: var(--hc-shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.hc-search-results.active {
    display: block;
}

.hc-search-result-item {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--hc-text);
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.hc-search-result-item:hover {
    background: var(--hc-bg);
}

.hc-search-result-item:last-child {
    border-bottom: none;
}

.hc-search-result-title {
    font-size: 14px;
    font-weight: 500;
}

.hc-search-result-section {
    font-size: 12px;
    color: var(--hc-text-secondary);
    margin-top: 2px;
}

.hc-search-no-result {
    padding: 20px;
    text-align: center;
    color: var(--hc-text-secondary);
    font-size: 14px;
}

/* 卡片网格 */
.hc-grid {
    max-width: var(--hc-max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.hc-card {
    display: flex;
    flex-direction: column;
    background: var(--hc-white);
    border-radius: var(--hc-radius);
    padding: 32px 28px 24px;
    text-decoration: none;
    color: var(--hc-text);
    box-shadow: var(--hc-shadow);
    border: 1px solid transparent;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s, border-color 0.25s;
    position: relative;
    overflow: hidden;
}

.hc-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hc-shadow-lg);
    border-color: rgba(200, 16, 46, 0.15);
}

.hc-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--hc-primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    margin-bottom: 18px;
    box-shadow: 0 4px 12px rgba(200, 16, 46, 0.25);
}

.hc-card-body {
    flex: 1;
}

.hc-card-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 8px;
}

.hc-card-summary {
    font-size: 14px;
    color: var(--hc-text-secondary);
    margin: 0;
    line-height: 1.5;
}

.hc-card-badge {
    display: inline-block;
    margin-top: 16px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--hc-primary);
    background: var(--hc-primary-light);
    border-radius: 980px;
    align-self: flex-start;
}

/* ==========================================================================
   章节详情页
   ========================================================================== */
.hc-section-layout {
    max-width: var(--hc-max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 48px;
    align-items: start;
}

/* 面包屑 */
.hc-breadcrumb {
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--hc-text-secondary);
}

.hc-breadcrumb a {
    color: var(--hc-primary);
    text-decoration: none;
}

.hc-breadcrumb a:hover {
    text-decoration: underline;
}

/* 侧边目录 */
.hc-sidebar {
    position: sticky;
    top: 24px;
}

.hc-sidebar-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--hc-text-secondary);
    margin: 0 0 12px;
}

.hc-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hc-nav-item {
    margin-bottom: 2px;
}

.hc-nav-link {
    display: block;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--hc-text-secondary);
    text-decoration: none;
    border-radius: var(--hc-radius-sm);
    transition: all 0.15s;
}

.hc-nav-link:hover {
    color: var(--hc-text);
    background: rgba(0, 0, 0, 0.04);
}

.hc-nav-link.active {
    color: var(--hc-primary);
    background: var(--hc-primary-light);
    font-weight: 500;
}

/* 侧边栏底部返回链接 */
.hc-sidebar-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--hc-border);
}

.hc-sidebar-back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--hc-text-secondary);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--hc-radius-sm);
    transition: all 0.15s;
}

.hc-sidebar-back-link:hover {
    color: var(--hc-primary);
    background: var(--hc-primary-light);
}

/* 正文内容 */
.hc-content {
    min-width: 0;
}

.hc-content-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 8px;
    letter-spacing: -0.3px;
}

.hc-content-subtitle {
    font-size: 15px;
    color: var(--hc-text-secondary);
    margin: 0 0 40px;
}

/* 子章节 */
.hc-subsection {
    margin-bottom: 48px;
    scroll-margin-top: 24px;
}

.hc-subsection-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--hc-border);
}

.hc-subsection-content {
    font-size: 15px;
    line-height: 1.8;
}

.hc-subsection-content p {
    margin: 0 0 16px;
}

.hc-subsection-content h5 {
    font-size: 16px;
    font-weight: 600;
    margin: 28px 0 12px;
}

.hc-subsection-content ul,
.hc-subsection-content ol {
    margin: 0 0 16px;
    padding-left: 24px;
}

.hc-subsection-content li {
    margin-bottom: 8px;
}

.hc-subsection-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.hc-subsection-content strong {
    font-weight: 600;
}

/* 图片 */
.hc-image-container {
    margin: 20px 0;
}

.hc-image {
    max-width: 100%;
    border-radius: var(--hc-radius);
    box-shadow: var(--hc-shadow);
    cursor: zoom-in;
    transition: transform 0.2s;
}

.hc-image:hover {
    transform: scale(1.01);
}

/* 提示框 */
.hc-tip {
    display: flex;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--hc-radius-sm);
    margin: 16px 0;
    font-size: 14px;
    line-height: 1.6;
    border-left: 4px solid;
}

.hc-tip i {
    margin-top: 2px;
    flex-shrink: 0;
}

.hc-tip.info {
    background: #f0f9ff;
    border-color: var(--hc-info);
    color: #0c4a6e;
}

.hc-tip.warning {
    background: #fffbeb;
    border-color: var(--hc-orange);
    color: #78350f;
}

.hc-tip.danger {
    background: #fef2f2;
    border-color: var(--hc-red);
    color: #7f1d1d;
}

.hc-tip.success {
    background: #f0fdf4;
    border-color: var(--hc-green);
    color: #14532d;
}

/* 步骤列表 */
.hc-steps {
    counter-reset: step;
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.hc-steps li {
    counter-increment: step;
    position: relative;
    padding-left: 44px;
    margin-bottom: 20px;
}

.hc-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--hc-primary);
    color: white;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 步骤卡片（div 结构） */
.hc-step {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.hc-step-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--hc-primary);
    color: white;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hc-step-content {
    flex: 1;
    min-width: 0;
}

.hc-step-content h5 {
    margin: 2px 0 6px;
    font-size: 15px;
    font-weight: 600;
}

.hc-step-content p {
    margin: 0;
    font-size: 14px;
    color: var(--hc-text-secondary);
    line-height: 1.6;
}

/* 规则卡片 */
.hc-rule-card {
    background: var(--hc-white);
    border-radius: var(--hc-radius);
    padding: 24px;
    margin: 16px 0;
    box-shadow: var(--hc-shadow);
}

.hc-rule-card h5 {
    margin: 0 0 12px;
    font-size: 16px;
}

.hc-rule-note {
    font-size: 13px;
    color: var(--hc-text-secondary);
    margin: 0 0 12px;
}

.hc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.hc-table th,
.hc-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.hc-table th {
    font-weight: 600;
    color: var(--hc-text-secondary);
    font-size: 13px;
}

.hc-table tr:last-child td {
    border-bottom: none;
}

/* 等级 Badge */
.hc-grade-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 980px;
    font-size: 12px;
    font-weight: 600;
}

.hc-grade-a { background: #dcfce7; color: #166534; }
.hc-grade-b { background: #dbeafe; color: #1e40af; }
.hc-grade-c { background: #ffedd5; color: #9a3412; }
.hc-grade-d { background: #fee2e2; color: #991b1b; }

.hc-star-cell {
    letter-spacing: 2px;
}

/* ==========================================================================
   FAQ Q&A 卡片
   展开/收起逻辑复用 help.js 的 .hc-accordion-header / .open 机制
   ========================================================================== */
.hc-faq-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 8px 0;
}

.hc-faq-item {
    background: var(--hc-white);
    border: 1px solid #ececee;
    border-radius: var(--hc-radius);
    overflow: hidden;
    transition: box-shadow 0.25s, border-color 0.25s;
}

.hc-faq-item.open {
    border-color: rgba(200, 16, 46, 0.25);
    box-shadow: 0 6px 24px rgba(200, 16, 46, 0.08);
}

.hc-faq-question {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 18px 20px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: var(--hc-font);
    transition: background 0.15s;
}

.hc-faq-question:hover {
    background: rgba(0, 0, 0, 0.02);
}

.hc-faq-badge {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.hc-faq-badge-q {
    background: var(--hc-primary-gradient);
    color: white;
    box-shadow: 0 3px 8px rgba(200, 16, 46, 0.25);
}

.hc-faq-badge-a {
    background: var(--hc-primary-light);
    color: var(--hc-primary);
}

.hc-faq-q-text {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--hc-text);
    line-height: 1.5;
}

.hc-faq-chevron {
    flex-shrink: 0;
    font-size: 13px;
    color: var(--hc-text-secondary);
    transition: transform 0.25s;
}

.hc-faq-item.open .hc-faq-chevron {
    transform: rotate(180deg);
    color: var(--hc-primary);
}

.hc-faq-answer {
    display: none;
    gap: 14px;
    padding: 0 20px 20px;
    align-items: flex-start;
}

.hc-faq-item.open .hc-faq-answer {
    display: flex;
}

.hc-faq-answer-body {
    flex: 1;
    min-width: 0;
    padding-top: 4px;
}

.hc-faq-answer-body p {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.8;
    color: #4b5563;
}

.hc-faq-answer-body p:last-child {
    margin-bottom: 0;
}

.hc-faq-answer-body a {
    color: var(--hc-primary);
    text-decoration: none;
    font-weight: 500;
}

.hc-faq-answer-body a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */
.hc-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.hc-lightbox.active {
    display: flex;
}

.hc-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
}

.hc-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.hc-lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: var(--hc-radius);
    object-fit: contain;
}

.hc-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

/* ==========================================================================
   回到顶部
   ========================================================================== */
.hc-back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--hc-white);
    border: 1px solid var(--hc-border);
    box-shadow: var(--hc-shadow);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--hc-text);
    transition: all 0.2s;
    z-index: 90;
}

.hc-back-to-top.visible {
    display: flex;
}

.hc-back-to-top:hover {
    background: var(--hc-primary);
    color: white;
    border-color: var(--hc-primary);
}

/* ==========================================================================
   移动端目录切换按钮
   ========================================================================== */
.hc-mobile-nav-toggle {
    display: none;
    width: 100%;
    padding: 12px 16px;
    background: var(--hc-white);
    border: 1px solid var(--hc-border);
    border-radius: var(--hc-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 16px;
    font-family: var(--hc-font);
    color: var(--hc-text);
    text-align: left;
}

.hc-mobile-nav-toggle i {
    float: right;
    transition: transform 0.2s;
}

.hc-mobile-nav-toggle.open i {
    transform: rotate(180deg);
}

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1023px) {
    .hc-section-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .hc-sidebar {
        position: static;
    }

    .hc-mobile-nav-toggle {
        display: block;
    }

    .hc-nav-list {
        display: none;
    }

    .hc-nav-list.open {
        display: block;
    }
}

@media (max-width: 767px) {
    .hc-main {
        padding: 32px 16px;
    }

    .hc-back-link {
        padding: 6px 12px;
        font-size: 13px;
    }

    .hc-hero-title {
        font-size: 28px;
    }

    .hc-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .hc-card {
        padding: 20px;
    }

    .hc-content-title {
        font-size: 24px;
    }

    .hc-subsection-title {
        font-size: 18px;
    }

    .hc-faq-question {
        padding: 14px 16px;
        gap: 12px;
    }

    .hc-faq-answer {
        padding: 0 16px 16px;
        gap: 12px;
    }

    .hc-back-to-top {
        bottom: 20px;
        right: 20px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .hc-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
