/* travel-photo-gen.css — 旅行约会「生图模式」共用样式
   覆盖：拍摄方式菜单 / 生图模式设置面板 / 编辑消息（文本·照片）弹层 / 生成中·失败气泡状态
   兼容：iOS Safari（safe-area、-webkit-overflow-scrolling）与国产安卓浏览器（touch-action、tap-highlight） */

.tpg-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    /* 用 dvh 对齐 #app 的取窗方式（style.css #app 同样 vh→dvh 兜底）：
       避免移动端浏览器地址栏收起前后 100vh 与「实际可见的小手机屏幕」高度不一致，
       导致以 vh 计算位置/高度的弹层下半部分溢出到小手机框架之外。 */
    height: 100vh;
    height: 100dvh;
    display: none;
    align-items: center;
    justify-content: center;
    /* 顶/底并入真机安全区：env() 兜底 + var(--safe-area-inset-*)（安卓 APK 原生注入，
       见 safe-area-compat.css 变量桥说明），避免全面屏 APK 里居中卡片贴近状态栏/手势条 */
    padding: calc(24px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))) 20px calc(24px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    padding: calc(24px + var(--safe-area-inset-top, 0px)) 20px calc(24px + var(--safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    background: rgba(20, 24, 28, 0.45);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    -webkit-tap-highlight-color: transparent;
}

.tpg-modal.show {
    display: flex;
}

.tpg-sheet {
    width: 100%;
    max-width: 380px;
    background: #fdfcf8;
    border-radius: 20px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.2);
    /* 顶部留白比其余三边更充裕一些，确保标题文字（含中文字上端）不会贴着圆角边框 */
    padding: 22px 18px calc(18px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))) 18px;
    box-sizing: border-box;
    /* 同样用 dvh 兜底：弹层最高不超过「小手机」实际可见高度的 78%，两端各留出呼吸边距 */
    max-height: min(78vh, 620px);
    max-height: min(78dvh, 620px);
    display: flex;
    flex-direction: column;
    animation: tpg-pop-in 0.2s ease-out;
    touch-action: manipulation;
}

@keyframes tpg-pop-in {
    from { transform: translateY(8px) scale(0.97); opacity: 0.4; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.tpg-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eef1e8;
}

.tpg-sheet-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.6;
    color: #3a3f36;
    letter-spacing: 0.2px;
}

.tpg-sheet-sub {
    font-size: 12.5px;
    color: #97a08c;
    line-height: 1.6;
    margin: -6px 0 14px;
    text-align: center;
}

.tpg-close-btn {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    color: #7a8272;
    font-size: 17px;
    line-height: 28px;
    text-align: center;
    padding: 0;
    cursor: pointer;
}

/* ---------- 拍摄方式菜单（居中于小手机屏幕） ---------- */

.tpg-shoot-sheet .tpg-sheet-title {
    text-align: center;
    display: block;
    margin-bottom: 2px;
}

.tpg-shoot-sheet {
    gap: 10px;
    max-width: 320px;
    max-height: none;
    padding: 22px 18px 16px;
}

.tpg-big-btn {
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid #dde5d6;
    background: #f6f8f1;
    border-radius: 14px;
    padding: 13px 15px;
    margin-bottom: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tpg-big-btn:active {
    background: #ecf1e3;
}

.tpg-big-btn-name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #45573b;
    margin-bottom: 3px;
}

.tpg-big-btn-desc {
    display: block;
    font-size: 12px;
    color: #8a9184;
    line-height: 1.5;
}

.tpg-cancel-btn {
    display: block;
    width: 100%;
    border: none;
    background: transparent;
    color: #8a9184;
    font-size: 14px;
    padding: 10px 0 2px;
    cursor: pointer;
}

/* ---------- 生图模式设置面板 ---------- */

.tpg-gen-panel-modal .tpg-gen-sheet {
    max-width: 360px;
}

.tpg-gen-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0 -4px;
    padding: 2px 4px 4px;
    /* 隐形滚动条：保留触控/滚轮滚动能力，只是不显示滚动条本体 */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tpg-gen-body::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
    background: transparent;
}

.tpg-api-status {
    font-size: 12.5px;
    border-radius: 12px;
    padding: 10px 13px;
    margin-bottom: 6px;
    line-height: 1.6;
    flex-shrink: 0;
}

.tpg-api-status.is-ok {
    background: #eef6e9;
    color: #4f7a3d;
}

.tpg-api-status.is-warn {
    background: #fdf1e7;
    color: #b06a2c;
}

.tpg-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #a8af9d;
    letter-spacing: 1.5px;
    margin: 22px 2px 10px;
}

.tpg-section-title:first-child {
    margin-top: 6px;
}

.tpg-row {
    background: #f8f9f5;
    border: 1px solid #edf0e7;
    border-radius: 14px;
    padding: 14px 15px;
    margin-bottom: 10px;
}

.tpg-row-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.tpg-row-text {
    flex: 1 1 auto;
    min-width: 0;
}

.tpg-row-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    color: #414c3a;
    margin-bottom: 4px;
}

.tpg-row-desc {
    font-size: 12.5px;
    color: #97a08c;
    line-height: 1.65;
}

.tpg-row-status {
    font-size: 11.5px;
    color: #a7ae9c;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eaeee3;
    line-height: 1.6;
}

/* 开关 */

.tpg-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
    margin-top: 2px;
}

.tpg-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.tpg-switch-slider {
    position: absolute;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #d6dcce;
    border-radius: 26px;
    transition: background 0.2s;
    cursor: pointer;
}

.tpg-switch-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s;
}

.tpg-switch input:checked + .tpg-switch-slider {
    background: #8fae72;
}

.tpg-switch input:checked + .tpg-switch-slider::before {
    transform: translateX(20px);
}

/* 频率行：单独一枚淡色胶囊卡片，与描述文字拉出留白，降低「文字墙」感 */

.tpg-freq-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12.5px;
    color: #5f6b55;
    margin-top: 11px;
    padding: 9px 11px;
    background: #eef2e6;
    border-radius: 10px;
}

.tpg-select {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid #cbd4bd;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #45573b;
    padding: 4px 10px;
    min-width: 44px;
    text-align: center;
    text-align-last: center;
}

.tpg-freq-note {
    width: 100%;
    font-size: 11px;
    color: #93a184;
    line-height: 1.5;
    margin-top: 2px;
}

/* 标签行 */

.tpg-tag-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 11px;
}

.tpg-tag-chip {
    font-size: 12px;
    color: #4f7a3d;
    background: #eef6e9;
    border-radius: 8px;
    padding: 4px 9px;
    letter-spacing: 0.5px;
    user-select: text;
    -webkit-user-select: text;
}

.tpg-tag-insert {
    border: 1px solid #cfd8c4;
    background: #fff;
    color: #5d7350;
    font-size: 12px;
    border-radius: 8px;
    padding: 4px 11px;
    cursor: pointer;
    flex-shrink: 0;
}

.tpg-tag-insert:active {
    background: #eef3e6;
}

/* ---------- 底部按钮 ---------- */

.tpg-sheet-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #eef1e8;
    flex-shrink: 0;
}

.tpg-gen-sheet .tpg-sheet-footer {
    justify-content: stretch;
}

.tpg-gen-sheet .tpg-primary-btn {
    flex: 1 1 auto;
    text-align: center;
}

.tpg-primary-btn {
    border: none;
    background: #7f9f66;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border-radius: 11px;
    padding: 10px 26px;
    cursor: pointer;
}

.tpg-primary-btn:active {
    background: #6e8d57;
}

.tpg-ghost-btn {
    border: 1px solid #d4dbc9;
    background: #fff;
    color: #7c8574;
    font-size: 14px;
    border-radius: 11px;
    padding: 9px 20px;
    cursor: pointer;
}

/* ---------- 编辑消息弹层 ---------- */

.tpg-edit-modal-wrap {
    align-items: center;
    padding: 0 14px;
}

.tpg-edit-sheet {
    border-radius: 16px;
    max-width: 400px;
    animation: none;
}

.tpg-format-chips {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.tpg-format-chip {
    flex: 1;
    border: 1px solid #d7ddcd;
    background: #f6f8f1;
    color: #75806b;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tpg-format-chip.is-active {
    background: #7f9f66;
    border-color: #7f9f66;
    color: #fff;
}

.tpg-kind-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.tpg-kind-label {
    font-size: 12px;
    color: #99a191;
    margin-right: 2px;
}

.tpg-kind-chip {
    border: 1px solid #d7ddcd;
    background: #fff;
    color: #75806b;
    font-size: 12px;
    border-radius: 8px;
    padding: 4px 10px;
    cursor: pointer;
}

.tpg-kind-chip.is-active {
    background: #eef6e9;
    border-color: #8fae72;
    color: #4f7a3d;
    font-weight: 600;
}

.tpg-edit-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #dbe1d2;
    border-radius: 11px;
    background: #fff;
    font-size: 14px;
    line-height: 1.6;
    color: #3f4a39;
    padding: 10px 12px;
    resize: vertical;
    min-height: 110px;
    max-height: 40vh;
    outline: none;
    -webkit-appearance: none;
}

.tpg-edit-textarea:focus {
    border-color: #9db884;
}

.tpg-edit-hint {
    font-size: 11px;
    color: #a0a898;
    line-height: 1.5;
    margin-top: 7px;
}

/* ---------- 生成中 / 失败气泡状态（宿主聊天区） ---------- */

.travel-offline-message-bubble.is-gen-pending,
.roadtrip-bubble.is-gen-pending {
    opacity: 0.85;
    animation: tpg-pending-pulse 1.4s ease-in-out infinite;
}

.travel-offline-message-bubble.is-gen-failed,
.roadtrip-bubble.is-gen-failed {
    border: 1px dashed #d9a37a !important;
    background: #fdf3ea !important;
    color: #a2653a !important;
}

@keyframes tpg-pending-pulse {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 0.45; }
}

/* ---------- 照片点击放大查看器 ---------- */

/* 聊天里的照片可点击放大：给出可交互暗示 */
.travel-offline-photo,
.roadtrip-photo {
    cursor: zoom-in;
}

.tpg-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: none;
    flex-direction: column;
    background: rgba(12, 14, 16, 0.92);
    -webkit-tap-highlight-color: transparent;
    /* 顶/底并入真机安全区，避免关闭按钮顶进状态栏、操作条压住底部手势条 */
    padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
    padding-top: var(--safe-area-inset-top, 0px);
    padding-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
    padding-bottom: var(--safe-area-inset-bottom, 0px);
    box-sizing: border-box;
}

.tpg-viewer.show {
    display: flex;
    animation: tpg-viewer-fade 0.16s ease-out;
}

@keyframes tpg-viewer-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tpg-viewer-close {
    position: absolute;
    top: calc(14px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
    top: calc(14px + var(--safe-area-inset-top, 0px));
    right: 14px;
    z-index: 2;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 20px;
    line-height: 34px;
    text-align: center;
    padding: 0;
    cursor: pointer;
}

.tpg-viewer-stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: manipulation;
}

/* 放大细看态：舞台转为可滚动画布，允许手指/滚轮拖看局部 */
.tpg-viewer-stage.is-zoomed {
    display: block;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
    text-align: center;
}

.tpg-viewer-img {
    max-width: 94%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.5);
    cursor: zoom-in;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

.tpg-viewer-img.is-zoomed {
    max-width: none;
    max-height: none;
    width: 185%;
    border-radius: 0;
    cursor: zoom-out;
}

.tpg-viewer-meta {
    flex-shrink: 0;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.5;
    padding: 10px 16px 0;
    min-height: 12px;
}

.tpg-viewer-bar {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px 16px;
}

.tpg-viewer-btn {
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 13px;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tpg-viewer-btn:active {
    background: rgba(255, 255, 255, 0.22);
}

.tpg-viewer-btn--primary {
    background: #7f9f66;
    border-color: #7f9f66;
    font-weight: 600;
}

.tpg-viewer-btn--primary:active {
    background: #6e8d57;
}

/* 窄屏适配：面板铺满宽度 */
@media (max-width: 480px) {
    .tpg-sheet {
        max-width: 100%;
    }
}
