/* ==========================================================================
   国学术数民俗工具箱 · 父插件样式
   规范：
     - 全部颜色走 --mn-* 主题变量（fallback = 浅色主题目标色），双主题自适应
     - 插件视图禁用核心 CSS 类（form-input / btn 等），一律用 gx-* 前缀
     - 零内联，不改核心 CSS
   ========================================================================== */

/* -------------------------------------------------------------------------
   统一页面容器：父插件首页 / 个人中心 / 各模块页都用它包裹
   ------------------------------------------------------------------------- */
.gx-module-page {
    padding: 24px 20px 48px;
    max-width: 1080px;
    margin: 0 auto;
    box-sizing: border-box;
}
@media (max-width: 768px) {
    .gx-module-page {
        padding: 16px 12px 32px;
    }
}

/* -------------------------------------------------------------------------
   标题区
   ------------------------------------------------------------------------- */
.gx-home-head { margin-bottom: 8px; }

.gx-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 22px;
    margin: 0 0 8px;
    color: var(--mn-text, #333);
    line-height: 1.3;
}
.gx-title .fa {
    color: var(--mn-primary, #0066cc);
}
.gx-subtitle {
    font-size: 14px;
    color: var(--mn-text-muted, #888);
    margin: 0 0 8px;
    line-height: 1.6;
}
.gx-disclaimer-inline {
    font-size: 12px;
    color: var(--mn-text-muted, #888);
    margin: 0;
    line-height: 1.6;
}

/* -------------------------------------------------------------------------
   分期分组（首页）
   ------------------------------------------------------------------------- */
.gx-phase { margin-top: 32px; }
.gx-phase-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--mn-text, #333);
    border-left: 4px solid var(--mn-primary, #0066cc);
    padding-left: 12px;
    line-height: 1.4;
    letter-spacing: 1px;
}

/* -------------------------------------------------------------------------
   模块网格 + 卡片（首页美化增强）
   ------------------------------------------------------------------------- */
.gx-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.gx-card {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 18px 20px;
    background: var(--mn-bg-card, #fff);
    border: 1px solid var(--mn-border, #e5e7eb);
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    transition: all .28s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .02);
}

/* 卡片悬停动效 */
.gx-card:hover {
    border-color: var(--mn-primary, #0066cc);
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 102, 204, .12);
}

/* 卡片左侧装饰条 */
.gx-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--mn-primary, #0066cc);
    opacity: 0;
    transition: opacity .28s ease;
}
.gx-card:hover::before {
    opacity: 1;
}

.gx-card-icon {
    flex: 0 0 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--mn-primary-subtle, #e8f1fb);
    color: var(--mn-primary, #0066cc);
    font-size: 20px;
    transition: all .28s ease;
}
.gx-card:hover .gx-card-icon {
    background: var(--mn-primary, #0066cc);
    color: #fff;
    transform: scale(1.05);
}

.gx-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gx-card-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--mn-text, #333);
    letter-spacing: .5px;
    transition: color .2s;
}
.gx-card:hover .gx-card-name {
    color: var(--mn-primary, #0066cc);
}

.gx-card-desc {
    font-size: 12.5px;
    color: var(--mn-text-muted, #888);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* -------------------------------------------------------------------------
   空状态
   ------------------------------------------------------------------------- */
.gx-empty {
    padding: 40px 0;
    text-align: center;
    color: var(--mn-text-muted, #888);
    font-size: 14px;
}

/* -------------------------------------------------------------------------
   子导航 tab（个人中心 / 模块内部）
   ------------------------------------------------------------------------- */
.gx-subnav {
    display: flex;
    gap: 4px;
    margin: 12px 0 16px;
    border-bottom: 1px solid var(--mn-border, #e5e7eb);
    flex-wrap: wrap;
}
.gx-tab-btn, .gx-tab-link {
    padding: 8px 14px;
    font-size: 14px;
    color: var(--mn-text-muted, #888);
    border-bottom: 2px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: color .2s, border-color .2s;
    background: transparent;
    border-top: none;
    border-left: none;
    border-right: none;
}
.gx-tab-btn:hover, .gx-tab-link:hover { color: var(--mn-primary, #0066cc); }
.gx-tab-btn.active, .gx-tab-link.active {
    color: var(--mn-primary, #0066cc);
    border-bottom-color: var(--mn-primary, #0066cc);
    font-weight: 600;
}

/* -------------------------------------------------------------------------
   通用工具类
   ------------------------------------------------------------------------- */
.gx-hidden { display: none !important; }

/* -------------------------------------------------------------------------
   档案列表（个人中心）
   ------------------------------------------------------------------------- */
.gx-archive-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.gx-archive-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--mn-bg-card, #fff);
    border: 1px solid var(--mn-border, #e5e7eb);
    border-radius: 8px;
    flex-wrap: wrap;
}
.gx-archive-title {
    font-weight: 600;
    color: var(--mn-text, #333);
    flex: 0 0 auto;
    min-width: 80px;
}
.gx-archive-meta {
    font-size: 12px;
    color: var(--mn-text-muted, #888);
    flex: 1;
    word-break: break-all;
}

/* -------------------------------------------------------------------------
   历史 / 收藏列表（个人中心）
   ------------------------------------------------------------------------- */
.gx-history-list,
.gx-fav-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}
.gx-history-item,
.gx-fav-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--mn-border-light, #f0f0f0);
    font-size: 13px;
    align-items: center;
}
.gx-history-module,
.gx-fav-module {
    font-weight: 600;
    color: var(--mn-primary, #0066cc);
    flex: 0 0 90px;
}
.gx-history-action,
.gx-fav-title {
    flex: 1;
    color: var(--mn-text, #333);
    word-break: break-all;
}
.gx-history-time,
.gx-fav-time {
    color: var(--mn-text-muted, #888);
    font-size: 12px;
    flex: 0 0 auto;
}

/* -------------------------------------------------------------------------
   通用按钮（前台 + 模块复用）
   ------------------------------------------------------------------------- */
.gx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 400;
    font-family: inherit;
    line-height: 1.4;
    border: 1px solid var(--mn-border, #e5e7eb);
    border-radius: 6px;
    cursor: pointer;
    background: var(--mn-bg-card, #fff);
    color: var(--mn-text, #333);
    text-decoration: none;
    transition: border-color .2s, color .2s, background-color .2s, opacity .2s;
}
.gx-btn:hover {
    border-color: var(--mn-primary, #0066cc);
    color: var(--mn-primary, #0066cc);
}
.gx-btn-primary {
    background: var(--mn-primary, #0066cc);
    color: #fff;
    border-color: var(--mn-primary, #0066cc);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
}
.gx-btn-primary:hover {
    color: #fff;
    opacity: .9;
}
.gx-btn-danger:hover {
    border-color: var(--mn-error, #ef4444);
    color: var(--mn-error, #ef4444);
}

/* -------------------------------------------------------------------------
   统一免责声明
   ------------------------------------------------------------------------- */
.gx-disclaimer {
    margin-top: 24px;
    padding: 12px 14px;
    background: var(--mn-comp-alert-warning-bg, #fef3c7);
    border: 1px solid var(--mn-comp-alert-warning-border, #fde68a);
    border-radius: 8px;
    font-size: 12px;
    color: var(--mn-comp-alert-warning-text, #92400e);
    line-height: 1.6;
}
.gx-disclaimer strong {
    display: block;
    margin-bottom: 4px;
}

/* -------------------------------------------------------------------------
   后台辅助（文本等宽）
   ------------------------------------------------------------------------- */
.gx-mono {
    font-family: monospace;
    font-size: 12px;
    color: var(--mn-text-muted, #888);
    margin-left: 6px;
}

/* =========================================================================
   后台：白底容器 + 表单 + 按钮
   全部用插件自己的类，禁用核心 form-input / btn（作用域不同会部分失效）
   ========================================================================= */

.gx-admin {
    background: var(--mn-bg-card, #fff);
    border: 1px solid var(--mn-border, #e5e7eb);
    border-radius: 10px;
    padding: 24px;
    box-sizing: border-box;
    max-width: 1080px;
}
@media (max-width: 768px) {
    .gx-admin { padding: 16px; }
}

.gx-admin h1 {
    font-size: 20px;
    margin: 0 0 16px;
    color: var(--mn-text, #333);
}

/* tab 栏 + 面板 */
.gx-admin .admin-tabs {
    margin: 0 0 16px;
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--mn-border, #e5e7eb);
}
.gx-admin .admin-tab-panel {
    padding-top: 4px;
}

/* 后台表格溢出修复 & 布局优化 */
.gx-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.gx-admin .admin-table {
    width: 100%;
    min-width: 650px;
    border-collapse: collapse;
}
.gx-admin .admin-table th,
.gx-admin .admin-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--mn-border-light, #f0f0f0);
    font-size: 13px;
    color: var(--mn-text, #333);
    vertical-align: middle;
}
.gx-admin .admin-table th {
    color: var(--mn-text-muted, #888);
    font-weight: 500;
}

/* 描述列优化：允许自动换行，防止一行文字过长导致溢出 */
.gx-admin .admin-table .gx-td-desc {
    word-break: break-word;
    white-space: normal;
    line-height: 1.6;
    font-size: 13px;
    color: var(--mn-text, #333);
}

/* 复选框居中 */
.gx-admin .admin-table td .checkbox-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.gx-admin .admin-table td .checkbox-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 表单字段：label + textarea */
.gx-admin-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}
.gx-admin-field label {
    font-size: 13px;
    color: var(--mn-text-muted, #888);
}
.gx-admin-field textarea {
    display: block;
    width: 100%;
    min-height: 110px;
    max-height: 260px;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--mn-border, #e5e7eb);
    background: var(--mn-bg-card, #fff);
    color: var(--mn-text, #333);
    font-size: 14px;
    line-height: 1.6;
    font-family: inherit;
    resize: vertical;
    transition: border-color .2s;
}
.gx-admin-field textarea:focus {
    outline: none;
    border-color: var(--mn-primary, #0066cc);
}

/* 按钮区 */
.gx-admin-actions {
    display: flex;
    gap: 10px;
    padding-top: 4px;
}

/* 后台按钮：与前台 .gx-btn 同源，但尺寸略大、字重稍高 */
.gx-admin-actions .gx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    border: 1px solid var(--mn-border, #e5e7eb);
    border-radius: 6px;
    cursor: pointer;
    background: var(--mn-bg-card, #fff);
    color: var(--mn-text, #333);
    text-decoration: none;
    transition: border-color .2s, color .2s, opacity .2s;
}
.gx-admin-actions .gx-btn:hover {
    border-color: var(--mn-primary, #0066cc);
    color: var(--mn-primary, #0066cc);
}
.gx-admin-actions .gx-btn-primary {
    background: var(--mn-primary, #0066cc);
    color: #fff;
    border-color: var(--mn-primary, #0066cc);
}
.gx-admin-actions .gx-btn-primary:hover {
    color: #fff;
    opacity: .9;
}

/* =========================================================================
   Hero 区（首页顶部美化增强）
   ========================================================================= */

.gx-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 36px 40px;
    margin-bottom: 32px;
    background: linear-gradient(135deg,
        var(--mn-primary-subtle, #e8f1fb) 0%,
        var(--mn-bg-card, #fff) 60%);
    border: 1px solid var(--mn-border, #e5e7eb);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .03);
}

/* 装饰性光晕 */
.gx-hero::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -10%;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: var(--mn-primary, #0066cc);
    opacity: .05;
    pointer-events: none;
}
.gx-hero::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: -5%;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: var(--mn-primary, #0066cc);
    opacity: .04;
    pointer-events: none;
}

.gx-hero-main {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.gx-hero-icon {
    flex: 0 0 80px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--mn-primary, #0066cc) 0%, #0a4d8c 100%);
    color: #fff;
    box-shadow: 0 10px 24px rgba(0, 102, 204, .25);
    font-size: 38px;
}

.gx-hero-text { flex: 1; min-width: 0; }
.gx-hero-title {
    margin: 0 0 8px;
    font-size: 30px;
    font-weight: 800;
    color: var(--mn-text, #333);
    letter-spacing: 2px;
    line-height: 1.2;
}
.gx-hero-subtitle {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--mn-text-muted, #888);
    letter-spacing: .5px;
    line-height: 1.6;
}

/* Hero 区标签 */
.gx-hero-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.gx-hero-tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    background: var(--mn-bg-card, #fff);
    border: 1px solid var(--mn-border, #e5e7eb);
    font-size: 12px;
    font-weight: 600;
    color: var(--mn-primary, #0066cc);
    letter-spacing: .5px;
}

.gx-hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 18px 28px;
    background: var(--mn-bg-card, #fff);
    border: 1px solid var(--mn-border, #e5e7eb);
    border-radius: 16px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .04);
}
.gx-hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 72px;
}
.gx-hero-stat-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--mn-primary, #0066cc);
    line-height: 1;
    font-family: ui-monospace, "Noto Serif SC", serif;
    letter-spacing: 1px;
}
.gx-hero-stat-label {
    font-size: 12px;
    color: var(--mn-text-muted, #888);
    letter-spacing: 1px;
    font-weight: 600;
}

/* ---------- 响应式适配（含 Hero 区和首页卡片） ---------- */
@media (max-width: 768px) {
    .gx-hero {
        flex-direction: column;
        align-items: stretch;
        gap: 24px;
        padding: 24px 20px;
    }
    .gx-hero-icon {
        flex: 0 0 64px;
        width: 64px;
        height: 64px;
        border-radius: 16px;
        font-size: 30px;
    }
    .gx-hero-title { font-size: 22px; letter-spacing: 1px; }
    .gx-hero-subtitle { font-size: 13px; }
    .gx-hero-tag { font-size: 11px; padding: 2px 8px; }
    
    .gx-hero-stats {
        padding: 14px 12px;
    }
    .gx-hero-stat { min-width: 60px; }
    .gx-hero-stat-num { font-size: 22px; }
    .gx-hero-stat-label { font-size: 11px; }

    .gx-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .gx-phase { margin-top: 24px; }
    .gx-phase-title { font-size: 16px; padding-left: 10px; }
    .gx-card { padding: 16px; }
}