/* ----------------------------------------------------------------
   modal.css - 各种弹窗、Loading、提示层
---------------------------------------------------------------- */

.image-modal,
.order-summary-overlay {
    touch-action: none;
}

/* --- 桌面端限制 Modal (扫码) --- */
.restriction-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 5000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}
.restriction-modal.show {
    display: flex;
    opacity: 1;
}
.restriction-modal-card {
    background: white;
    width: 90%;
    max-width: 350px;
    border-radius: 16px;
    padding: 30px 25px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    position: relative;
    text-align: center;
}
.restriction-close {
    position: absolute;
    top: 10px; right: 15px;
    font-size: 24px;
    color: #ccc;
    cursor: pointer;
}
.restriction-title {
    font-size: 20px;
    font-weight: 700;
    color: #ff6b35;
    margin-bottom: 10px;
}
.restriction-message {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}
.qr-code-wrapper {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 10px;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.qr-code-img {
    width: 180px;
    height: 180px;
    display: block;
}
.qr-code-hint {
    font-size: 13px;
    color: #999;
    margin-top: 20px;
}

/* --- 订单详情/成功 Overlay --- */
.order-summary-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 4000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.order-summary-overlay.show {
    display: flex;
    opacity: 1;
}

.order-summary-card {
    position: relative;
    background: #fff;
    width: 100%;
    max-width: 380px;
    border-radius: 24px;
    padding: 30px 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.order-summary-overlay.show .order-summary-card {
    transform: scale(1);
}

.order-summary-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #ccc;
    cursor: pointer;
    line-height: 1;
    z-index: 5;
    padding: 5px;
    transition: color 0.2s;
}
.order-summary-close:hover {
    color: #666;
}

.success-icon-wrapper {
    width: 64px;
    height: 64px;
    background: #e6f7ef;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    margin-top: 10px;
}
.success-icon {
    width: 32px;
    height: 32px;
    color: #00bfa5;
    stroke-width: 3px;
}

.order-success-title {
    font-size: 20px;
    font-weight: 800;
    color: #333;
    margin-bottom: 8px;
    text-align: center;
}
.order-success-desc {
    font-size: 14px;
    color: #666;
    margin-bottom: 24px;
    text-align: center;
    line-height: 1.4;
    padding: 0 10px;
}

.order-ticket {
    width: 100%;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 24px;
}

.ticket-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 8px;
}
.ticket-row:last-child { margin-bottom: 0; }
.ticket-label { color: #888; }
.ticket-value { color: #333; font-weight: 500; text-align: right; }

.ticket-divider {
    height: 1px;
    background-image: linear-gradient(to right, #ccc 50%, transparent 50%);
    background-size: 8px 1px;
    margin: 12px 0;
    opacity: 0.5;
}

.ticket-items {
    max-height: 150px;
    overflow-y: auto;
    font-size: 13px;
}
.order-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    line-height: 1.4;
}
.order-item span:first-child { flex: 1; padding-right: 10px; color: #555; }
.order-item span:last-child { font-weight: 600; color: #333; }

.ticket-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 4px;
}
.ticket-total-label { font-size: 14px; font-weight: bold; color: #333; }
.ticket-total-value { font-size: 20px; font-weight: 800; color: #ff6b35; }

.order-actions-single {
    width: 100%;
    margin-top: 5px;
}

/* --- 订单确认弹窗 --- */
.order-confirm {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65); 
    backdrop-filter: blur(4px); 
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.2s;
}
.order-confirm.show {
    display: flex;
    opacity: 1;
}

.order-confirm-content {
    background: #fff;
    width: 85%;
    max-width: 360px;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    transform: scale(0.9);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.order-confirm.show .order-confirm-content {
    transform: scale(1);
}

.confirm-header h2 {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.confirm-items {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
    border: 1px solid #f5f5f5;
    border-radius: 12px;
    padding: 10px;
    background: #fcfcfc;
}
.confirm-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
    font-size: 14px;
}
.confirm-item:last-child { border-bottom: none; }
.confirm-item-name { flex: 1; color: #555; padding-right: 10px; }
.confirm-item-total { font-weight: 600; color: #333; }

.confirm-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    padding-top: 15px;
    border-top: 2px solid #f5f5f5;
}
.confirm-total span:first-child { font-size: 15px; color: #666; }
.confirm-total span:last-child { font-size: 26px; font-weight: 800; color: #ff6b35; }

.confirm-name input {
    width: 100%;
    padding: 14px;
    border: 2px solid #eee;
    border-radius: 12px;
    font-size: 16px;
    background: #f9f9f9;
    outline: none;
    text-align: center;
    margin-bottom: 20px;
    transition: all 0.2s;
}
.confirm-name input:focus {
    border-color: #ff6b35;
    background: white;
}

.confirm-actions {
    display: flex;
    gap: 12px;
}

/* --- 其它 Modal (图片/Loading) --- */
.image-modal { 
    position: fixed; 
    inset: 0; 
    background: rgba(0,0,0,0.92); /* 背景稍微加深一点点 */
    z-index: 3000; 
    display: none; 
    justify-content: center; 
    align-items: center; 
    /* 增加淡入动画 */
    opacity: 0;
    transition: opacity 0.3s ease;
}
.image-modal.show { 
    display: flex; 
    opacity: 1;
}

/* 兼容 Canvas 和 Img 的样式 */
.image-modal img,
.image-modal canvas { 
    max-width: 85%; /* 稍微缩小一点，给边缘留呼吸感 */
    max-height: 80%; 
    object-fit: contain; 
    z-index: 1; 
    position: relative; 
    
    /* === 新增美化样式 === */
    background-color: #fff; /* 给图片加个白底，防止透明PNG在黑底上看不清 */
    border-radius: 12px;    /* 圆角，看起来更高级 */
    box-shadow: 0 10px 40px rgba(0,0,0,0.5); /* 增加立体感 */
    
    /* 增加弹出动画 */
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.image-modal.show img,
.image-modal.show canvas {
    transform: scale(1);
}

/* === 关键修复：清除弹窗内继承的网格小水印 === */
/* 我们使用了选择器 .image-modal .product-image::after。
   这个选择器的优先级 (Specificity) 高于 styles.css 中的 .product-image::after。
   这样可以确保无论 CSS 加载顺序如何，都能强制关掉里面的小格子水印。
*/
.image-modal .product-image::after,
.image-modal *::after {
    content: none !important;
    display: none !important;
    background: none !important;
    background-image: none !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
}

/* 确保关闭按钮在最上层 */
.image-modal-close {
    position: absolute;
    top: 20px; right: 20px;
    color: white;
    font-size: 28px;
    cursor: pointer;
    z-index: 10;
    
    /* === 按钮美化 === */
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.image-modal-close:active {
    background: rgba(255,255,255,0.4);
}

/* === 弹窗图片防盗水印 (视觉遮罩 - 唯一保留的大水印) === */
/* 这个层在 .image-modal 上，是父级的水印，因此不会被上面的代码清除 */
.image-modal::after {
    content: "";
    position: absolute;
    inset: 0; 
    pointer-events: none;
    z-index: 2;

    /* 单个大水印设置 */
    background-size: 300px 300px;
    background-repeat: no-repeat;
    background-position: center;
    
    /* 透明度 */
    opacity: 0.16;
    
    /* 黑色水印 SVG */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Ctext x='50%25' y='50%25' dy='.35em' text-anchor='middle' font-family='Arial, sans-serif' font-weight='bold' font-size='18' transform='rotate(-45 50 50)' fill='%23000000'%3E NGH %3C/text%3E%3C/svg%3E");
}

/* 电脑端弹窗适配 */
@media (min-width: 1024px) {
    .image-modal::after {
        background-size: 400px 400px;
    }
}

.loading { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.8); color: white; padding: 20px 40px; border-radius: 10px; z-index: 5000; display: none; }
.loading.show { display: block; }