/**
 * WeightLoss Brazil - Frontend Styles
 * Vida Mais Bela 前端样式
 *
 * @author WeightLoss Brazil Team
 * @version 1.3.0
 *
 * ============================================================================
 * 样式架构 / Style Architecture
 * ============================================================================
 *
 * 本文件包含以下样式模块:
 *
 * 1. ANVISA Trust Badge - ANVISA信任徽章（巴西法规合规）
 * 2. CPF Field - CPF字段自定义（巴西税号）
 * 3. Payment Gateway - 支付网关自定义
 * 4. Checkout Page - 结账页面增强
 * 5. Mobile Optimization - 移动端优化
 * 6. Product Page - 产品页面增强
 * 7. Accessibility - 无障碍/颜色对比度修复
 *
 * ============================================================================
 * 最佳实践 / Best Practices
 * ============================================================================
 *
 * 【性能】
 * - 此CSS会被异步加载（见class-performance-optimizer.php）
 * - 首屏关键样式应内联在Critical CSS中
 * - 避免使用@import，会阻塞渲染
 * - 避免过度使用!important（除非覆盖第三方样式）
 *
 * 【无障碍 WCAG AA标准】
 * - 文字与背景对比度至少4.5:1
 * - 大文字(18px+加粗或24px+)对比度至少3:1
 * - 链接必须有下划线或其他视觉区分
 * - 所有交互元素必须有focus状态
 *
 * 【颜色对比度参考】
 * - #ffffff 在 #c2185b 上: 对比度 4.78:1 ✓
 * - #ffffff 在 #0d47a1 上: 对比度 7.14:1 ✓
 * - #ffffff 在 #212121 上: 对比度 16.01:1 ✓
 * - #1b5e20 在 #ffffff 上: 对比度 7.08:1 ✓
 *
 * 【颜色调色板】
 * 品牌绿色: #27ae60 (主要按钮、成功状态)
 * 品牌粉色: #c2185b (CTA按钮、强调)
 * 深蓝色: #0d47a1, #1a237e (优惠码区域)
 * 中性色: #2c3e50 (标题), #7f8c8d (次要文字)
 * 错误色: #e74c3c (表单验证)
 *
 * 【修改此文件时】
 * 1. 更新版本号（WLB_VERSION in main plugin file）
 * 2. 测试移动端和桌面端
 * 3. 使用PageSpeed检查无障碍分数
 * 4. 确保不影响现有功能
 *
 * ============================================================================
 */


/* ============================================================================
   1. ANVISA Trust Badge - ANVISA信任徽章
   ============================================================================

   【用途】
   显示产品的ANVISA（巴西国家卫生监督局）注册信息
   增加用户对产品合法性的信任

   【两种变体】
   - .wlb-anvisa-badge: 完整版，用于产品详情页
   - .wlb-anvisa-badge-mini: 迷你版，用于产品列表循环

   【颜色说明】
   绿色(#27ae60)代表安全、合规、值得信赖
*/

.wlb-anvisa-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border: 2px solid #27ae60;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.15);
}

.wlb-anvisa-badge .badge-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: #27ae60;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.wlb-anvisa-badge .badge-icon svg {
    width: 28px;
    height: 28px;
}

.wlb-anvisa-badge .badge-content {
    flex: 1;
}

.wlb-anvisa-badge .badge-title {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
}

.wlb-anvisa-badge .badge-number {
    font-size: 14px;
    font-weight: 600;
    color: #27ae60;
    margin-bottom: 2px;
}

.wlb-anvisa-badge .badge-subtitle {
    font-size: 12px;
    color: #229954;
    font-weight: 500;
}

/* ANVISA Badge Mini - 用于产品列表循环 */
.wlb-anvisa-badge-mini {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #27ae60;
    color: #fff;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 8px;
}

.wlb-anvisa-badge-mini .badge-icon {
    font-size: 14px;
}


/* ============================================================================
   2. CPF Field Customization - CPF字段自定义
   ============================================================================

   【用途】
   CPF是巴西的个人纳税人登记号(Cadastro de Pessoas Físicas)
   类似于中国的身份证号，是结账必填项

   【格式】
   XXX.XXX.XXX-XX (11位数字)
   使用等宽字体便于用户核对数字

   【验证状态】
   .woocommerce-invalid 类由WooCommerce在验证失败时添加
*/

.wlb-cpf-field input {
    font-family: monospace;
    letter-spacing: 0.5px;
}

.wlb-cpf-field.woocommerce-invalid input {
    border-color: #e74c3c;
}

.wlb-cpf-field.woocommerce-invalid label {
    color: #e74c3c;
}


/* ============================================================================
   3. Payment Gateway Customization - 支付网关自定义
   ============================================================================

   【双支付网关系统】
   网站支持两种支付方式:
   1. 本地支付 (Mercado Pago/PagSeguro) - 绿色边框 #27ae60
      - Pix (巴西即时支付)
      - 信用卡分期 (Parcelas)

   2. 加密货币 (Coinbase Commerce) - 橙色边框 #f39c12
      - BTC, ETH, USDT, USDC

   【颜色编码】
   通过左边框颜色帮助用户快速识别支付类型
*/

.wlb-payment-instructions {
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-left: 4px solid #27ae60;
    border-radius: 4px;
}

.wlb-payment-instructions h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #2c3e50;
}

.wlb-payment-instructions .payment-subtitle {
    margin: 0;
    font-size: 14px;
    color: #7f8c8d;
}

/* Payment Method Items - 支付方式项目 */
.wc_payment_method {
    margin-bottom: 15px;
}

/* 本地支付 - 绿色标识 */
.wc_payment_method.wlb-payment-local label {
    border-left: 3px solid #27ae60;
}

/* 加密货币 - 橙色标识 */
.wc_payment_method.wlb-payment-crypto label {
    border-left: 3px solid #f39c12;
}

.wlb-payment-desc {
    margin-top: 10px;
    padding-left: 30px;
}

.wlb-payment-desc p {
    margin-bottom: 8px;
    font-weight: 500;
}

.wlb-payment-desc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wlb-payment-desc ul li {
    padding: 4px 0;
    font-size: 13px;
    color: #34495e;
}


/* ============================================================================
   4. Checkout Page Enhancements - 结账页面增强
   ============================================================================

   【转化优化】
   - 安全徽章增加用户信任
   - 清晰的步骤标题引导用户完成结账
   - 绿色配色传达安全感
*/

.woocommerce-checkout .woocommerce-billing-fields h3,
.woocommerce-checkout #order_review_heading {
    background: #27ae60;
    color: #fff;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Secure Checkout Badge - 安全结账徽章 */
.woocommerce-checkout::before {
    content: "🔒 CHECKOUT SEGURO";
    display: block;
    text-align: center;
    padding: 10px;
    background: #2c3e50;
    color: #fff;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 20px;
}


/* ============================================================================
   5. Mobile Optimization - 移动端优化
   ============================================================================

   【重要性】
   巴西用户主要通过移动设备访问
   Mariana用户画像显示移动端优先(Instagram用户)

   【断点】
   768px: 平板/手机分界点
*/

@media (max-width: 768px) {
    .wlb-anvisa-badge {
        flex-direction: column;
        text-align: center;
    }

    .wlb-anvisa-badge .badge-icon {
        margin: 0 auto;
    }

    .wlb-payment-instructions {
        padding: 12px;
    }

    .wlb-payment-instructions h3 {
        font-size: 16px;
    }

    .wlb-payment-desc {
        padding-left: 15px;
    }
}


/* ============================================================================
   6. Product Page Enhancements - 产品页面增强
   ============================================================================

   【转化优化】
   - 突出显示价格（大字号、品牌色）
   - 醒目的"加入购物车"按钮
   - 清晰的库存状态指示
*/

.single-product .product_meta {
    margin-top: 20px;
}

.single-product .price {
    color: #27ae60;
    font-size: 28px;
    font-weight: 700;
}

.single-product .price del {
    color: #95a5a6;
    font-size: 18px;
    opacity: 0.7;
}

/* Add to Cart Button - 加入购物车按钮 */
.single-product .single_add_to_cart_button {
    background: #27ae60;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    padding: 16px 32px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.single-product .single_add_to_cart_button:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

/* Stock Status - 库存状态 */
.stock {
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-block;
    margin: 10px 0;
}

.stock.in-stock {
    background: #d4edda;
    color: #155724;
}

.stock.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}


/* ============================================================================
   7. Accessibility - 无障碍/颜色对比度修复
   ============================================================================

   【WCAG 2.1 AA标准】
   - 普通文字: 对比度至少4.5:1
   - 大文字(18px+粗体或24px+): 对比度至少3:1
   - 交互元素必须有可见的focus状态

   【PageSpeed无障碍审计】
   这些样式修复了PageSpeed Insights报告的对比度问题

   【!important使用说明】
   使用!important是因为需要覆盖主题或第三方插件的样式
   这是无障碍修复的常见做法

   【颜色选择】
   所有颜色组合都经过WCAG对比度检查工具验证:
   - WebAIM Contrast Checker
   - Chrome DevTools Lighthouse
*/

/* ----- Hero Button - 英雄区按钮 ----- */
/* 原始颜色对比度不足，修改为深粉色确保可读性 */
/* #ffffff on #c2185b = 4.78:1 ✓ */
.hero-btn {
    background: #c2185b !important;
    color: #ffffff !important;
    font-weight: 700;
    text-shadow: none;
    border: none;
}

.hero-btn:hover,
.hero-btn:focus {
    background: #ad1457 !important;
    color: #ffffff !important;
}

/* ----- Coupon Code Elements - 优惠码区域 ----- */
/* 使用深蓝色背景确保白色文字可读 */
/* #ffffff on #1a237e = 12.37:1 ✓ */
/* #ffffff on #0d47a1 = 7.14:1 ✓ */
.code-label,
.code-box {
    background: #1a237e !important;
    color: #ffffff !important;
    font-weight: 600;
}

.code-val {
    background: #0d47a1 !important;
    color: #ffffff !important;
    font-weight: 700;
    padding: 8px 16px;
}

.coupon-btn {
    background: #c2185b !important;
    color: #ffffff !important;
    font-weight: 700;
    text-decoration: none !important;
}

.coupon-btn:hover,
.coupon-btn:focus {
    background: #ad1457 !important;
    color: #ffffff !important;
}

.code-box:hover,
.code-box:focus {
    background: #0d1547 !important;
}

/* ----- Trust Bar Elements - 信任栏 ----- */
/* 深色背景确保白色文字高对比度 */
/* #ffffff on #212121 = 16.01:1 ✓ */
/* #e0e0e0 on #212121 = 12.61:1 ✓ */
.trust-bar {
    background: #212121 !important;
    color: #ffffff !important;
}

.trust-title {
    color: #ffffff !important;
    font-weight: 700;
    font-size: 16px;
}

.trust-desc {
    color: #e0e0e0 !important;
    font-weight: 500;
}

/* ----- Product Price Contrast - 产品价格对比度 ----- */
/* 深绿色确保价格文字可读 */
/* #1b5e20 on #ffffff = 7.08:1 ✓ */
.product-details .woocommerce-Price-amount,
.product-details .woocommerce-Price-currencySymbol {
    color: #1b5e20 !important;
    font-weight: 700;
}

/* ----- Hero Section Text - 英雄区文字 ----- */
/* 白色文字配合阴影确保在任何背景图上可读 */
.hero-section .hero-title,
.hero-section .hero-subtitle,
.hero-section .hero-badge {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* ----- Links in Content - 内容区链接 ----- */
/* 链接使用下划线区分，颜色满足对比度要求 */
/* #0d47a1 on #ffffff = 7.14:1 ✓ */
.entry-content a,
.product-details a {
    color: #0d47a1;
    text-decoration: underline;
}

.entry-content a:hover,
.entry-content a:focus,
.product-details a:hover,
.product-details a:focus {
    color: #1565c0;
}

/* ----- Form Labels and Inputs - 表单标签和输入框 ----- */
/* #212121 on #ffffff = 16.01:1 ✓ */
/* #757575 placeholder满足3:1最低要求 */
label {
    color: #212121;
    font-weight: 500;
}

input::placeholder,
textarea::placeholder {
    color: #757575;
}

/* ----- Button Contrast Note - 按钮对比度说明 ----- */
/* min-contrast是注释性属性，提醒开发者按钮需满足4.5:1 */
.button,
.btn,
button[type="submit"] {
    min-contrast: 4.5;
}

/* ----- Focus States - 焦点状态 ----- */
/* 键盘导航必需 - 所有交互元素必须有可见的focus状态 */
/* 使用2px蓝色轮廓，与背景形成强对比 */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* ----- Skip Link - 跳过导航链接 ----- */
/* 屏幕阅读器和键盘用户的无障碍功能 */
/* 默认隐藏，获得焦点时显示 */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #1976d2;
    color: #fff;
    padding: 8px 16px;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
}
