/* =========================================
   详情页变体弹窗 - crystal
   ========================================= */

/* 隐藏原生 select，但保留在 DOM 中供 WooCommerce JS 使用 */
.single-product form.cart table.variations select,
.single-product form.variations_form table.variations select {
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    height: 0 !important;
}

/* 隐藏 cartify 可能加的 select2 包装 */
.single-product form.cart table.variations .select2-container,
.single-product form.variations_form table.variations .select2-container {
    display: none !important;
}

/* 触发按钮 */
.crystal-single-picker {
    position: relative;
    margin: 0 0 15px;
    width: 100%;
}

.crystal-single-trigger {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border: 1px solid #d9d9d9;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    line-height: 1.4;
    text-align: left;
    color: inherit;
    transition: border-color .15s, box-shadow .15s;
}

.crystal-single-trigger:hover {
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.crystal-single-arrow {
    margin-left: 8px;
    font-size: 12px;
    opacity: .6;
    transition: transform .15s;
}
.crystal-single-trigger:hover .crystal-single-arrow {
    transform: translateY(1px);
}

/* 弹窗遮罩 */
.crystal-single-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: crystalFade .15s ease-out;
}

.crystal-single-modal[hidden] {
    display: none !important;
}

@keyframes crystalFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* 弹窗主体 */
.crystal-single-modal-inner {
    background: #fff;
    border-radius: 14px;
    max-width: 520px;
    width: 100%;
    max-height: 82vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
    animation: crystalPop .18s ease-out;
}

@keyframes crystalPop {
    from { transform: translateY(8px) scale(.98); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

/* 头部 */
.crystal-single-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.crystal-single-close {
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    color: #888;
    transition: color .15s;
}
.crystal-single-close:hover { color: #000; }

/* 列表 */
/* 列表 → grid 网格 */
.crystal-single-list {
    list-style: none;
    margin: 0;
    padding: 12px;
    overflow-y: auto;
    flex: 1 1 auto;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

/* 宽屏 3 列 */
@media (min-width: 560px) {
    .crystal-single-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* 极窄屏恢复 1 列 */
@media (max-width: 380px) {
    .crystal-single-list {
        grid-template-columns: 1fr;
    }
}

/* 单项 */
.crystal-single-list li {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 10px 6px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .12s, box-shadow .12s;
    position: relative;
    font-size: 13px;
    text-align: center;

    background: #fafafa;
}

.crystal-single-list li:hover {
    background: #f0f2f5;
}

.crystal-single-list li.is-selected {
    background: #eaf3ff;
    box-shadow: inset 0 0 0 1px #b8d8ff;
}

/* 图片在 grid 里改成方块顶部，放大一点 */
.crystal-single-list li img {
    width: 100%;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid #eee;
    background: #fff;
}

/* 文字 */
.crystal-single-list li > span:first-of-type {
    display: block;
    width: 100%;
    line-height: 1.3;
    word-break: break-word;
    color: #333;
}

/* 无货 */
.crystal-single-list li.is-out-of-stock {
    opacity: .5;
    cursor: not-allowed;
    background: #f5f5f5;
}
.crystal-single-list li.is-out-of-stock:hover {
    background: #f5f5f5;
}
.crystal-single-list li.is-out-of-stock > span:first-of-type {
    text-decoration: line-through;
}

/* 无货标签：贴右上角 */
.crystal-single-oos {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 10px;
    font-weight: 600;
    color: #c00;
    background: #ffecec;
    padding: 2px 6px;
    border-radius: 999px;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

/* 滚动条 */
.crystal-single-list::-webkit-scrollbar { width: 8px; }
.crystal-single-list::-webkit-scrollbar-thumb {
    background: #ddd; border-radius: 4px;
}
.crystal-single-list::-webkit-scrollbar-thumb:hover { background: #bbb; }



