/* ==========================================
   色板/按钮排列方向 (layout_direction)
   prefix_class "direction-row" / "direction-col" 添加在 Elementor widget 外层
   ========================================== */

/* 横向排列 */
.direction-row .eco-swatch-wrapper,
.direction-row .eco-attr-list-wrapper {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* 纵向排列 */
.direction-col .eco-swatch-wrapper,
.direction-col .eco-attr-list-wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px;
    flex-wrap: nowrap;
    align-items: flex-start;
}

/* ==========================================
   颜色与按钮排列 (swatch_item_layout)
   prefix_class "clear-layout-row" / "clear-layout-col" 添加在 Elementor widget 外层
   仅在显示 Clear All 按钮时生效
   ========================================== */

/* 横向：颜色列表与按钮同行 */
.clear-layout-row .eco-swatch-main-wrapper.has-clear-all {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 15px;
}

/* 纵向：颜色列表与按钮上下排列 */
.clear-layout-col .eco-swatch-main-wrapper.has-clear-all {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 15px;
}

/* ==========================================
   色板基础样式
   ========================================== */
.eco-swatch-item {
    cursor: pointer;
    transition: all 0.3s;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    /* Elementor Border Control 会自动覆盖下面两个属性 */
    border: 2px solid transparent;
    border-radius: 50%;
    /* 为浅色提供边框辨识度 */
}

/* 动效 */
.eco-swatch-item:hover {
    transform: scale(1.05);
}

.eco-swatch-item.active {
    transform: scale(1.1);
}

/* ==========================================
   普通文本选项 (Normal Type) 专属默认样式
   ========================================== */
.eco-swatch-item.type-button {
    width: auto;
    /* 覆盖默认的定宽 */
    height: auto;
    /* 覆盖默认的定高 */
    min-width: 40px;
    /* 给个最小宽度更好看 */
    padding: 8px 16px;
    /* 默认内边距 */
    border-radius: 4px;
    /* 默认微圆角 */
    font-size: 14px;
    font-weight: 500;
    color: #333;
    background-color: #f7f7f7;
    border: 2px solid transparent;
    /* 预留边框空间，防止hover时跳动 */
}

/* 文字选项的 Active 默认样式 (若后台未配置则兜底) */
.eco-swatch-item.type-button.active {
    background-color: #111;
    color: #fff;
    border-color: #111;
}

/* 确保颜色圆块不受影响 */
.eco-swatch-item.type-color {
    border-radius: 50%;
}

/* ==========================================
   图片色板 (Image Type) 专属样式
   ========================================== */
.eco-swatch-item.type-image {
    width: auto;
    height: auto;
    padding: 2px;
    border-radius: 4px;
    overflow: hidden;
    background-color: transparent;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

/* 产品信息模式中的图片色板圆点 */
.eco-product-info-image-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}

.eco-swatch-clear {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 16px;
    background-color: #f7f7f7;
    border: 1px solid #e0e0e0;
    color: #555;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    outline: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* 鼠标悬停效果 */
.eco-swatch-clear:hover {
    background-color: #333;
    color: #fff;
    border-color: #333;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ==========================================
   属性列表样式（产品模式 & 购物车信息模式共用）
   ========================================== */

/* 默认纵向排列 */
.eco-product-info-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* 横向排列 */
.eco-info-layout-horizontal .eco-product-info-wrapper {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.eco-info-layout-horizontal .eco-product-info-item {
    margin-bottom: 0 !important;
}

/* 单个属性项 */
.eco-product-info-item {
    display: flex;
    align-items: center;
    line-height: 1.5;
}

/* 单个属性项内：标题与选项列表横向/纵向排列 */
.eco-info-item-layout-horizontal .eco-product-info-item {
    flex-direction: row;
    align-items: center;
}

.eco-info-item-layout-vertical .eco-product-info-item {
    flex-direction: column;
    align-items: flex-start;
}

/* 属性名 */
.eco-product-info-label {
    color: #999;
    white-space: nowrap;
}

/* 属性值 */
.eco-product-info-value {
    color: #333;
}

/* 颜色圆点 */
.eco-product-info-color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* 列表项内的下拉选择框 */
.eco-product-info-item .eco-swatch-select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    background-color: #fff;
    cursor: pointer;
    outline: none;
    max-width: 200px;
}

.eco-product-info-item .eco-swatch-select:focus {
    border-color: #999;
}

/* ==========================================
   列表按钮样式 (display_style = list)
   ========================================== */

.eco-attr-list-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.eco-attr-list-item {
    cursor: pointer;
    transition: all 0.25s ease;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    user-select: none;
    white-space: nowrap;
}

.eco-attr-list-item:hover {
    background-color: #e8e8e8;
    color: #111;
}

.eco-attr-list-item.active {
    background-color: #111;
    color: #fff;
    border-color: #111;
}

/* ==========================================
   WooCommerce Add To Cart 核心底层与适配样式
   ========================================== */

.wcs-add-to-cart-wrapper {
    display: flex;
    align-items: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* 纵向排列 */
.wcs-layout-vertical .wcs-add-to-cart-wrapper {
    flex-direction: column;
    align-items: flex-start;
    flex-wrap: nowrap;
}

/* 纵向排列时按钮宽度 100% */
.wcs-layout-vertical .wcs-add-to-cart-btn {
    width: 100%;
}

/* 标题样式 */
.wcs-cart-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

/* 核心：彻底清除 Input 和 Button 的默认 Outline 与聚焦阴影 */
.wcs-qty-input,
.wcs-qty-btn,
.wcs-add-to-cart-btn {
    outline: none !important;
    box-shadow: none !important;
    border: none;
    /* 按钮默认无边框 */
}

.wcs-qty-input:focus,
.wcs-qty-btn:focus,
.wcs-add-to-cart-btn:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* 隐藏所有数字输入框的上下微调箭头 */
.wcs-qty-input::-webkit-outer-spin-button,
.wcs-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wcs-qty-input {
    -moz-appearance: textfield;
    text-align: center;
}

/* Style 1: 独立输入框（默认底色与高宽） */
.wcs-quantity-wrapper.style-style1 .wcs-qty-input {
    width: 70px;
    height: 48px;
    border: 2px solid #eaeaea;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
}

/* Style 2: 左右加减按钮组合（外框） */
.wcs-quantity-wrapper.style-style2 {
    display: flex;
    align-items: center;
    border: 2px solid #eaeaea;
    /* 默认外层颜色 */
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.wcs-quantity-wrapper.style-style2 .wcs-qty-btn {
    background-color: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: background-color 0.2s ease;
    padding: 10px 20px;
}

.wcs-quantity-wrapper.style-style2 .wcs-qty-btn:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

/* Style 2：核心优化 —— 内层数字框左右两侧分隔线默认继承外框设置 */
.wcs-quantity-wrapper.style-style2 .wcs-qty-input {
    width: 100px;
    border-top: none;
    border-bottom: none;
    border-left: 2px solid #eaeaea;
    /* 后台修改边框粗细或颜色时会完美同步覆盖 */
    border-right: 2px solid #eaeaea;
    /* 后台修改边框粗细或颜色时会完美同步覆盖 */
    background-color: transparent;
    font-size: 16px;
    padding: 0;
    font-weight: 600;
}

/* Add To Cart 按钮基础架构 */
.wcs-add-to-cart-btn {
    height: 48px;
    padding: 0 36px;
    background-color: #111;
    /* 后台没设置时的默认颜色 */
    color: #fff;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* ------------------------------------------
   Loading 进度条 / 图标与其无限平滑旋转动画
   ------------------------------------------ */
.wcs-btn-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    /* 图标与加载文字的间距 */
}

.wcs-loading-icon {
    display: inline-flex;
    animation: wcsSpin 1s linear infinite;
    /* 1秒一圈无限循环旋转 */
}

@keyframes wcsSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 加载与成功状态控制 */
.wcs-add-to-cart-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.wcs-add-to-cart-btn.added {
    background-color: #00a32a !important;
    color: #fff !important;
    border-color: #00a32a !important;
}

/* ==========================================
   提示消息样式（替代 alert 弹窗）
   ========================================== */
.wcs-cart-error {
    width: 100%;
    color: #e74c3c;
    font-size: 13px;
    line-height: 1.5;
    text-align: left;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wcs-cart-error.wcs-cart-error-visible {
    opacity: 1;
}

/* 纵向排列时提示消息宽度跟随按钮 */
.wcs-layout-vertical .wcs-cart-error {
    width: 100%;
}

/* ==========================================
   Products Loop Item 添加到购物车
   ========================================== */
.lx-loop-add-to-cart-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.lx-loop-add-to-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 12px 24px;
    color: #fff;
    background-color: #111;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}

.lx-loop-add-to-cart-btn:not(:disabled):hover {
    background-color: #333;
}

.lx-loop-add-to-cart-btn.is-loading,
.lx-loop-add-to-cart-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.lx-loop-add-to-cart-btn.is-added {
    background-color: #00a32a;
    border-color: #00a32a;
}

.lx-loop-add-to-cart-message {
    display: none;
    width: 100%;
    color: #e74c3c;
    font-size: 13px;
    line-height: 1.4;
}

.lx-loop-add-to-cart-message.is-visible {
    display: block;
}
