/* static/css/market.css */

/* === 1. 布局修正 === */
.showcase-wrapper {
    padding-top: 25px !important; 
    padding-bottom: 80px;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
}

/* 头部 */
.header-actions {
    padding: 15px 25px;
    margin-bottom: 20px; 
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.btn-upload {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--minori-orange);
    color: var(--minori-orange);
    padding: 8px 20px;
    border-radius: 99px;
    font-size: 0.9em;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.btn-upload:hover {
    background: var(--minori-orange);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 171, 118, 0.4);
}

/* === 2. 商品列表卡片 === */
.media-item {
    aspect-ratio: 1 / 1;
    background: #fff;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.05);
    z-index: 1;
}
.media-item.is-active { opacity: 0; }

.media-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(255, 171, 118, 0.15);
}

/* === 官方自营特效 (强化版金边 + 高光 + 高优先级) === */
.media-item.official {
    /* 用 !important 抢回 border 和阴影 */
    border: 2px solid #FFD700 !important;

    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.95),
        0 0 18px rgba(255, 215, 0, 0.8) !important;

    z-index: 3;
    position: relative;
}

/* 官方卡片 hover 时保持金光，不被全站 hover 阴影盖掉 */
.media-item.official:hover {
    transform: translateY(-6px);
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.98),
        0 0 22px rgba(255, 215, 0, 0.95) !important;
}

/* 官方自营价格胶囊加金色渐变（提升优先级） */
.media-item.official .price-badge {
    background: linear-gradient(45deg, #FFD700, #FFA500) !important;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* 左上角 OFFICIAL 绶带 */
.media-item.official::after {
    content: 'OFFICIAL';
    position: absolute;
    top: 12px;
    left: -32px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: white;
    font-size: 0.65em;
    font-weight: 800;
    padding: 4px 30px;
    transform: rotate(-45deg);
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    z-index: 6;
    pointer-events: none;
    letter-spacing: 1px;
}

/* 价格胶囊 (悬浮在右上角) */
.price-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--minori-orange);
    font-family: "Quicksand", sans-serif;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 5;
    font-size: 0.9em;
    pointer-events: none; /* 列表页点击交给容器 */
}

/* 底部信息条 (标题 + 卖家) */
.market-info-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 40px 10px 10px 10px;
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.8) 0%,
        rgba(0,0,0,0.6) 50%,
        transparent 100%
    );
    color: white;
    z-index: 4;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    transition: opacity 0.3s ease;
}

.market-title {
    font-size: 0.9em;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* 卖家信息铭牌 (毛玻璃矩形) */
.market-seller { 
    font-size: 0.75em; 
    opacity: 0.95;
    background: rgba(200, 200, 200, 0.25);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 4px 8px;
    display: flex; 
    align-items: center; 
    gap: 6px;
    color: #f0f0f0;
    font-weight: 600;
}

/* 身份指示灯 */
.role-light {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(255,255,255,0.5);
}

/* Admin: 金色呼吸灯 */
.role-light.light-admin {
    background-color: #FFD700;
    box-shadow: 0 0 8px #FFD700;
    animation: breatheLight 2s infinite;
}

/* Staff: 绿色呼吸灯 */
.role-light.light-staff {
    background-color: #88DD88;
    box-shadow: 0 0 8px #88DD88;
    animation: breatheLight 3s infinite;
}

/* User: 银色常亮 */
.role-light.light-user {
    background-color: #bdc3c7;
}

@keyframes breatheLight {
    0% { opacity: 0.6; box-shadow: 0 0 2px currentColor; }
    50% { opacity: 1; box-shadow: 0 0 8px currentColor; }
    100% { opacity: 0.6; box-shadow: 0 0 2px currentColor; }
}

/* 已售出遮罩 */
.sold-mask {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(3px);
}

.sold-stamp {
    border: 4px solid white;
    color: white;
    font-weight: 900;
    font-size: 1.6em;
    padding: 10px 20px;
    transform: rotate(-15deg);
    letter-spacing: 3px;
    opacity: 0.9;
    text-transform: uppercase;
}

/* 图片防盗：列表页缩略图可设为 .protected-img */
.protected-img {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: none; /* 交互依然由父容器处理 */
}

/* === 3. 弹窗基础 === */
.modal-overlay {
    display: none;
    position: fixed; 
    z-index: 5000;
    left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    justify-content: center; 
    align-items: center;
    transition: background 0.5s ease, backdrop-filter 0.5s ease;
}
.modal-overlay.active {
    display: flex; 
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
}

/* 发布表单弹窗 */
.upload-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 24px;
    width: 90%; 
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    transform: scale(0.9); 
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    opacity: 0;
}
.modal-overlay.active .upload-box { 
    transform: scale(1); 
    opacity: 1; 
}

/* === 4. 商品详情卡片 (FLIP 动画核心) === */
.detail-card {
    position: fixed;
    background: white;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); 
    transform-origin: center center;
    will-change: top, left, width, height, border-radius;
}

.detail-img-area {
    flex: 1.2; 
    background: #f8f8f8;
    display: flex; 
    align-items: center; 
    justify-content: center;
    overflow: hidden; 
    position: relative;
}
.detail-img-area img { 
    width: 100%; 
    height: 100%; 
    object-fit: contain;
    transition: transform 0.5s;
}

.detail-info-area {
    flex: 0.8; 
    padding: 40px;
    display: flex; 
    flex-direction: column;
    background: rgba(255,255,255,0.98);
    opacity: 0; 
    transition: opacity 0.3s ease; 
}

/* 关闭按钮 */
.close-detail-btn {
    position: absolute; 
    top: 20px; 
    right: 20px;
    width: 36px; 
    height: 36px; 
    border-radius: 50%;
    background: rgba(0,0,0,0.1); 
    color: #333;
    display: flex; 
    justify-content: center; 
    align-items: center;
    cursor: pointer; 
    font-size: 20px; 
    transition: 0.2s;
    z-index: 10;
}
.close-detail-btn:hover { 
    background: #333; 
    color: white; 
}

/* 大价格展示（详情卡片 + 详情页通用） */
.price-large {
    font-size: 2.5em;
    color: var(--minori-orange);
    font-weight: 800;
    margin: 15px 0;
    font-family: "Quicksand", sans-serif;
    letter-spacing: -1px;
}

/* 成色标签 */
.condition-tag {
    display: inline-block;
    background: #f0f0f0;
    color: #666;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 10px;
}

/* === 5. 详情页布局（非弹窗版本，可在独立页面使用） === */
.detail-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr; /* 左大右小 */
    gap: 40px;
    margin-top: 20px;
    align-items: start;
}

/* 左侧大图容器 */
.detail-img-box {
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.8);
    background: #fff;
    position: relative;
}

/* 右侧信息卡片 */
.detail-info-box {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.9);
    box-shadow: 0 10px 30px rgba(255, 171, 118, 0.1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 卖家卡片（详情页内） */
.seller-card {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px dashed rgba(0,0,0,0.05);
}

.seller-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #fff, #eee);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

/* === 6. 发布页表单网格 === */
.sell-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* === 7. 手机适配 === */
@media (max-width: 768px) {

    .showcase-wrapper { 
        padding-top: 20px !important; 
    }

    /* 列表页信息条略收紧 */
    .market-info-bar {
        padding: 15px 8px 8px 8px;
    }

    .market-title {
        font-size: 0.85em;
        max-width: 65%;
    }

    .price-badge {
        top: 5px;
        right: 5px;
        padding: 2px 8px;
        font-size: 0.8em;
    }

    /* 弹窗详情卡片改为上下布局 */
    .detail-card { 
        flex-direction: column; 
    }

    .detail-img-area { 
        flex: 1; 
        max-height: 50%; 
    }

    .detail-info-area { 
        flex: 1; 
        padding: 25px; 
    }

    /* 详情页布局：上下堆叠 */
    .detail-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .detail-info-box {
        padding: 25px;
    }

    .price-large { 
        font-size: 2em;
    }

    .header-actions h1 { 
        font-size: 1.5em; 
    }

    /* 发布表单在移动端改为单列 */
    .sell-form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* detail-grid 在移动端也适配双列 */
    .detail-grid { 
        display: grid; 
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px; 
        padding: 0 5px; 
    }
}
