/* ============================================================
   css/image-picker.css — 图片发送全屏面板（韩系唯美风）
   设计系统: 玫瑰金渐变 / 衬线体 / 线条图标 / 恋爱感动效
   窄屏适配: <370px 三列→两列
   ============================================================ */

/* ---- Overlay（open=入场动画独占 / close=transition，向右滑出） ---- */
.image-picker-overlay {
    position: absolute;
    inset: 0;
    z-index: 2350; /* #app 内局部层；body 级 viewer 用 var(--z-viewer) 恒在其上 */
    background: var(--bg-chat);
    display: none;
    flex-direction: column;
    opacity: 0;
    transform: translateX(100%);   /* ★ 关闭态：藏在右侧，退场向右滑出 */
    transition: transform 0.32s cubic-bezier(0.32,0.72,0,1), opacity 0.32s cubic-bezier(0.32,0.72,0,1);
}
.image-picker-overlay.open {
    display: flex;
    opacity: 1;
    transform: translateX(0);
    transition: none;             /* 断开 open 方向的 transition（防双驱动闪动） */
    animation: ipPagerFromRight 0.32s cubic-bezier(0.32,0.72,0,1);
}
.image-picker-overlay.closing {
    display: flex;
    opacity: 0;
    transform: translateX(100%);
    animation: none;
}
@keyframes ipPagerFromRight {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes ipSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .image-picker-overlay { transition: none; }
    .image-picker-overlay.open { animation: none; }
}

/* ---- Top bar ---- */
.ip-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(12px + var(--safe-top)) 16px 8px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface-solid);
}
.ip-topbar-title {
    font-family: 'Noto Serif SC', 'Times New Roman', serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}
.ip-topbar-en {
    font-family: 'Playfair Display', 'Times New Roman', serif;
    font-style: italic;
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 6px;
}
.ip-close-btn {
    width: 32px; height: 32px;
    border: none; background: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.15s ease;
}
.ip-close-btn:hover { background: var(--accent-light); color: var(--accent); }
.ip-close-btn:active { transform: scale(0.92); }
.ip-close-btn svg { width: 18px; height: 18px; }

.ip-add-btn {
    width: 32px; height: 32px;
    border: 1.5px solid var(--accent);
    background: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    border-radius: 50%;
    transition: all 0.15s ease;
}
.ip-add-btn:hover { background: var(--accent-light); }
.ip-add-btn:active { transform: scale(0.92); }
.ip-add-btn svg { width: 18px; height: 18px; }

/* 顶栏右侧动作组：拍摄 + 添加更多 */
.ip-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ip-camera-btn {
    width: 32px; height: 32px;
    border: 1.5px solid var(--accent);
    background: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    border-radius: 50%;
    transition: all 0.15s ease;
}
.ip-camera-btn:hover { background: var(--accent-light); }
.ip-camera-btn:active { transform: scale(0.92); }
.ip-camera-btn svg { width: 18px; height: 18px; }

/* ---- Grid （窄屏适配：三列→两列） ---- */
.ip-grid {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    align-content: start;
    -webkit-overflow-scrolling: touch;
}
/* 窄屏 <370px：两列 */
@media (max-width: 369px) {
    .ip-grid { grid-template-columns: repeat(2, 1fr); }
}

.ip-thumb {
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    background: var(--surface-solid);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: all 0.2s cubic-bezier(0.32,0.72,0,1);
    touch-action: none; /* 为拖拽排序让路 */
}
.ip-thumb:active { transform: scale(0.97); }
.ip-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: auto;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none; /* 禁长按弹浏览器默认「复制/保存图片」菜单 */
}

/* 上传中遮罩 */
.ip-thumb-uploading {
    position: absolute;
    inset: 0;
    background: rgba(255,252,248,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.ip-thumb-uploading.done { display: none; }

/* 小花旋转加载动画（不是系统圈圈！）*/
.ip-spinner-flower {
    width: 28px; height: 28px;
    animation: ipFlowerSpin 1.2s linear infinite;
}
.ip-spinner-flower svg {
    width: 100%; height: 100%;
    color: var(--accent);
}
@keyframes ipFlowerSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* 就绪标记 — 线条 ✓ */
.ip-ready-mark {
    position: absolute;
    top: 6px; right: 6px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px var(--accent-glow);
}
.ip-ready-mark.show { display: flex; }
.ip-ready-mark svg {
    width: 10px; height: 10px;
    color: #fff;
}

/* 删除按钮（SVG ×） */
.ip-remove-btn {
    position: absolute;
    top: 4px; left: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.45);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.ip-thumb:hover .ip-remove-btn,
.ip-thumb:active .ip-remove-btn { opacity: 1; }
.ip-remove-btn svg { width: 10px; height: 10px; color: #fff; }

/* 拖拽排序（位移式 FLIP）：被拖拽的原格透明占位（保留格子尺寸，布局不跳） */
.ip-thumb.ip-dragging-src {
    visibility: hidden;
}

/* 跟随手指的浮动克隆 */
.ip-drag-clone {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.92;
    transform: scale(1.06);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 32px rgba(0,0,0,0.22);
    will-change: left, top;
}

/* 让位动画：transform 过渡（FLIP 结束时由 JS 清除内联 transform 触发；.ip-thumb 已有 all 0.2s 过渡） */
@media (prefers-reduced-motion: reduce) {
    .ip-thumb { transition: none; }
}

/* ---- 空状态 ---- */
.ip-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
    font-family: 'Noto Serif SC', serif;
    font-size: 13px;
    line-height: 1.8;
}
.ip-empty-icon {
    display: block;
    margin: 0 auto 12px;
    width: 48px; height: 48px;
    color: var(--rose);
    opacity: 0.5;
}

/* ---- Bottom bar ---- */
.ip-bottom-bar {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    padding-bottom: calc(10px + var(--safe-bottom, 0px));
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--surface-solid);
}
.ip-btn {
    flex: 1;
    padding: 11px 0;
    border: none;
    border-radius: 12px;
    font-size: clamp(13px, 3.5vw, 15px);
    font-family: 'Noto Serif SC', 'Times New Roman', serif;
    font-weight: 500;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s cubic-bezier(0.32,0.72,0,1);
}
.ip-btn:active { transform: scale(0.96); }

.ip-btn-cancel {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.ip-btn-cancel:hover { background: var(--accent-light); }

.ip-btn-send {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 2px 10px var(--accent-glow);
}
.ip-btn-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
}
.ip-btn-send:active { transform: scale(0.96) translateY(0); }
.ip-btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 发送按钮中的计数标签 */
.ip-send-count {
    display: inline-block;
    background: rgba(255,255,255,0.25);
    border-radius: 8px;
    padding: 1px 7px;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 600;
}
