/**
 * 附件图片幻灯片 - 样式
 * 选择器统一使用 .ais- 前缀，避免与主题样式冲突
 */

.ais-slider {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 10px 0 14px;
    border-radius: 8px;
    overflow: hidden;
    background: #10131a;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
    user-select: none;
    touch-action: pan-y;
}

.ais-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 540px;
    overflow: hidden;
}

@supports not (aspect-ratio: 4 / 3) {
    .ais-viewport { height: 380px; }
}

.ais-track {
    display: flex;
    height: 100%;
    transition: transform .35s ease;
    will-change: transform;
}

.ais-track.ais-dragging { transition: none; }

.ais-slide {
    flex: 0 0 100%;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ais-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 0;
    cursor: zoom-in;
}

/* 左右切换按钮 */
.ais-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .38);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s, background .2s;
    z-index: 3;
}
.ais-slider:hover .ais-btn,
.ais-slider:active .ais-btn { opacity: 1; }
.ais-btn:hover { background: rgba(0, 0, 0, .6); }
.ais-btn.ais-prev { left: 10px; }
.ais-btn.ais-next { right: 10px; }

/* 计数器 */
.ais-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    font-size: 12px;
    z-index: 3;
    pointer-events: none;
}

/* 指示圆点（无缩略图条时使用） */
.ais-dots {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 3;
}
.ais-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: rgba(255, 255, 255, .45);
    cursor: pointer;
    transition: background .2s, transform .2s;
}
.ais-dot.ais-active {
    background: #fff;
    transform: scale(1.15);
}

/* ========================================================================
   缩略图胶片条（大图下方，参照 Discuz threed_attimg 合体模式样式）
   ======================================================================== */
.ais-thumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: #171b23;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.ais-thumbs-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    flex: 1;
    min-width: 0;
    scrollbar-width: none;
}
.ais-thumbs-strip::-webkit-scrollbar { display: none; }

.ais-thumb {
    flex: 0 0 auto;
    width: 88px;
    height: 58px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    background: #0c0f14;
    cursor: pointer;
    opacity: .65;
    transition: opacity .2s, border-color .2s, transform .2s;
}
.ais-thumb:hover { opacity: 1; }
.ais-thumb.ais-active {
    border-color: #2f9bff;
    opacity: 1;
    transform: translateY(-1px);
}
.ais-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0;
}

.ais-thumbs-arrow {
    flex: 0 0 auto;
    width: 24px;
    height: 44px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #aab3c0;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s, color .2s;
}
.ais-thumbs-arrow:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

@media (max-width: 768px) {
    .ais-thumb { width: 64px; height: 44px; }
    .ais-thumbs-arrow { width: 20px; height: 40px; }
}

/* ========================================================================
   图文合体模式：左侧幻灯片，右侧附件下载栏
   ======================================================================== */
.ais-combo {
    display: flex;
    gap: 14px;
    align-items: stretch;
    margin: 10px 0 14px;
}
.ais-combo .ais-slider {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    align-self: flex-start;
}
.ais-combo .ais-combo-side {
    flex: 0 0 300px;
    width: 300px;
    margin: 0 !important;
    padding: 12px;
    background: #fff;
    border: 1px solid #e6eaf0;
    border-radius: 8px;
    align-self: flex-start;
}

/* 合体模式右侧：文件纵向排列，突出下载信息 */
.ais-combo .ais-combo-side .att-file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ais-combo .ais-combo-side .att-file-item {
    min-width: 0;
    background: #f7f9fc;
}

@media (max-width: 900px) {
    .ais-combo { flex-direction: column; }
    .ais-combo .ais-combo-side { flex: 1 1 auto; width: 100%; }
}

/* 移动端：触屏尺寸优化 */
@media (max-width: 768px) {
    .ais-slider { border-radius: 6px; }
    .ais-viewport { aspect-ratio: 1 / 1; max-height: 420px; }
    .ais-btn { width: 30px; height: 30px; font-size: 16px; opacity: .85; }
    .ais-btn.ais-prev { left: 6px; }
    .ais-btn.ais-next { right: 6px; }
    .ais-counter { font-size: 11px; }
}

/* ========================================================================
   附件下载展示区美化（.att-display 由 attachments_display.php 输出）
   ======================================================================== */

.ais-beautify .att-display {
    margin: 18px 0 10px;
}

.ais-beautify .att-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #556;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
}

.ais-beautify .att-image-grid,
.ais-beautify .att-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ais-beautify .att-image-item {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, .08);
    transition: box-shadow .2s, transform .2s;
}
.ais-beautify .att-image-item:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, .14);
    transform: translateY(-1px);
}
.ais-beautify .att-image-item img {
    display: block;
    border-radius: 0;
}

.ais-beautify .att-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 8px;
    background: #fafbfc;
    transition: box-shadow .2s, border-color .2s;
}
.ais-beautify .att-file-item:hover {
    border-color: #9ec3ec;
    box-shadow: 0 2px 10px rgba(26, 115, 232, .12);
}

.ais-beautify .att-file-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 8px;
    background: rgba(26, 115, 232, .08);
    flex-shrink: 0;
}

.ais-beautify .att-file-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    word-break: break-all;
}

.ais-beautify .att-file-meta {
    font-size: 12px;
    color: #98a1ad;
}
