/* Custom CSS for Woo Enhanced Attributes Frontend */

/* 1. 隐藏重复的属性名称 */
/* 隐藏 WooCommerce 默认的属性名列 */
.variations_form .variations th.label {
    display: none;
}

/* 隐藏 WooCommerce 产品详情页的原始单价 */
.single-product .summary .price {
    display: none !important;
}

/* 隐藏 WooCommerce 属性表单的清除按钮 */
.reset_variations {
    display: none !important;
}

/* */
.woocommerce-js div.product form.cart .variations {
    border-bottom: 0 !important;
}

/* 确保我们自己的标签仍然可见 */
.pfm-attribute-label {
    display: block; /* Ensure it takes full width */
    font-weight: bold;
    margin-bottom: 5px; /* Space between label and custom input */
    color: #333; /* Darker color for emphasis */
    font-size: 1.1em; /* Slightly larger */
}

/* --- 核心间距和边框样式修正 --- */

/* 为所有自定义属性的外部 section 添加底部间距 */
/* 这些 div.pfm-custom-attribute-section 包裹了每个属性的渲染内容 */
/* 包括 Bulk Discount, Size, Color, Dropdown, Upload Patterns */
.pfm-custom-attribute-section {
    margin-bottom: 15px; /* 统一每个属性区块底部的间距 */
}

/* 保持各个属性内容 wrapper 的原有样式 */
/* 这些是 Text, Color, Table, Upload 属性内部的实际内容包装器 */
.pfm-attribute-text-wrapper,
.pfm-attribute-color-wrapper,
.pfm-attribute-table-wrapper, /* Table wrapper 已经有 padding: 0 !important; */
.pfm-attribute-upload-wrapper {
    /* 这些是原有的共享样式，包含 border, padding, background-color */
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
    background-color: #f9f9f9;
    /* 移除这些 wrapper 上的 margin-bottom, 因为由 .pfm-custom-attribute-section 控制 */
    margin-bottom: 0; /* 确保这些内部 wrapper 不产生额外的底部间距 */
}

/* Dropdown 的 select 标签，需要单独设置其样式，因为它不是一个 div wrapper */
/* 给予它与 Text/Color/Upload wrapper 相似的边框和内边距 */
.pfm-dropdown-attribute-select {
    width: 100%; /* 确保宽度一致 */
    box-sizing: border-box; /* 确保 padding 和 border 包含在 width 内 */
    /* 保持原有外观，只增加边框和内边距 */
    border: 1px solid #ddd;
    padding: 8px 10px; /* 调整内边距，使其与输入框类似 */
    border-radius: 4px; /* 保持圆角 */
    background-color: #f9f9f9; /* 背景色 */
    height: auto; /* 让高度自适应内容 */
    line-height: normal; /* 保持默认行高 */
    display: block; /* 确保它独占一行，以便 margin-bottom 生效 */
}


/* Note 和总价区域的外部容器 */
.pfm-global-product-extras {
    /* 仅控制与前面属性 section 的间距 */
    margin-top: 15px;
    /* 移除之前错误添加的 border, padding, background-color，保持其透明和无边框 */
    /* border: none; */
    /* padding: 0; */
    /* background-color: transparent; */
}

/* Note Textarea Styles */
.pfm-attribute-note-wrapper {
    /* 恢复 Note 区域自身的顶部间距，使其与 Quantity 或其他内容保持距离 */
    margin-bottom: 15px; /* Note 区域与总价区域之间的间距 */
}

.pfm-note-field {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.pfm-note-field:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Price Calculation Summary */
.pfm-price-calculation-summary {
    background-color: #e9f7ff;
    border: 1px solid #cce9ff;
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 0; /* 与 Note Textarea 紧密相连，间距由 Note 区域的 margin-bottom 控制 */
    display: none;
}

.pfm-qty-price-display {
    font-size: 1.1em;
    color: #333;
    margin-bottom: 5px;
}

.pfm-total-price-display {
    font-size: 1.8em !important;
    font-weight: bold !important;
    color: #007bff !important;
}


/* 2. Text 属性类型布局和输入框长度 */
.pfm-attribute-text-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.pfm-text-attribute-item {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-grow: 0;
    flex-shrink: 0;
    min-width: 120px;
}

.pfm-text-attribute-item label {
    font-size: 0.95em;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: bold;
}

.pfm-text-attribute-input {
    width: auto;
    flex-grow: 1;
    max-width: 100px;
    padding: 6px 8px !important;
    font-size: 0.95em;
    min-height: 32px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.pfm-text-attribute-input:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Color Attribute Type Styles */
.pfm-attribute-color-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.pfm-color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #ccc;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s ease-in-out;
    display: block;
}

.pfm-color-swatch:hover {
    border-color: #999;
    transform: scale(1.05);
}

.pfm-color-swatch.selected {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
}


/* Upload Attribute Type Styles */
.pfm-attribute-upload-wrapper {
    /* border, padding, background-color 已在通用样式中 */
}

.upload-areas-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.combined-preview-container {
    border: 1px solid #ddd;
    padding: 10px;
    position: relative;
    display: flex;
    gap: 10px;
    border-radius: 5px;
    background-color: #f9f9f9; /* 保持与 pfm-attribute-upload-wrapper 相同的背景色 */
    flex: 1 1 48%;
    /* min-width: 400px; */
    min-width: 100%;
    box-sizing: border-box;
}

[class$="-dropzone"] {
    flex: 1;
    padding: 5px;
    text-align: center;
    position: relative;
    min-height: 150px;
    cursor: pointer;
    background-color: #fff;
    border: 1px dashed #ced4da;
    border-radius: 4px;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

[class$="-dropzone"]:hover,
[class$="-dropzone"].dragover {
    border-color: #adb5bd;
    background-color: #f0f0f0;
}

.image-preview-box {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 150px;
    width: 100%;
    border: 1px dashed #ced4da;
    border-radius: 4px;
    background-color: #fff;
    margin-top: 5px;
}

.image-preview-box:hover {
    border-color: #adb5bd;
    background-color: #f0f0f0;
}

.image-preview-box .image-preview {
    max-width: 100%;
    max-height: 100%;
    display: none;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.image-preview-box .dropzone-hint {
    color: #999;
    font-size: 14px;
    display: block;
}

.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* 按钮组和状态显示区域 */
.pfm-attribute-upload-wrapper > div[style*="margin-top: 15px; display: flex;"] {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.upload-all-btn,
.clear-all-btn {
    padding: 8px 15px;
    flex: 1;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.upload-all-btn {
    background-color: #3a5a8a;
    color: white;
}

.upload-all-btn:hover:not(:disabled) {
    background-color: #2c4a7a;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.clear-all-btn {
    background-color: #dc3545;
    color: white;
}

.clear-all-btn:hover:not(:disabled) {
    background-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.upload-all-btn:disabled,
.clear-all-btn:disabled {
    background-color: #adb5bd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.upload-status {
    margin-top: 10px;
    font-size: 13px;
    min-height: 20px;
}

[class$="-status"] {
    margin-bottom: 5px;
}

.upload-status [class$="-status"] span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}


/* Table Attribute Type Styles */
.pfm-attribute-table-wrapper {
    border: 1px solid #ddd;
    padding: 0 !important; /* 保持表格无内边距 */
    border-radius: 5px;
    background-color: #f9f9f9;
    /* margin-bottom 已经由 .pfm-custom-attribute-section 控制 */
}

.pfm-custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    table-layout: fixed;
    border: none;
    margin: 0 !important;
}

/* 强制表格元素显示为标准的表格行为，并重新设置盒模型 */
.pfm-custom-table,
.pfm-custom-table tbody,
.pfm-custom-table tr {
    margin: 0 !important;
    /* display: table !important; */
    width: 100% !important;
    box-sizing: border-box !important;
}

.pfm-custom-table td {
    border: 1px solid #e0e0e0 !important; /* **关键：单元格边框** */
    padding: 8px 5px;
    text-align: center;
    vertical-align: middle;
    display: table-cell !important;
    box-sizing: border-box !important;
    white-space: nowrap;
    /* 恢复表格单元格的均匀宽度 */
    width: 14% !important; /* <--- 恢复这行！ */
}

.pfm-custom-table tr td:first-child {
    font-weight: bold;
    background-color: #f0f0f0;
    color: #444;
    text-align: center;
}


/* Price Calculation Summary */
.pfm-price-calculation-summary {
    background-color: #e9f7ff;
    border: 1px solid #cce9ff;
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 0; /* 与 Note Textarea 紧密相连，间距由 Note 区域的 margin-bottom 控制 */
    display: none;
}

.pfm-qty-price-display {
    font-size: 1.1em;
    color: #333;
    margin-bottom: 5px;
}

.pfm-total-price-display {
    font-size: 1.8em !important;
    font-weight: bold !important;
    color: #007bff !important;
}

/* Status message and button loading styles */
.uploading-status {
    animation: pulse 1.5s infinite;
    color: #6c757d;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.upload-image-btn.uploading {
    position: relative;
    color: transparent;
}

.upload-image-btn.uploading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Custom attributes display in Cart/Checkout */
.woocommerce-checkout-review-order-table dl.variation,
.woocommerce-cart-form__contents dl.variation {
    font-size: 0.95em;
    margin-top: 10px;
    margin-bottom: 10px;
}

.woocommerce-checkout-review-order-table dl.variation dt,
.woocommerce-cart-form__contents dl.variation dt {
    font-weight: bold;
    display: inline-block;
    margin-right: 5px;
    color: #333;
    width: auto; /* Allow natural width */
    float: none; /* Reset float if any */
}

.woocommerce-checkout-review-order-table dl.variation dd,
.woocommerce-cart-form__contents dl.variation dd {
    display: inline-block;
    margin: 0 0 0 5px; /* Adjust margin */
    color: #555;
    word-break: break-word; /* For long text values */
    width: auto;
    float: none;
}

.woocommerce-cart-form__contents dl.variation dd p {
    margin: 0; /* Remove default paragraph margin */
}

/* Specific styling for uploaded designs in cart/checkout */
.woocommerce-cart-form__contents .pfm-order-item-designs,
.woocommerce-checkout-review-order-table .pfm-order-item-designs,
.pfm-order-item-note, /* For order details/emails */
.pfm-order-item-text-attrs,
.pfm-order-item-color-attrs,
.pfm-order-item-dropdown-attrs {
    display: block; /* Ensures it takes full width */
    margin-top: 5px;
    font-size: 0.9em;
    color: #666;
}

.woocommerce-cart-form__contents .pfm-order-item-designs strong,
.woocommerce-checkout-review-order-table .pfm-order-item-designs strong,
.pfm-order-item-note strong,
.pfm-order-item-text-attrs strong,
.pfm-order-item-color-attrs strong,
.pfm-order-item-dropdown-attrs strong {
    color: #333;
}

.woocommerce-cart-form__contents .pfm-order-item-designs a,
.woocommerce-checkout-review-order-table .pfm-order-item-designs a {
    color: #007bff;
    text-decoration: none;
}

.woocommerce-cart-form__contents .pfm-order-item-designs a:hover,
.woocommerce-checkout-review-order-table .pfm-order-item-designs a:hover {
    text-decoration: underline;
}

/* Styling for image thumbnails in cart/checkout and order details */
.woocommerce-cart-form__contents .pfm-uploaded-cart-thumbnail,
.woocommerce-checkout-review-order-table .pfm-uploaded-cart-thumbnail,
.pfm-order-item-designs .pfm-uploaded-cart-thumbnail { /* Targeting the new class specifically */
    width: 60px; /* Increased size for better visibility */
    height: 60px; /* Increased size for better visibility */
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 5px; /* Slightly more rounded corners */
    vertical-align: middle;
    margin-right: 10px; /* More space to the right */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Subtle shadow for depth */
}

/* Specific styling for uploaded designs in cart/checkout */
/* Using the .pfm-uploaded-image-item class added in JS */
.pfm-uploaded-image-item {
    display: flex;
    flex-direction: column; /* Change to column layout */
    align-items: flex-start; /* Align items to the start of the cross-axis */
    margin-bottom: 10px; /* Space between multiple uploaded images */
}

.pfm-uploaded-image-item:last-child {
    margin-bottom: 0; /* No margin for the last item in the list */
}

.pfm-uploaded-image-item span {
    font-weight: bold;
    margin-bottom: 5px; /* Space between title and image */
    /* Removed white-space: nowrap; as it's a column layout */
}

.woocommerce-cart-form__contents .pfm-uploaded-cart-thumbnail,
.woocommerce-checkout-review-order-table .pfm-uploaded-cart-thumbnail,
.pfm-order-item-designs .pfm-uploaded-cart-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 5px;
    /* Removed vertical-align: middle; and margin-right: 10px; as they are not needed in column layout */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Custom attributes display in Cart/Checkout (WooCommerce Blocks) */
/* Target the specific classes used in the Block Cart HTML */
.wc-block-components-product-details__name {
    font-weight: bold; /* Ensure bold */
    text-transform: uppercase; /* Ensure uppercase */
    display: inline-block; /* Allow it to sit next to inline elements */
    vertical-align: middle; /* Align with attributes */
    margin-right: 10px; /* Space between product name and first attribute */
}

/* Container for product name and attributes within cart item */
.wc-block-cart-item__product-data {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px; /* Space between product name and the start of the attribute list */
}

/* Make the attribute list inline with product name */
ul.wc-block-components-product-details__attributes {
    display: inline-flex;
    flex-wrap: wrap;
    list-style: none; /* Remove default list bullets */
    padding: 0; /* Remove default padding */
    margin: 0; /* Remove default margin */
    gap: 10px; /* Space between attribute items */
    vertical-align: middle; /* Align with product name */
}

.wc-block-components-product-details__color {
    display: inline-flex; /* Changed to inline-flex to be inline with other list items/text */
    align-items: center; /* Changed from baseline to center for better vertical alignment */
    gap: 5px;
    flex-wrap: nowrap; /* Ensure no wrapping for the whole line */
}

.wc-block-components-product-details__color label {
    white-space: nowrap; /* Prevent "COLOR:" from wrapping */
    flex-shrink: 0; /* Prevent label from shrinking */
}

.wc-block-components-product-details__color .wc-block-components-product-details__value {
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 0; /* Important: Allows flex items to shrink below their content size */
}

/* Specific styling for uploaded designs in cart/checkout */
/* Using the .pfm-uploaded-thumb class added in JS */
.wc-block-cart-item__product .wc-block-components-product-details__value .pfm-uploaded-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 5px;
}

/* For color swatch within the block cart list item */
.wc-block-cart-item__product .wc-block-components-product-details__value span[style*="background-color"] {
    display:inline-block;
    width:15px;
    height:15px;
    border-radius:50%;
    vertical-align:middle;
    margin-right:5px;
    border:1px solid #ccc;
}

/* General styles for custom attributes in order details/emails (non-block cart context) */
.pfm-order-item-note,
.pfm-order-item-text-attrs,
.pfm-order-item-color-attrs,
.pfm-order-item-dropdown-attrs,
.pfm-order-item-designs {
    display: block;
    margin-top: 5px;
    font-size: 0.9em;
    color: #666;
}

.pfm-order-item-note strong,
.pfm-order-item-text-attrs strong,
.pfm-order-item-color-attrs strong,
.pfm-order-item-dropdown-attrs strong,
.pfm-order-item-designs strong {
    color: #333;
    /* For keys displayed by our own PHP, not the WC block components */
}

.pfm-order-item-designs a {
    color: #007bff;
    text-decoration: none;
}

.pfm-order-item-designs a:hover {
    text-decoration: underline;
}

/* Styling for image thumbnails in order details/emails (non-block cart context) */
.pfm-order-item-designs img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 5px;
}

/* Specific styling for uploaded designs in cart/checkout */
.pfm-uploaded-designs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px; /* 横向和纵向间隙 */
    margin-top: 10px;
    margin-bottom: 10px;
}

.pfm-uploaded-image-item {
    display: flex;
    flex-direction: column;
    align-items: center; /* 保持内容水平居中 */
    justify-content: space-between; /* 标题和图片之间有空间，并推向两端 */
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
    background-color: #f9f9f9;
    width: 180px; /* 固定宽度，例如180px */
    height: 180px; /* 固定高度，例如180px，使方框大小一致 */
    box-sizing: border-box; /* 确保padding和border包含在width/height内 */
    /* 移除 min-width 和 max-width，因为我们设置了固定宽度 */
}

.pfm-uploaded-title {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 8px; /* 标题和预览框之间的间距 */
    text-align: center;
    width: 100%;
    padding-bottom: 5px; /* 标题底部额外间距 */
    border-bottom: 1px dashed #eee; /* 添加虚线分割线 */
}

.pfm-uploaded-preview-box {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%; /* 填充父容器宽度 */
    flex-grow: 1; /* 允许预览框占据剩余空间 */
    height: auto; /* 让高度自适应，或者可以设置min-height */
    min-height: 100px; /* 确保有最小高度 */
    border: 1px dashed #ced4da;
    border-radius: 4px;
    background-color: #fff;
    overflow: hidden;
    margin-top: auto; /* 将预览框推到底部 */
}

.pfm-uploaded-cart-thumbnail {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* Adjust existing styles to avoid conflicts */
.woocommerce-cart-form__contents .pfm-uploaded-cart-thumbnail,
.woocommerce-checkout-review-order-table .pfm-uploaded-cart-thumbnail,
.pfm-order-item-designs .pfm-uploaded-cart-thumbnail {
    vertical-align: top;
    margin: 0;
}

.pfm-uploaded-image-item span {
    font-weight: normal;
    margin-bottom: 0;
}

/* Custom attributes display in Cart/Checkout (WooCommerce Blocks) */
/* Target the specific classes used in the Block Cart HTML */
.wc-block-components-product-details__upload-patterns .wc-block-components-product-details__value {
    display: flex;
    flex-wrap: wrap;
    gap: 15px; /* Adjust as needed */
    align-items: flex-start; /* Align items to the top */
    margin-top: 5px; /* Add some top margin if needed */
    /* Ensure the parent span does not have fixed height that cuts off content */
    min-height: 0; /* Reset any potential min-height */
}

/* Styling for color swatch in cart/checkout (WooCommerce Blocks) */
.pfm-cart-color-swatch {
    display: inline-block;
    width: 18px; /* Size of the color swatch */
    height: 18px; /* Size of the color swatch */
    border-radius: 50%; /* Make it circular */
    border: 1px solid #ccc; /* Subtle border for visibility */
    vertical-align: middle; /* Align with text */
    margin-right: 8px; /* Space between swatch and color code */
    box-shadow: 0 1px 2px rgba(0,0,0,0.1); /* Subtle shadow */
}

/* Ensure color code and swatch are vertically aligned */
.wc-block-components-product-details__color .wc-block-components-product-details__value {
    display: flex;
    align-items: center !important;
}

/* Disable quantity selector in cart */
/*.wc-block-components-quantity-selector__input { */
    /* pointer-events: none; /* Disable all mouse events */
    /* opacity: 0.7; /* Dim the input field */
    /* background-color: #f0f0f0; /* Light gray background to indicate disabled state */
    /* cursor: not-allowed; /* Change cursor to 'not-allowed' */
/*} */

/*.wc-block-components-quantity-selector__button { */
    /* pointer-events: none; /* Disable all mouse events */
    /* opacity: 0.5; /* Dim the buttons */
    /* cursor: not-allowed; /* Change cursor to 'not-allowed' */
/*} */

/* New: Styles for file icons (PDF, AI, EPS) */
.pfm-uploaded-file-icon {
    max-width: 80%; /* Adjust as needed for icons */
    max-height: 80%; /* Adjust as needed for icons */
    width: auto;
    height: auto;
    display: block; /* Remove extra space below icon */
    object-fit: contain;
}

/* ========================================= */
/* 2. Color Attributes                       */

/* New: Styles for Table Option Radios */
.pfm-table-options {
    margin-bottom: 10px; /* Space between radio buttons and the table */
    padding: 10px;
    border: 1px solid #eee;
    background-color: #fcfcfc;
    border-radius: 4px;
    display: flex; /* Make radios inline */
    flex-wrap: wrap;
    gap: 15px; /* Space between each radio label */
}

.pfm-table-options label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95em;
    color: #555;
}

.pfm-table-option-radio {
    margin-right: 5px;
    cursor: pointer;
}

/* Ensure the single table container is a block when displayed by JS */
.pfm-single-table-container {
    /* No specific styles needed here, as JS will control display */
    /* and inner pfm-custom-table has its own styles */
}

/* Styles for disabled quantity input */
input[name="quantity"].qty:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    border-color: #e0e0e0;
    opacity: 0.7;
}

/* Adjust the total area layout */
.pfm-calculated-total-area {
    margin-top: 15px;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: bold;
    display: flex; /* Make total area a flex container */
    flex-wrap: wrap; /* Allow wrapping */
    justify-content: space-between; /* Space out qty/price and total */
    align-items: baseline;
    gap: 10px; /* Space between elements within the total area */
}

.pfm-calculated-qty-price {
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex-grow: 1; /* Allow it to grow */
    flex-shrink: 0;
    white-space: nowrap; /* Keep Qty X Price on one line */
    font-size: 1em; /* Inherit from parent .pfm-calculated-total-area */
    color: inherit; /* Inherit from parent .pfm-calculated-total-area */
}

.pfm-calculated-total-display {
    font-size: 1.5em !important; /* Make total slightly larger within this area */
    font-weight: bold !important;
    color: #007bff !important;
    flex-shrink: 0;
}

/* hidden additional information li */
li.additional_information_tab {
    display: none !important;
}

/* hidden additional information table */
table.shop_attributes {
    display: none !important;
}

/* ========================================= */
/* 3. Radio Attribute Type Styles            */
/* ========================================= */

.pfm-attribute-radio-wrapper {
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
    background-color: #f9f9f9;
    margin-bottom: 0; /* 由 .pfm-custom-attribute-section 控制 */
}

.pfm-radio-groups-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pfm-radio-group {
    border: 1px solid #e0e0e0;
    padding: 15px;
    border-radius: 5px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.pfm-radio-group-header {
    margin-bottom: 10px;
}

.pfm-radio-group-title {
    margin: 0;
    font-size: 1.1em;
    color: #333;
    font-weight: bold;
}

.pfm-radio-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px; /* 限制最大高度 */
    overflow-y: auto; /* 添加垂直滚动 */
    padding-right: 5px; /* 为滚动条留出空间 */
}

.pfm-radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #fafafa;
    transition: all 0.2s ease-in-out;
    min-height: 20px;
}

.pfm-radio-option:hover {
    background-color: #f0f0f0;
    border-color: #ccc;
}

.pfm-radio-option.pfm-selected {
    background-color: #e3f2fd;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.pfm-radio-input {
    margin-right: 8px;
    cursor: pointer;
}

.pfm-radio-label {
    flex: 1;
    font-size: 0.95em;
    color: #555;
    cursor: pointer;
    word-break: break-word; /* 防止长文本溢出 */
}

/* 滚动条样式 */
.pfm-radio-options::-webkit-scrollbar {
    width: 6px;
}

.pfm-radio-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.pfm-radio-options::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.pfm-radio-options::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .pfm-radio-options {
        max-height: 150px; /* 移动端减小最大高度 */
    }
    
    .pfm-radio-option {
        padding: 6px 10px;
    }
    
    .pfm-radio-label {
        font-size: 0.9em;
    }
}

/* ========================================= */
/* 4. Price Calculation Display Styles       */
/* ========================================= */

.pfm-price-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: right;
    font-size: 1.1em;
}

.pfm-price-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.pfm-price-label {
    font-weight: bold;
    color: #333;
    min-width: 80px;
    text-align: left;
}

.pfm-price-value {
    color: #555;
    font-family: monospace;
    font-size: 1em;
}

.pfm-total-line {
    border-top: 1px solid #ddd;
    padding-top: 8px;
    margin-top: 4px;
}

.pfm-total-line .pfm-price-label {
    font-size: 1.2em;
    color: #007bff;
}

.pfm-total-line .pfm-price-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #007bff;
}

/* 调整原有的总价区域样式 */
.pfm-calculated-total-area {
    margin-top: 15px;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: bold;
    display: block; /* 改为块级显示 */
    text-align: right; /* 右对齐 */
}

.pfm-calculated-qty,
.pfm-calculated-price-per-unit {
    display: none; /* 隐藏原有的内联元素 */
}

/* PFM disabled quantity buttons */
.wc-block-components-quantity-selector__button.pfm-disabled,
.wc-block-components-quantity-selector__button:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

