/*
 * 礼物墙 + 详情分段切换导航（首页 / 陪玩展示页 / 派单试音页 / 礼物铺 / 个人后台共用）
 *
 * 结构（各页一致）：
 *   .gift-panel                    面板：导航 + 三个页（个人后台只用其中的礼物格子，外层包 .gift-panel 拿 --gw-* 变量）
 *     .gift-tabs-row               顶部切换导航（浅灰轨道 + 白色高亮药丸，右侧留白）
 *     .gift-panel-body[data-detail-page="reviews"]  客户评价页（默认显示）
 *     .gift-panel-body[data-detail-page="gifts"]    礼物墙页（懒加载）
 *     .gift-panel-body[data-detail-page="photos"]   照片墙页（懒加载）
 *   .gift-wall / .gift-tile        礼物格子（自适应列：侧栏 3 列、弹层更宽时自动更多）
 *   .photo-wall / .photo-tile      照片格子（正方形圆角缩略图，列数同样自适应）
 *
 * 引入：index.html / players.html / dispatch.html / gifts.html / portal.html
 * 配色照预览的浅色定稿。
 */

.gift-panel {
    --gw-ink: #1f2430;
    --gw-muted: #6f6f6f;
    --gw-line: #e7e7e7;
    --gw-lavender: #7c6cf0;
    /* 三个页共用的内容区高度基准（与旧的 max-height 口径一致，观感不突变）：
       面板定高后，切换「客户评价 / 礼物墙 / 照片墙」高度恒定，内容再多也只在内部滚动。
       取值口径：约等于左栏（陪玩资料）的自然高度 —— 太高会让左栏下方空一大片（实测左栏 402~453px，
       定 500 时空 126~169px），所以收到 400（≈ 一屏 4 条评价 / 3 行礼物）。 */
    --gw-detail-h: min(400px, 56vh);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

/* 分段切换导航：轨道按内容宽度，右侧整片留白（以后加导航 / 按钮都放这） */
.gift-tabs-row { display: flex; align-items: center; gap: 10px; flex: none; }
.gift-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: #f1f2f6; }
.gift-tab {
    border: 0;
    background: transparent;
    color: #7a8493;
    font: inherit;
    font-size: 12.5px;
    font-weight: 800;
    padding: 7px 13px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: color .16s ease, background .16s ease;
}
.gift-tab:hover { color: #4b5261; }
.gift-tab.is-active { background: #fff; color: var(--gw-ink); box-shadow: 0 2px 8px rgba(26, 34, 46, .10); }
.gift-tabs-spacer { flex: 1 1 auto; }

/* 三个页各自占用同一个确定高度：内容少也占满，内容多则内部滚动，切换不跳 */
.gift-panel-body { min-width: 0; min-height: 0; height: var(--gw-detail-h); }
/* 非激活的那一页靠 hidden 隐藏；下面的 display:flex 会盖过 UA 的 [hidden]{display:none}，必须显式覆盖 */
.gift-panel-body[hidden] { display: none !important; }
/* 客户评价页：内部的评价盒子撑满这个高度（它自带滚动与「加载更多」，行为不变） */
.gift-panel-body[data-detail-page="reviews"] > .player-detail-reviews { height: 100%; max-height: none; }

/* ===== 客户评价卡（首页 / 陪玩展示页 / 派单试音页共用一份）=====
   模板见 player-card.js 的 reviewItemMarkup / reviewStarsMarkup。
   ⚠️ .player-review-* 只在这里定义；别再在 players.css / showcase.css / dispatch.html 里各写一份。
   正文颜色统一取试音页口径 #4a5f80（原先首页 / 展示页是 #242e3d）。 */
.player-reviews-scroll { flex: 1; max-height: none; overflow: auto; margin-top: 0; padding: 10px; }
.player-reviews-list { display: grid; gap: 8px; align-content: start; }
.player-reviews-empty { margin-top: 10px; color: var(--muted); font-size: 13px; }
.player-detail-side .player-reviews-empty { padding: 26px 16px; margin: 0; text-align: center; }
/* 评价为空时：让空态在定高的内容区里垂直居中 —— 否则「定高」看起来像一大块没加载出来的空白 */
.gift-panel-body[data-detail-page="reviews"] > .player-detail-reviews > .player-reviews-empty {
    display: flex; height: 100%; margin: 0; padding: 16px; align-items: center; justify-content: center; text-align: center;
}
.player-reviews-more { flex: none; }
.player-reviews-more { margin-top: 8px; color: var(--muted); font-size: 12px; text-align: center; }
.player-review-item { padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fdfdfd; }
.player-review-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.player-review-owner { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.player-review-avatar { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; object-fit: cover; background: #f2f2f2; }
.player-review-head strong { color: var(--ink); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-review-stars { display: inline-flex; align-items: center; gap: 1px; font-size: 13px; white-space: nowrap; }
.player-review-star { color: #f3e6d2; }
.player-review-star.on { color: #e9a64c; }
.player-review-text { margin: 5px 0 0; color: #4a5f80; font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.player-review-meta { margin-top: 5px; color: var(--muted); font-size: 11.5px; }

/* 礼物墙 / 照片墙页：浅色卡片 + 自适应列（侧栏窄时 3 列，弹层更宽时自动更多） */
.gift-panel [data-detail-page="gifts"],
.gift-panel [data-detail-page="photos"] {
    max-height: min(500px, 62vh);
    overflow: auto;
    padding: 12px;
    border: 1px solid #eceef3;
    border-radius: 16px;
    background: #fdfdfd;
}

.gift-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 9px; }
.gift-tile {
    position: relative;
    padding: 9px 6px 11px;
    border-radius: 13px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--gw-line);
    box-shadow: 0 8px 20px rgba(26, 34, 46, .05);
    transition: transform .18s ease, border-color .18s ease, filter .2s ease, opacity .2s ease;
}
.gift-tile:hover { transform: translateY(-3px); border-color: #c9cdd4; }
.gift-tile-icon {
    display: block;
    width: 100%;
    max-width: 46px;
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 5px auto 8px;
    object-fit: contain;
}
.gift-tile-name {
    display: -webkit-box;
    overflow: hidden;
    color: var(--gw-ink);
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.35;
    word-break: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.gift-tile-value { margin-top: 4px; color: var(--gw-lavender); font-size: 11.5px; font-weight: 800; }
.gift-tile-value .gift-tile-coin { width: 1.05em; height: 1.05em; margin-right: 3px; vertical-align: -0.16em; }

/* 鼠标悬停不再「就地放大」：格子都在可滚动容器里，scale 会被容器 overflow 裁掉。
   改为 gift-preview.js 弹一个 position:fixed 的浮层大图（见文件末尾 .gift-preview）。 */
.gift-tile-count {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 1px 5px;
    border-radius: 999px;
    background: #f0f0f6;
    color: #5b6270;
    font-size: 10px;
    font-weight: 800;
}

/* ===== 置灰（这位陪玩还没收到过的礼物）：灰度 + 降透明度，不显示 ×N ===== */
.gift-tile.is-dim { filter: grayscale(1); opacity: .45; }
.gift-tile.is-dim .gift-tile-name,
.gift-tile.is-dim .gift-tile-value { color: var(--gw-muted); }
/* 悬停恢复彩色：既能看清这一件礼物，移开又回到置灰（大图预览另由 .gift-preview 承担） */
.gift-tile.is-dim:hover { filter: none; opacity: 1; }

.gift-wall-empty {
    padding: 22px 16px;
    border: 1px dashed #d7dbe6;
    border-radius: 13px;
    background: #fbfbfd;
    color: var(--gw-muted);
    text-align: center;
    font-size: 12.5px;
}
.gift-wall-status { padding: 22px 16px; color: var(--gw-muted); text-align: center; font-size: 12.5px; }
.gift-wall-status.is-error { color: #c25769; }

/* ===== 照片墙：正方形圆角缩略图网格（列数跟随容器宽度自适应，宽 4 列 / 窄 3 列） ===== */
.photo-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 9px; }
/* 点击整张图 → photo-lightbox.js 弹大图（不再悬停放大 / 不再悬停浮层） */
.photo-tile { position: relative; margin: 0; border-radius: 13px; cursor: zoom-in; }
.photo-tile-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border: 1px solid var(--gw-line);
    border-radius: 13px;
    background: #f2f3f7;
    transition: border-color .16s ease, box-shadow .16s ease;
}
/* 悬停只做「可点」的轻微提示（描边 + 阴影），不缩放，避免被滚动容器裁掉 */
.photo-tile:hover .photo-tile-image,
.photo-tile:focus-visible .photo-tile-image { border-color: #c9cdd4; box-shadow: 0 8px 20px rgba(26, 34, 46, .12); }

.photo-wall-empty {
    padding: 22px 16px;
    border: 1px dashed #d7dbe6;
    border-radius: 13px;
    background: #fbfbfd;
    color: var(--gw-muted);
    text-align: center;
    font-size: 12.5px;
}

/* 试音页与展示页统一为「选项卡在外、内容独立卡」：面板不再是卡片，
   内容页（客户评价 / 礼物墙 / 照片墙）各自成卡、内部滚动，切换高度恒定。 */

/* 手机端：礼物墙 / 照片墙固定 3 列；面板同样保持定高 —— 切换标签尺寸不变，
   内容多则在面板内部滚动（不再把面板撑高/撑矮，避免切换时卡片跳变）。 */
@media (max-width: 760px) {
    .gift-panel [data-detail-page="gifts"],
    .gift-panel [data-detail-page="photos"] { max-height: var(--gw-detail-h); }
}
@media (max-width: 520px) {
    .gift-wall, .photo-wall { grid-template-columns: repeat(3, minmax(0, 1fr)); }

    /* 手机端：标签收紧（375px 起三个标签一屏放得下）。再窄的机型让轨道内部横向滚动兜底
       —— 不换行、不顶破弹窗两侧留白；轨道会横向裁切，所以活动标签的投影同时收敛。 */
    .gift-tabs { gap: 3px; padding: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
    .gift-tabs::-webkit-scrollbar { display: none; }
    .gift-tab { padding: 6px 10px; font-size: 11.5px; }
    .gift-tab.is-active { box-shadow: 0 1px 3px rgba(26, 34, 46, .12); }

    /* 内容区定高在手机上收更多（空白更少）—— 三页共用同一口径，切标签依然不跳 */
    .gift-panel { --gw-detail-h: min(340px, 46vh); }
}

/* ===== 悬停大图浮层（gift-preview.js）=====
   礼物墙 / 照片墙 / 礼物铺共用：鼠标移入格子 → 在此弹一张大图。
   - position: fixed：不受任何可滚动容器的 overflow 裁剪；
   - pointer-events: none：纯展示，绝不挡鼠标；
   - z-index 很高且在 <dialog>（顶层）内，保证盖住详情卡片。 */
.gift-preview {
    position: fixed;
    z-index: 90;
    display: none;
    width: 260px;
    padding: 8px 8px 4px;
    border: 1px solid #e7e7e7;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 22px 48px rgba(20, 26, 38, .24);
    pointer-events: none;
    opacity: 0;
    transition: opacity .14s ease;
}
.gift-preview.is-open { display: block; opacity: 1; }
.gift-preview-image {
    display: block;
    width: 100%;
    max-width: 244px;
    max-height: 244px;
    margin: 0 auto;
    border-radius: 12px;
    background: #f6f7fa;
    object-fit: contain;
}
.gift-preview-caption {
    margin: 8px 4px 0;
    color: var(--gw-ink);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    word-break: break-word;
}
.gift-preview-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin: 3px 4px 4px;
    color: var(--gw-lavender);
    font-size: 12.5px;
    font-weight: 800;
}
.gift-preview-price img { width: 1.05em; height: 1.05em; }

/* ===== 照片墙点击大图弹层（photo-lightbox.js）=====
   点 .photo-tile → 铺满视口的半透明深色遮罩 + 居中大图（≤90vw × ≤82vh，等比、圆角、投影）
   + 底部一条 ‹ n / N › 工具条（不关闭就能连着看）。
   与礼物墙的悬停浮层（.gift-preview）互不影响；挂在同一个 <dialog> 里，z-index 更高盖住详情。
   工具条右侧 / 舞台中部留了位置：以后要加「缩放百分比 / 旋转 / 全屏 / 下载」直接塞进 .photo-lightbox-bar。 */
.photo-lightbox {
    position: fixed;
    z-index: 120;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 14px;
    padding: 18px;
    box-sizing: border-box;
    background: rgba(14, 18, 27, .84);
    outline: none;
    touch-action: none;   /* 遮罩上不产生触摸滚动，露在底下的详情不会被带着滚 */
}
.photo-lightbox.is-open { display: flex; animation: photo-lightbox-in .16s ease; }
@keyframes photo-lightbox-in { from { opacity: 0; } to { opacity: 1; } }

.photo-lightbox-stage {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    align-items: center;
    justify-content: center;
}
.photo-lightbox-image {
    display: block;
    max-width: 90vw;
    /* min(…, 100%)：既不超过 82vh，也不会把下面的工具条顶出去 */
    max-height: min(82vh, 100%);
    border-radius: 16px;
    background: rgba(255, 255, 255, .05);
    box-shadow: 0 28px 70px rgba(0, 0, 0, .55);
    object-fit: contain;
}

.photo-lightbox-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    width: 42px;
    height: 42px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background .16s ease;
}
.photo-lightbox-close:hover { background: rgba(255, 255, 255, .3); }

.photo-lightbox-nav {
    display: grid;
    width: 46px;
    height: 46px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background .16s ease;
}
.photo-lightbox-nav:hover { background: rgba(255, 255, 255, .3); }
.photo-lightbox-close:focus-visible,
.photo-lightbox-nav:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
/* 舞台两侧的大箭头（绝对定位，压在图片左右边缘外侧） */
.photo-lightbox-stage > .photo-lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.photo-lightbox-stage > .is-prev { left: 4px; }
.photo-lightbox-stage > .is-next { right: 4px; }

/* 底部小工具条：‹ 上一张 · n / N · › 下一张 */
.photo-lightbox-bar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.photo-lightbox-bar .photo-lightbox-nav { width: 38px; height: 38px; font-size: 22px; }
.photo-lightbox-counter {
    min-width: 64px;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .02em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
/* 只有一张时不留空箭头位 */
.photo-lightbox.is-single .photo-lightbox-nav { display: none; }

/* 弹层打开时锁住背景滚动（与 portal 的 body.task-open 同口径） */
body.photo-lightbox-open { overflow: hidden; }

@media (max-width: 520px) {
    .photo-lightbox { padding: 12px; gap: 10px; }
    .photo-lightbox-image { max-height: min(78vh, 100%); }
    .photo-lightbox-close { top: 10px; right: 10px; width: 38px; height: 38px; font-size: 22px; }
    .photo-lightbox-stage > .photo-lightbox-nav { display: none; }   /* 小屏靠底部工具条翻页，别压住图 */
}
