/*
 Theme Name:   SexDollG Child Theme
 Theme URI:    https://sexdollg.com/
 Description:  Use this child theme to extend SexDollG.
 Author:       sexdollg
 Author URI:   https://www.sexdollg.com/
 Template:     sexdollg
 Version:      1.2.1
 Last Updated: 2025-11-06
 Notes: Added align-self fix for EPO totals; mobile spacing tweak; Safari table rounding fix.
 Text Domain:  sexdollg
*/

/* =========================================================
   001 Brand Grid
   ========================================================= */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px 12px;
  padding: 20px;
  max-width: 1240px;
  margin: 0 auto;
}

.brand-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  padding: 4px 6px;
}
.brand-link:hover {
  opacity: 0.85;
  transform: scale(1.05);
}
.brand-name {
  white-space: nowrap;
  color: #fff;
}

/* Badge styles */
.badge:not(.onsale) {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.2;
  color: #fff;
}
.badge-top { background: #ff0099; }
.badge-new { background: #00cc00; }
.badge-affordable { background: #22bb22; }
.badge-torso { background: #ff6600; }
.badge-default { background: #666; }
.badge:empty { display: none; }

/* =========================================================
   004 Slider Arrows (Unified Splide + Swiper)
   ========================================================= */
.splide__arrow,
.swiper-button-prev,
.swiper-button-next {
  width: 36px !important;
  height: 36px !important;
  border-radius: 50%;
  background: rgba(246, 62, 116, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.splide__arrow svg {
  width: 14px;
  height: 14px;
  fill: #fff;
}
.splide__arrow:hover,
.swiper-button-prev:hover,
.swiper-button-next:hover {
  background: #f63e74;
  transform: scale(1.1);
}
.splide__arrow--prev { left: 8px; }
.splide__arrow--next { right: 8px; }
.swiper-button-prev::after,
.swiper-button-next::after {
  font-size: 14px !important;
  font-weight: bold;
  color: #fff !important;
}

@media (max-width: 480px) {
  .splide__arrow,
  .swiper-button-prev,
  .swiper-button-next {
    width: 28px !important;
    height: 28px !important;
  }
  .splide__arrow svg,
  .swiper-button-prev::after,
  .swiper-button-next::after {
    font-size: 12px !important;
  }
}

/* ========================================================= 004-1 Slider Pagination (outside container) ========================================================= */ .brxe-slider-nested { padding-bottom: 30px; padding-top: 2px; position: relative; } .splide__pagination__page.is-active, .swiper-pagination-bullet-active { background: #f63e74; transform: scale(1.2); } /* /* =========================================================
   💰 WooCommerce Dynamic Price Module (Compact v2)
   ========================================================= */

.price-module,
.product-price-wrap,
.js-price,
.js-price-center,
.woocs_price_code,
p.price,
[class*="brxe-"] .woocs_price_code {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.2;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 6px;
  margin-top: 6px;
  width: 100%;
  max-width: 100%;
}

/* Column layout */
.js-price {
  flex-direction: column;
  align-items: baseline;
  gap: 4px;
  margin-top: 4px;
}

/* One-line layout */
.js-price-center {
  gap: 8px;
  line-height: 0.5;
  padding-top: 1px;
  margin-top: 1px;
  white-space: nowrap;
  flex-wrap: nowrap;
}

/* Prevent shrink */
.js-price-center span {
  flex-shrink: 1;
  min-width: 0;
}

/* --- Main Price (Current) --- */
.price-now,
.present-price,
.js-set-price.present-price,
.woocs_price_code ins,
p.price ins {
  color: #f63e74;
  font-weight: 600;
  display: inline-flex;
  align-items: baseline;
  line-height: 1;
  letter-spacing: -0.3px;
  text-decoration: none;
  font-size: clamp(12px, 1vw, 16px);
}

.price-now .text-16,
.present-price .text-16 {
  font-size: clamp(11px, 1.8vw, 14px);
  margin-left: 1px;
  vertical-align: top;
}

/* --- Old Price (Crossed) --- */
.crossed-price,
.woocs_price_code del,
p.price del {
  text-decoration: line-through;
  color: #555;
  opacity: 0.75;
  font-size: clamp(10px, 0.9vw, 13px);
  margin: 0 4px;
}

/* --- Discount / Save --- */
.second-price,
.js-save-price {
  color: #555;
  opacity: 0.75;
  text-decoration: none;
  font-size: clamp(10px, 1.2vw, 13px);
}

.price-module,
.product-price-wrap,
.woocs_price_code {
  display: flex;
  justify-content: center !important;  /* ⬅️ 中心对齐 */
  align-items: center;
  flex-wrap: wrap;
  text-align: center;
  gap: 6px;
}

/* 优化删除线价格与当前价格的间距 */
.woocs_price_code del {
  opacity: 0.6;
  margin-right: 6px;
}

/* =========================================================
   006 Divider (Pink Center Line)
   ========================================================= */
.brxe-divider .line {
  height: 2px;
  border: none;
  background: linear-gradient(to right,
    #e5e5e5 0%,
    #e5e5e5 35%,
    #f63e74 35%,
    #f63e74 65%,
    #e5e5e5 65%,
    #e5e5e5 100%
  );
}

/* =========================================================
   007 Product Page Utility Classes
   ========================================================= */
.p-3.text-c {
  outline: 0.5px dashed red !important;
  text-align: center;
  font-weight: 200;
  padding: 0.5rem !important;
}
.mb-0, .my-0 { margin-bottom: 0 !important; }
.font-color6 { color: #666; }
.bold { font-weight: 600; }
.font-r075 { font-size: 0.75rem; }
ul.list-reset { list-style: none; padding: 0; margin: 0 0 0.2em; }
ul.list.dashed > li {
  padding: 10px 0;
  border-bottom: 1px dashed #ddd;
}
.flex { display: flex; }
.items-center { align-items: center; }
.ml-3, .mx-3 { margin-left: 1rem !important; }

/* =========================================================
   008 Product Gallery
   ========================================================= */
.single-product .div1 {
  font-size: 0;
  line-height: 0;
  margin-bottom: 16px;
}
.single-product .div1 img {
  width: calc(16.66% - 4px);
  margin: 2px;
  height: auto !important;
  display: inline-block;
  vertical-align: middle;
  border-radius: 2px;
  cursor: zoom-in;
  object-fit: cover;
  transition: opacity .2s ease, transform .2s ease;
}
.single-product .div1 img:hover {
  opacity: .88;
  transform: scale(1.02);
}
.single-product .div1 img[data-ll-status="loading"] { opacity: 0 !important; }
@media (max-width: 640px) {
  .single-product .div1 img { width: calc(33.33% - 4px); }
}
.single-product .ptit {
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.5px;
  margin: 30px 0 18px;
  color: #222;
  position: relative;
}
.single-product .ptit::after {
  content: "";
  display: block;
  width: 160px;
  height: 2px;
  background: #e94e77;
  margin: 6px auto 0;
  opacity: 0.85;
  border-radius: 2px;
}

/* =========================================================
   009 Responsive Smart Table System v3.3
   ========================================================= */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: clamp(14px, 1vw + 0.45rem, 16px);
  margin: 0 auto;
  table-layout: fixed;
  box-sizing: border-box;
  overflow: hidden; /* ✅ Safari rounding fix */
}
.brxe-container th,
.brxe-container td,
.entry-content th,
.entry-content td,
.woocommerce-product-details__short-description th,
.woocommerce-product-details__short-description td {
  border: 1px solid #ddd;
  padding-block: clamp(0.45em, 0.6vw, 0.8em);
  padding-inline: clamp(0.7em, 1.2vw, 1.5em);
  text-align: left;
  vertical-align: middle;
  line-height: 1.45;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
table thead th {
  background: linear-gradient(to bottom, #fafafa, #f2f2f2);
  font-weight: 600;
  color: #111;
  position: sticky;
  top: 0;
  z-index: 1;
}
@media (max-width: 768px) {
  .brxe-container table,
  .entry-content table,
  .woocommerce-product-details__short-description table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    table-layout: auto;
    font-size: clamp(11px, 2vw, 13px);
    width: 100%;
    border-left: none;
    border-right: none;
  }
  .brxe-container th,
  .brxe-container td,
  .entry-content th,
  .entry-content td,
  .woocommerce-product-details__short-description th,
  .woocommerce-product-details__short-description td {
    padding-block: clamp(0.35em, 0.5vw, 0.6em);
    padding-inline: clamp(0.6em, 1vw, 1.2em);
    font-size: inherit;
  }
}

/* =========================================================
   010 WooCommerce Tabs Layout Fix
   ========================================================= */
.woocommerce-Tabs-panel.entry-content,
.woocommerce-Tabs-panel {
  padding-top: 10px !important;
  padding-left: 12px !important;
  padding-right: 12px !important;
  margin-top: 0 !important;
  max-width: 100% !important;
}
@media (max-width: 768px) {
  .woocommerce-Tabs-panel.entry-content,
  .woocommerce-Tabs-panel {
    padding-top: 6px !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
  }
}

/* =========================================================
   011 Add to Cart + Buy Now alignment
   ========================================================= */
form.cart {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
form.cart .quantity {
  margin-right: auto;
}
form.cart .single_add_to_cart_button,
form.cart .wd-buy-now-btn {
  min-width: 160px;
  padding: 12px 28px;
  border-radius: 8px;
  font-weight: 600;
  text-align: center;
}
@media (max-width: 768px) {
  form.cart {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }
  form.cart .quantity {
    margin-right: 0;
  }
}
@media (max-width: 480px) {
  form.cart { gap: 8px; padding: 0 4px; } /* ✅ Mobile tweak */
}

/* =========================================================
   012 Align EPO Totals (Options + Final Total) to the right
   ========================================================= */
#tm-epo-totals {
  display: flex;
  justify-content: flex-end;
  text-align: right;
  align-self: flex-end; /* ✅ Prevent stretch by parent flex */
  margin-top: 10px;
  margin-bottom: 10px;
  width: 100%;
}
#tm-epo-totals dl.tm-extra-product-options-totals {
  display: inline-block;
  text-align: right;
  margin: 0;
}
#tm-epo-totals dt,
#tm-epo-totals dd {
  display: inline-block;
  margin: 0 0 0 8px;
  padding: 0;
  font-size: 15px;
  color: #222;
}
#tm-epo-totals .tm-final-totals {
  font-weight: 600;
  color: #f63e74;
}

/* =========================================================
   013 TM EPO Pink Card Style v3.2 (Gray Default → Pink Active)
   ========================================================= */

/* 💥 Fix Bricks global border-color contamination */
body .tm-extra-product-options * {
  border-color: transparent !important;
}

/* 🔹 Remove outer EPO borders and backgrounds */
body .tm-extra-product-options ul.tmcp-ul-wrap,
body .tm-extra-product-options ul.tmcp-ul-wrap li {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* 🎨 Default button: gray border + dark gray text */
body .tm-extra-product-options .tmcp-field-wrap.tc-mode-text .tm-epo-field-label {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 2px solid #aaa !important;
  border-radius: 12px;
  background: transparent !important;
  color: #333 !important;
  padding: 12px 28px;
  cursor: pointer;
  transition: all .25s ease;
}

/* 🌸 Hover: light pink border + pink text */
body .tm-extra-product-options .tmcp-field-wrap.tc-mode-text .tm-epo-field-label:hover {
  border-color: #F54F8F !important;
  color: #F54F8F !important;
}

/* 💖 Active (selected): pink border + pink text (no background) */
body .tm-extra-product-options .tmcp-field-wrap.tc-mode-text.tc-active .tm-epo-field-label {
  border-color: #F54F8F !important;
  color: #F54F8F !important;
  background: transparent !important;
}

/* 🖼️ Image swatches (same logic: gray default → pink active) */
body .tm-extra-product-options .tmcp-field-wrap img.tc-image.radio-image {
  border-radius: 50%;
  border: 2px solid #aaa !important;
  transition: transform .2s ease, border .2s ease;
  object-fit: cover;
  background: transparent !important;
}

/* 🖱️ Hover / Active image: pink border + slight scale-up */
body .tm-extra-product-options img.tc-image.radio-image:hover {
  transform: scale(1.08);
  border-color: #F54F8F !important;
}
body .tm-extra-product-options li.tc-active img.tc-image.radio-image {
  border-color: #F54F8F !important;
  transform: scale(1.12) !important;
}

/* 🧹 Remove separators between EPO options */
body .tm-extra-product-options li.is-separator {
  display: none !important;
}

/* 🪶 EPO label text — auto responsive font size */
.tm-extra-product-options .tc-label-text {
  font-size: clamp(11px, 2.5vw, 14px); /* min 11px, max 14px, responsive */
  line-height: 1.4;
  font-weight: 500;
}
/**
 * ================================
 * 012 Ultimate Registration Anti-Spam for WooCommerce
 * ================================
 */

/* 1️⃣ Block direct wp-login.php?action=register (robots only) */
add_action('login_init', function() {
    if ( isset($_GET['action']) && $_GET['action'] === 'register' ) {
        wp_die('Registration must be completed on the My Account page.');
    }
});


/* 2️⃣ WooCommerce invisible honeypot */
add_action('woocommerce_register_form', function() {
    echo '<input type="text" name="woo_confirm" value="" style="display:none !important">';
});

add_filter('woocommerce_registration_errors', function($errors) {
    if (!empty($_POST['woo_confirm'])) {
        $errors->add('spam_blocked', 'Registration blocked (spam detected).');
    }
    return $errors;
}, 10);


/* 3️⃣ WordPress honeypot */
add_action('register_form', function() {
    echo '<input type="text" name="email_confirm" value="" style="display:none">';
});

add_filter('registration_errors', function($errors) {
    if (!empty($_POST['email_confirm'])) {
        $errors->add('spam_detected', 'Spam registration detected.');
    }
    return $errors;
}, 20);


/* 4️⃣ Disable XML-RPC */
add_filter('xmlrpc_enabled', '__return_false');


/* 5️⃣ NEW: Block bots that POST without visiting /my-account/ */
add_action('woocommerce_register_post', function($username, $email, $errors){
    $ref = $_SERVER['HTTP_REFERER'] ?? '';

    // Legitimate customers will always come from /my-account/
    if (strpos($ref, '/my-account/') === false) {
        $errors->add('invalid_ref', 'Invalid registration source.');
    }
}, 10, 3);


/* 013 Only show Admin Bar for administrators */
add_filter('show_admin_bar', function( $show ) {
    return current_user_can('administrator');
});
