/**
 * 首页N格 - 样式表
 * 仿 Discuz! study_nge 插件风格
 */

/* 门户页 N格外层容器：与下方 .portal-content 视觉左右边界对齐（去掉 .container 的左右 padding） */
.study-nge-portal-wrap {
    padding-left: 0;
    padding-right: 0;
}

.study_nge {
    --nge-border: #C2D5E3;
    --nge-header-bg: #E5EDF2;
    --nge-header-active-bg: #FFFFFF;
    --nge-right-color: #3399CC;
    --nge-thread-right-color: #95B9FF;
    --nge-primary: #2E9AFE;
    --nge-text: #444;
    --nge-text-dim: #999;
    --nge-link: #369;
    --nge-bg: #FFFFFF;
    margin: 0 0 16px 0;
    font-family: "Microsoft YaHei", "微软雅黑", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.6;
    color: var(--nge-text);
}

.study_nge .nge-box {
    border: 1px solid var(--nge-border);
    border-radius: 4px;
    background: var(--nge-bg);
    overflow: hidden;
}

/* ===== 标题栏 ===== */
.study_nge .nge-header {
    background: linear-gradient(to bottom, var(--nge-header-bg) 0%, #d9e4ec 100%);
    border-bottom: 1px solid var(--nge-border);
    min-height: 32px;
    height: auto;
    line-height: 1.35;
    padding: 5px 10px 5px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.study_nge .nge-title {
    font-weight: bold;
    font-size: 14px;
    color: #333;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 2px 0;
}

/* 中间区域：北京时间 + 农历 + 八字（无主标题时占满整行） */
.study_nge .nge-header-time {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.3;
    font-size: 12px;
    color: #555;
    min-width: 0;
    padding: 1px 0;
}
.study_nge .nge-header-time-full {
    padding-left: 2px;
}
.study_nge .nge-header-time-row1,
.study_nge .nge-header-time-row2 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.study_nge .nge-time-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    font-size: 11px;
    flex-shrink: 0;
    line-height: 1;
}
.study_nge .nge-time-text {
    white-space: nowrap;
}
.study_nge .nge-time-bj-text {
    color: #2a5a8a;
    font-weight: 500;
    letter-spacing: 0.2px;
}
.study_nge .nge-time-lunar-text {
    color: #436a3e;
}
.study_nge .nge-time-bazi {
    color: #7a3e6a;
    font-family: "SimSun", "宋体", serif;
    background: rgba(255, 218, 185, 0.35);
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px dashed #c899a8;
    font-size: 11.5px;
    white-space: nowrap;
}

/* 窄屏适配：手机端时八字可以换行 */
@media (max-width: 640px) {
    .study_nge .nge-header {
        padding: 6px 8px;
        gap: 6px;
    }
    .study_nge .nge-header-time {
        font-size: 11.5px;
    }
    .study_nge .nge-time-bazi {
        font-size: 11px;
        padding: 1px 4px;
    }
}

.study_nge .nge-toggle {
    cursor: pointer;
    color: #666;
    font-size: 16px;
    user-select: none;
    padding: 0 4px;
    transition: transform 0.2s;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 4px;
}

.study_nge .nge-toggle.collapsed {
    transform: rotate(-90deg);
}

.study_nge .nge-body {
    padding: 0;
}

.study_nge .nge-body.collapsed {
    display: none;
}

/* ===== 内嵌TAB的图标 + 徽章（用于固定TAB：🖼️最新图片） ===== */
.study_nge .nge-tab .nge-tab-icon {
    display: inline-block;
    margin-right: 4px;
    font-size: 13px;
    line-height: 1;
    vertical-align: middle;
}

.study_nge .nge-tab .nge-tab-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--nge-primary);
    color: #fff !important;
    font-size: 11px;
    line-height: 1.4;
    font-weight: normal;
    vertical-align: middle;
}

/* 固定TAB的宽度略小（左对齐），避免和平均分布的帖子TAB宽度不均 */
.study_nge .nge-tab.nge-tab-newimage-fix {
    flex: 0 0 auto;
    width: auto;
    padding: 8px 18px;
}

/* ===== Tab 导航（帖子组 + 会员组） ===== */
.study_nge .nge-tabs {
    display: flex;
    border-bottom: 1px solid var(--nge-border);
    background: var(--nge-header-bg);
}

.study_nge .nge-tabs-middle {
    flex: 1;
    display: flex;
}

.study_nge .nge-tabs-middle.nge-has-right {
    border-right: 1px solid var(--nge-border);
}

.study_nge .nge-tabs-right {
    width: 20%;
    min-width: 160px;
    display: flex;
}

.study_nge .nge-tab {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    cursor: pointer;
    color: #666;
    text-decoration: none;
    font-size: 13px;
    border-right: 1px solid var(--nge-border);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.study_nge .nge-tab:last-child {
    border-right: none;
}

.study_nge .nge-tab:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--nge-primary);
}

.study_nge .nge-tab.active {
    background: var(--nge-header-active-bg);
    color: var(--nge-primary);
    font-weight: bold;
    border-bottom: 2px solid var(--nge-primary);
    margin-bottom: -1px;
}

/* ===== 内容区 ===== */
.study_nge .nge-content {
    display: flex;
}

.study_nge .nge-content-middle {
    flex: 1;
    padding: 8px 10px;
    min-height: 280px;
}

.study_nge .nge-content-middle.nge-has-right {
    border-right: 1px solid var(--nge-border);
}

.study_nge .nge-content-right {
    width: 20%;
    min-width: 160px;
    padding: 8px 10px;
    min-height: 280px;
}

/* ===== 面板切换 ===== */
.study_nge .nge-panel {
    display: none;
}

.study_nge .nge-panel.active {
    display: block;
}

/* ===== 列表 ===== */
.study_nge .nge-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.study_nge .nge-item {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dashed #EEE;
    line-height: 22px;
}

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

.study_nge .nge-item:hover {
    background: #FAFCFF;
}

/* 序号 */
.study_nge .nge-num {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 3px;
    font-size: 11px;
    margin-right: 8px;
    flex-shrink: 0;
    font-style: normal;
    font-weight: bold;
}

.study_nge .nge-num-top {
    background: var(--nge-primary);
    color: #FFF;
}

.study_nge .nge-num-normal {
    background: #EEE;
    color: #888;
}

/* 标题区 */
.study_nge .nge-subject {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.study_nge .nge-forum {
    color: #999;
    margin-right: 4px;
    font-size: 12px;
}

.study_nge .nge-link {
    color: var(--nge-link);
    text-decoration: none;
}

.study_nge .nge-link:hover {
    color: var(--nge-primary);
    text-decoration: underline;
}

/* 右侧信息 */
.study_nge .nge-right {
    margin-left: 8px;
    font-size: 12px;
    flex-shrink: 0;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.study_nge .nge-author {
    color: inherit;
    text-decoration: none;
}

.study_nge .nge-author:hover {
    text-decoration: underline;
}

/* 会员列表 */
.study_nge .nge-list-member .nge-member-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.study_nge .nge-list-member .nge-member-name a {
    color: var(--nge-link);
    text-decoration: none;
}

.study_nge .nge-list-member .nge-member-name a:hover {
    color: var(--nge-primary);
    text-decoration: underline;
}

/* ===== 底部横排头像 ===== */
.study_nge .nge-bottom {
    border-top: 1px solid var(--nge-border);
    background: #FAFCFF;
    padding: 12px;
}

.study_nge .nge-bottom-section {
    margin-bottom: 8px;
}

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

.study_nge .nge-bottom-title {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
    padding-left: 4px;
    border-left: 3px solid var(--nge-primary);
    padding-left: 8px;
}

.study_nge .nge-bottom-avatars {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* 底部横排对齐方式：左（默认）/ 居中 / 右 */
.study_nge .nge-bottom-avatars--center {
    justify-content: center;
}

.study_nge .nge-bottom-avatars--right {
    justify-content: flex-end;
}

/* 居中模式两侧装饰：渐变细线 + 菱形 */
.study_nge .nge-bottom-deco {
    flex: 1 1 60px;
    max-width: 220px;
    align-self: center;
    height: 12px;
    position: relative;
    pointer-events: none;
}

.study_nge .nge-bottom-deco::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: linear-gradient(to right, rgba(194, 213, 227, 0), #C2D5E3, rgba(194, 213, 227, 0));
}

.study_nge .nge-bottom-deco::after {
    content: '\2726 ';
    position: absolute;
    top: 50%;
    transform: translateY(-52%);
    font-size: 12px;
    color: #9AB8CC;
    line-height: 1;
}

.study_nge .nge-bottom-deco--left::after {
    right: -2px;
}

.study_nge .nge-bottom-deco--right::after {
    left: -2px;
}

@media (max-width: 640px) {
    .study_nge .nge-bottom-deco {
        display: none;
    }
}

.study_nge .nge-bottom-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 56px;
    text-decoration: none;
    color: #666;
    transition: transform 0.15s;
}

.study_nge .nge-bottom-avatar:hover {
    transform: translateY(-2px);
}

.study_nge .nge-bottom-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #DDD;
    object-fit: cover;
    margin-bottom: 4px;
}

.study_nge .nge-bottom-avatar:hover img {
    border-color: var(--nge-primary);
}

.study_nge .nge-bottom-name {
    font-size: 11px;
    color: #888;
    max-width: 56px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* ===== 最新图片幻灯片 ===== */
.study_nge .nge-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-bottom: 1px solid var(--nge-border);
    background: #000;
}

.study_nge .nge-slider.nge-slider-bottom {
    border-bottom: none;
    border-top: 1px solid var(--nge-border);
}

/* TAB内嵌的幻灯片：无边框，调整高度适配面板 */
.study_nge .nge-slider.nge-slider-tab {
    border-bottom: none;
    border-top: none;
}

.study_nge .nge-slider.nge-slider-tab .nge-slider-viewport {
    height: 280px;
}

.study_nge .nge-slider-viewport {
    position: relative;
    width: 100%;
    height: 320px;
    overflow: hidden;
}

/* 空状态样式 */
.study_nge .nge-empty-newimage {
    background: #FAFAFA;
    border-radius: 4px;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.study_nge .nge-slider-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    z-index: 1;
}

.study_nge .nge-slider-slide.active {
    opacity: 1;
    z-index: 2;
}

.study_nge .nge-slider-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.study_nge .nge-slider-img-wrap {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
}

.study_nge .nge-slider-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.study_nge .nge-slider-img-fallback .nge-slider-img {
    object-fit: contain;
    max-width: 80%;
    max-height: 80%;
}

/* 图片说明/标题遮罩 */
.study_nge .nge-slider-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 36px 20px 14px 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.45) 50%, transparent 100%);
    color: #FFF;
    z-index: 3;
    pointer-events: none;
}

.study_nge .nge-slider-link .nge-slider-caption {
    pointer-events: auto;
}

.study_nge .nge-slider-title {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 6px;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.study_nge .nge-slider-meta {
    font-size: 12px;
    color: rgba(255,255,255,0.85);
    display: flex;
    gap: 12px;
    align-items: center;
}

.study_nge .nge-slider-user {
    color: #FFD666;
    text-decoration: none;
    font-weight: 500;
}

.study_nge .nge-slider-user:hover {
    text-decoration: underline;
}

.study_nge .nge-slider-time {
    color: rgba(255,255,255,0.7);
}

/* 左右箭头 */
.study_nge .nge-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 60px;
    line-height: 56px;
    text-align: center;
    background: rgba(0,0,0,0.35);
    color: #FFF;
    border: none;
    font-size: 32px;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
    border-radius: 3px;
    user-select: none;
    padding: 0;
}

.study_nge .nge-slider-arrow:hover {
    background: rgba(0,0,0,0.6);
}

.study_nge .nge-slider-prev {
    left: 10px;
}

.study_nge .nge-slider-next {
    right: 10px;
}

/* 底部指示器圆点 */
.study_nge .nge-slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.study_nge .nge-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, transform 0.2s;
}

.study_nge .nge-slider-dot:hover {
    background: rgba(255,255,255,0.8);
}

.study_nge .nge-slider-dot.active {
    background: var(--nge-primary, #2E9AFE);
    transform: scale(1.2);
    box-shadow: 0 0 6px rgba(46,154,254,0.8);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .study_nge .nge-tabs {
        flex-direction: column;
    }

    .study_nge .nge-tabs-middle {
        border-right: none;
        border-bottom: 1px solid var(--nge-border);
        flex-wrap: wrap;
    }

    .study_nge .nge-tabs-middle.nge-has-right {
        border-right: none;
    }

    .study_nge .nge-tabs-right {
        width: 100%;
        border-bottom: none;
        flex-wrap: wrap;
    }

    .study_nge .nge-tab {
        flex: 1 1 33%;
        padding: 6px 4px;
        font-size: 12px;
    }

    .study_nge .nge-content {
        flex-direction: column;
    }

    .study_nge .nge-content-middle {
        min-height: auto;
    }

    .study_nge .nge-content-middle.nge-has-right {
        border-right: none;
        border-bottom: 1px solid var(--nge-border);
    }

    .study_nge .nge-content-right {
        width: 100%;
        min-width: 0;
        min-height: auto;
    }

    .study_nge .nge-right {
        max-width: 80px;
    }

    /* 幻灯片响应式 */
    .study_nge .nge-slider-viewport {
        height: 200px;
    }

    .study_nge .nge-slider.nge-slider-tab .nge-slider-viewport {
        height: 200px;
    }

    .study_nge .nge-slider-arrow {
        width: 30px;
        height: 44px;
        line-height: 40px;
        font-size: 24px;
    }

    .study_nge .nge-slider-prev {
        left: 4px;
    }

    .study_nge .nge-slider-next {
        right: 4px;
    }

    .study_nge .nge-slider-title {
        font-size: 13px;
    }

    .study_nge .nge-slider-caption {
        padding: 28px 12px 10px 12px;
    }

    .study_nge .nge-slider-meta {
        font-size: 11px;
        gap: 8px;
    }
}
