/**
* Theme Name:        avanam-groce
* Theme URI:         https://templatemela.com/
* Template:          avanam
* Author:            TemplateMela
* Author URI:        #
* Description:       This is a child theme of Avanam, generated by TemplateMela.
* Version:           1.0.0
* License:           GNU General Public License v3.0 (or later)
* License URI:       https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain:       avanam-groce
* Requires at least: 6.2
* Tested up to:      6.6
* Requires PHP:      7.4
* Tags: translation-ready, two-columns, right-sidebar, left-sidebar, footer-widgets, blog, custom-logo, custom-background, custom-menu, rtl-language-support, editor-style, threaded-comments, custom-colors, featured-images, wide-blocks, full-width-template, theme-options, e-commerce

*/

/* ========================================
   Mobile 3-Column Product Grid
   ======================================== */

@media screen and (max-width: 767px) {

  /* 用 CSS Grid 强制3列覆盖主题默认 */
  .woocommerce ul.products.grid-cols {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    column-gap: 4px !important;
    row-gap: 4px !important;
  }

  /* 覆盖 WooCommerce smallscreen CSS 的 float 布局 */
  .woocommerce ul.products[class*=columns-] li.product,
  .woocommerce-page ul.products[class*=columns-] li.product {
    width: auto !important;
    float: none !important;
    clear: none !important;
    margin: 0 !important;
  }

  /* 隐藏评分 */
  .woocommerce ul.products li.product .star-rating,
  .woocommerce ul.products li.product .star-rating-block {
    display: none !important;
  }

  /* 隐藏加入购物车按钮 */
  .woocommerce ul.products li.product .product-action-wrap,
  .woocommerce ul.products li.product .product-actions {
    display: none !important;
  }

  /* 隐藏商品简短描述 */
  .woocommerce ul.products li.product .product-excerpt {
    display: none !important;
  }

  /* 缩小商品名称字号 */
  .woocommerce ul.products li.product .woocommerce-loop-product__title,
  .woocommerce ul.products li.product .entry-content-wrap h3,
  .woocommerce ul.products li.product .entry-content-wrap .woocommerce-loop-product__title {
    font-size: 11px !important;
    line-height: 1.3 !important;
    margin: 3px 0 2px !important;
  }

  /* 缩小价格字号 */
  .woocommerce ul.products li.product span.price {
    font-size: 12px !important;
  }

  .woocommerce ul.products li.product span.price del {
    font-size: 10px !important;
  }

  /* 缩小商品卡片内边距 */
  .woocommerce ul.products li.product .product-details.entry-content-wrap,
  .woocommerce.content-style-boxed ul.products li.product {
    padding: 3px !important;
  }

  .woocommerce ul.products li.product .product-details.entry-content-wrap {
    padding-top: 3px !important;
  }

  /* 缩小促销标签 */
  .woocommerce ul.products li.product .onsale,
  .woocommerce ul.products li.product .product-onsale .onsale {
    font-size: 10px !important;
    padding: 2px 4px !important;
    min-width: auto !important;
    min-height: auto !important;
    line-height: 1.3 !important;
  }

  /* 隐藏倒计时 */
  .woocommerce ul.products li.product .time-sale {
    display: none !important;
  }
}

/* 超小屏幕(≤400px)进一步优化 */
@media screen and (max-width: 400px) {

  .woocommerce ul.products.grid-cols {
    column-gap: 2px !important;
    row-gap: 2px !important;
  }

  .woocommerce ul.products li.product .woocommerce-loop-product__title,
  .woocommerce ul.products li.product .entry-content-wrap .woocommerce-loop-product__title {
    font-size: 10px !important;
    margin: 2px 0 1px !important;
  }

  .woocommerce ul.products li.product span.price {
    font-size: 10px !important;
  }

  .woocommerce ul.products li.product .product-details.entry-content-wrap,
  .woocommerce.content-style-boxed ul.products li.product {
    padding: 2px !important;
  }
}

/* ========================================
   WooCommerce Multi Currency 自定义弹窗样式
   ======================================== */

/* 隐藏原生 select */
.woocommerce-multi-currency.shortcode .wmc-select-currency-js {
  display: none !important;
}

/* 隐藏元素 */
.wmc-hidden {
  display: none !important;
}

/* 触发按钮 */
.wmc-custom-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  cursor: pointer;
  min-height: 32px;
  line-height: 1;
  user-select: none;
  transition: border-color 0.2s ease;
  white-space: nowrap;
}

.wmc-custom-trigger:hover {
  border-color: #b3b3b3;
}

.wmc-custom-trigger .vi-flag-64 {
  display: none !important;
}

.wmc-custom-label {
  font-size: 13px;
  font-weight: 400;
  color: #333333;
  line-height: 1.2;
  flex: 1;
}

.wmc-custom-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  flex-shrink: 0;
}

.wmc-custom-arrow::after {
  content: "";
  border-width: 0 1.5px 1.5px 0;
  border-style: solid;
  border-color: #999999;
  display: inline-block;
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  margin-top: -2px;
}

/* ---- 弹窗遮罩 ---- */
.wmc-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999998;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.wmc-popup-overlay.wmc-popup-show {
  opacity: 1;
}

/* ---- 弹窗主体 ---- */
.wmc-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  width: 360px;
  max-width: 88vw;
  background: #1e213a;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  z-index: 999999;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  overflow: visible;
}

.wmc-popup.wmc-popup-show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* 标题栏 */
.wmc-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.wmc-popup-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

.wmc-popup-close {
  font-size: 22px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.15s ease;
}

.wmc-popup-close:hover {
  color: #ffffff;
}

/* 内容区 */
.wmc-popup-body {
  padding: 14px 18px;
}

/* 标签 */
.wmc-popup-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 5px;
  margin-top: 0;
}

/* 语言和货币区隔间距 */
.wmc-popup-label + .wmc-popup-dropdown {
  margin-bottom: 14px;
}

/* 自定义下拉容器 */
.wmc-popup-dropdown {
  position: relative;
}

/* 下拉触发按钮 */
.wmc-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.wmc-dropdown-trigger:hover,
.wmc-dropdown-trigger.wmc-active {
  border-color: rgba(255, 255, 255, 0.3);
}

.wmc-dropdown-trigger .vi-flag-64 {
  display: none !important;
}

.wmc-dropdown-text {
  flex: 1;
  font-size: 13px;
  color: #ffffff;
}

.wmc-dropdown-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
}

.wmc-dropdown-arrow::after {
  content: "";
  border-width: 0 1.5px 1.5px 0;
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.4);
  display: inline-block;
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  margin-top: -2px;
  transition: transform 0.2s ease;
}

.wmc-dropdown-trigger.wmc-active .wmc-dropdown-arrow::after {
  transform: rotate(-135deg);
  margin-top: 2px;
}

/* 下拉选项列表 */
.wmc-dropdown-list {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: #2a2d47;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  z-index: 100;
  padding: 3px 0;
}

.wmc-dropdown-list.wmc-open {
  display: block;
  animation: wmcListIn 0.15s ease;
}

@keyframes wmcListIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 单个选项 */
.wmc-dropdown-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.wmc-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.wmc-dropdown-item.wmc-active {
  background: rgba(255, 255, 255, 0.1);
}

.wmc-dropdown-item .vi-flag-64 {
  display: none !important;
}

.wmc-dropdown-item-name {
  flex: 1;
  font-size: 12px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wmc-dropdown-item-code {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

.wmc-dropdown-item.wmc-active .wmc-dropdown-item-name {
  color: #ffffff;
}

.wmc-dropdown-item.wmc-active .wmc-dropdown-item-code {
  color: rgba(255, 255, 255, 0.8);
}

/* 下拉列表滚动条 */
.wmc-dropdown-list::-webkit-scrollbar {
  width: 4px;
}

.wmc-dropdown-list::-webkit-scrollbar-track {
  background: transparent;
}

.wmc-dropdown-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

/* 保存按钮 */
.wmc-popup-save {
  margin: 14px 18px;
  margin-top: 0;
  padding: 9px 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #4a6cf7, #3dd5f3);
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.wmc-popup-save:hover {
  opacity: 0.9;
}

/* 移动端适配 */
@media screen and (max-width: 767px) {
  .wmc-custom-trigger {
    padding: 5px 8px;
    min-height: 28px;
  }

  .wmc-custom-label {
    font-size: 12px;
  }

  .wmc-custom-trigger .vi-flag-64 {
    width: 18px;
    height: 13px;
  }

  .wmc-popup {
    width: 88vw;
    max-width: 340px;
  }

  .wmc-popup-body {
    padding: 12px 14px;
  }

  .wmc-popup-save {
    margin: 12px 14px;
    margin-top: 0;
  }
}
