/* 地址管理样式 */
.wechat-cart-address-section {
    margin-bottom: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

/* 当前地址显示 */
.current-address {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.current-address:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.address-icon {
    width: 20px;
    height: 20px;
    background: url('../images/location.svg') no-repeat center/contain;
    margin: 0 10px 0 0;
    flex: 0 0 20px;
}

.address-info {
    flex: 1;
    min-width: 0; /* 允许子元素的省略号生效 */
}

.address-contact {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.address-detail {
    color: #666;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 表单样式优化 */
.wechat-cart-address-section .address-form textarea#address {
    min-height: 70px;
    max-height: 120px;
    resize: vertical;
}

.toggle-address-list {
    width: 20px;
    height: 20px;
    background: url('../images/arrow-down.svg') no-repeat center;
    transition: transform 0.3s ease;
}

.toggle-address-list { margin-left: 8px; }
.address-list-container[style*='display: block'] ~ .toggle-address-list,
.wechat-cart-address-section .toggle-address-list.active {
    transform: rotate(180deg);
}


/* 添加到现有的 style.css 文件末尾 */

/* 加载动画 */
.wechat-cart-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    z-index: 9999;
}

/* 消息提示 */
.wechat-cart-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    border-radius: 4px;
    color: white;
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

.wechat-cart-message.success {
    background: #4CAF50;
}

.wechat-cart-message.error {
    background: #f44336;
}

/* 表单样式 */
.address-form {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-row {
    margin-bottom: 15px;
}

.form-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-row textarea {
    height: 80px;
}

.address-area {
    display: flex;
    gap: 10px;
}

.address-area select {
    flex: 1;
}

/* 按钮样式 */
.wechat-cart-address-section button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    background: black;
    color: white;
}

.add-new-address,
.import-wechat-address {
    background: #e02424; /* 红色底 */
    color: #fff;         /* 白色字 */
    margin-right: 10px;
    border-radius: 999px; /* 更圆滑的边角 */
}

.add-new-address:hover,
.import-wechat-address:hover {
    background: #c81e1e;
}

.edit-address {
    background: #67c23a;
    color: white;
}

.edit-address:hover {
    background: #529b2e;
}

.delete-address {
    background: #f56c6c;
    color: white;
}

.delete-address:hover {
    background: #e64242;
}

.set-default {
    background: #909399;
    color: white;
}

.set-default:hover {
    background: #777a80;
}

/* 动画 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 响应式样式 */
@media (max-width: 768px) {
    .address-area {
        flex-direction: column;
        gap: 5px;
    }
    
    .wechat-cart-address-section button {
        width: 100%;
        margin-bottom: 5px;
    }

    /* 手机端：仅当自定义选择器启用时隐藏原生下拉 */
    .wechat-cart-address-section .address-area.has-region-picker select { display: none !important; }
    .wechat-cart-address-section .address-area.has-region-picker .wca-region-trigger { display: block; }
}

/* 仅在前端结账页隐藏 Woo 默认字段：更安全的选择器（隐藏字段包裹，而非整个容器） */
/* 先恢复容器可见，避免某些主题将更多内容包在这些容器里导致整块消失 */
body.woocommerce-checkout .woocommerce-billing-fields,
body.woocommerce-checkout .woocommerce-shipping-fields,
body.woocommerce-checkout .woocommerce-additional-fields {
    display: block !important;
}
/* 隐藏具体字段区域（更精确） */
body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper,
body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper,
body.woocommerce-checkout .woocommerce-additional-fields .woocommerce-additional-fields__field-wrapper {
    display: none !important;
}
/* 确保我们的地址区块可见 */
.wechat-cart-address-section { display: block !important; }

/* 调整结账两列布局，移除主题设置的 flex:1 0 0 和 max-width:50% 限制 */
form.woocommerce-checkout > :is(.customer-details, .checkout-order-review) {
    order: unset;
    flex: unset;
    width: auto;
    max-width: unset;
}

/* Header arrow size */
.wechat-cart-address-section .header-arrow {
    font-size: 36px !important;
    line-height: 1;
}

/* Address list layout + selection dot */
.wechat-cart-address-section .address-item {
    position: relative;
    padding: 12px 12px 10px 36px; /* 左侧为圆点预留空间 */
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 10px;
}

.wechat-cart-address-section .address-lines { position: relative; }

.wechat-cart-address-section .address-lines .address-dot {
    position: absolute;
    left: -22px; /* 位于内边距区域，视觉居左 */
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #333; /* 黑色边框 */
    background: #fff;        /* 白色内部 */
}

.wechat-cart-address-section .address-item.default .address-lines .address-dot {
    border-color: #e02424;
    background: #e02424;
}

/* Default badge inline after phone */
.wechat-cart-address-section .default-badge,
.wechat-cart-address-section .default-badge-inline {
    color: #e02424;
    font-size: 12px;
    flex: 0 0 auto;
}

/* Separator now under address-detail */
.wechat-cart-address-section .address-content .address-detail {
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
    margin-bottom: 6px;
}
/* Hide legacy separator element */
.wechat-cart-address-section .address-sep { display: none; }

/* Actions row */
.wechat-cart-address-section .address-actions-row {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    justify-content: flex-end; /* 靠右对齐 */
}
.wechat-cart-address-section .address-actions-row button {
    font-size: 12px;
    background: transparent;
    color: #333;
    padding: 4px 6px;
}

/* Action icons */
.wechat-cart-address-section .address-actions-row .edit-address::before,
.wechat-cart-address-section .address-actions-row .delete-address::before,
.wechat-cart-address-section .address-actions-row .set-default::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.wechat-cart-address-section .address-actions-row .edit-address::before { background-image: url('../images/edit.svg'); }
.wechat-cart-address-section .address-actions-row .delete-address::before { background-image: url('../images/trash.svg'); }
.wechat-cart-address-section .address-actions-row .set-default::before { background-image: url('../images/star.svg'); }

/* Top action buttons icons */
.wechat-cart-address-section .add-new-address,
.wechat-cart-address-section .import-wechat-address {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.wechat-cart-address-section .add-new-address::before,
.wechat-cart-address-section .import-wechat-address::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.wechat-cart-address-section .add-new-address::before { background-image: url('../images/plus.svg'); }
.wechat-cart-address-section .import-wechat-address::before { background-image: url('../images/wechat.svg'); }
/* 展开时切换为减号图标 */
.wechat-cart-address-section .add-new-address.open::before { background-image: url('../images/minus.svg'); }

/* Bottom actions container: always at the end (after list and form) */
.wechat-cart-address-section .address-bottom-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== Overrides for requested UI tweaks ===== */
/* 1) 强制地址项为块级，避免主题样式设为 flex */
.wechat-cart-address-section .address-item { display: block !important; }

/* 2) 表单内 保存 / 取消 按钮：黑底白字，更圆润 */
.wechat-cart-address-section .address-form .form-actions .save-address,
.wechat-cart-address-section .address-form .form-actions .cancel-address {
    background: #111 !important;
    color: #fff !important;
    border-radius: 999px !important;
    padding: 10px 16px !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.wechat-cart-address-section .address-form .form-actions .save-address:hover,
.wechat-cart-address-section .address-form .form-actions .cancel-address:hover {
    background: #000 !important;
}

/* 保存/取消按钮的图标 */
.wechat-cart-address-section .address-form .form-actions .save-address::before,
.wechat-cart-address-section .address-form .form-actions .cancel-address::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.wechat-cart-address-section .address-form .form-actions .save-address::before {
    background-image: url('../images/check-white.svg');
}
.wechat-cart-address-section .address-form .form-actions .cancel-address::before {
    background-image: url('../images/close-white.svg');
}

/* 3) 地址列表操作按钮仅显示图标，圆形按钮，更精致 */
.wechat-cart-address-section .address-actions-row button {
    font-size: 10px; 
    line-height: 1;
    color: #333;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.wechat-cart-address-section .address-actions-row button:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}
.wechat-cart-address-section .address-actions-row .edit-address::before,
.wechat-cart-address-section .address-actions-row .delete-address::before,
.wechat-cart-address-section .address-actions-row .set-default::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* 4) 新增收货地址：红底白字，圆滑边角；展开时图标变减号（已在上方规则加入 open 切换）*/
.wechat-cart-address-section .add-new-address {
    background: #e02424;
    color: #fff;
    border-radius: 999px;
}
.wechat-cart-address-section .add-new-address:hover { background: #c81e1e; }

/* 展开时将“+”切换为“−”图标（置于文件末尾，确保覆盖） */
.wechat-cart-address-section .add-new-address.open::before {
    background-image: url('../images/minus-white.svg') !important;
    filter: none !important; /* 确保是白色，不被 invert 反转 */
}

/* ===== 用户请求：隐藏结账页左侧整块默认信息（customer-details） ===== */
body.woocommerce-checkout #customer_details,
body.woocommerce-checkout .customer-details {
    display: none !important;
}
/* 右侧订单区域占满宽度 */
body.woocommerce-checkout .checkout-order-review {
    width: 100% !important;
    max-width: 100% !important;
}

/* ===== 三级联动弹窗（手机端） ===== */
.wca-region-trigger {
    display: none; /* 桌面端隐藏，手机端在 has-region-picker 时显示 */
    width: 100%;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px 12px;
    color: #333;
}
.wca-region-trigger .wca-region-text { color: #666; }

.wca-region-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99999;
    display: none;
}
.wca-region-modal .wca-region-dialog {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 520px);
    max-height: 80vh;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.wca-region-modal .wca-region-header {
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
}
.wca-region-modal .wca-region-columns {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #eee;
}
.wca-region-modal .wca-region-col {
    flex: 1;
    max-height: 50vh;
    overflow-y: auto;
    border-right: 1px solid #f2f2f2;
}
.wca-region-modal .wca-region-col:last-child { border-right: 0; }
.wca-region-modal .wca-region-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f6f6f6;
}
.wca-region-modal .wca-region-item:hover { background: #fafafa; }
.wca-region-modal .wca-region-item.active {
    color: #e02424;
    background: #fff3f3;
}
.wca-region-modal .wca-region-footer {
    padding: 10px 12px;
    display: flex;
    gap: 10px;
}
.wca-region-modal .wca-btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}
.wca-region-modal .wca-btn.primary {
    background: #e02424;
    color: #fff;
    border-color: #e02424;
}

/* 更宽容的移动端阈值 */
@media (max-width: 1024px) {
    .wechat-cart-address-section .address-area.has-region-picker select { display: none !important; }
    .wechat-cart-address-section .address-area.has-region-picker .wca-region-trigger { display: block; }
}

/* 顶部“请添加收货地址”按钮文字超长省略 */
.wechat-cart-address-section .address-header .address-header-toggle {
    display: flex;
    align-items: center;
}
.wechat-cart-address-section .address-header .address-header-toggle {
    color: #000; /* 覆盖全局按钮白字，确保“请添加收货地址”显示为黑色 */
}
.wechat-cart-address-section .address-header .address-header-toggle span:nth-of-type(2) {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}