/* ==========================================================================
   PG_dbox3 — v3.0 CSS Foundation
   fix_v3.css: CSS Variables + Button System + Component Skeletons
   Strategy: Overlay on top of screen.prefixer.css + fix.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Variables — Color System
   Source: 3.0 XD Design + axshare_diff_report section 1.2
   -------------------------------------------------------------------------- */
:root {
  /* Primary */
  --color-primary:        #3D9738;
  --color-primary-light:  #5ca033;
  --color-primary-dark:   #3a7a1a;

  /* CTA (Add-to-Cart) */
  --color-cta:            #c89632;
  --color-cta-dark:       #b8860b;

  /* Alert / Accent */
  --color-danger:         #d9534f;
  --color-danger-dark:    #c9302c;

  /* Text */
  --color-text:           #333333;
  --color-text-secondary: #666666;
  --color-text-muted:     #999999;

  /* Background */
  --color-bg:             #ffffff;
  --color-bg-light:       #f5f5f5;
  --color-bg-lighter:     #f8f8f8;
  --color-bg-dark:        #333333;

  /* Border */
  --color-border:         #dddddd;
  --color-border-light:   #e0e0e0;

  /* --------------------------------------------------------------------------
     2. Typography Variables
     Source: section 1.3
     -------------------------------------------------------------------------- */
  --font-family: "Roboto", "Noto Sans TC", sans-serif, "Microsoft JhengHei";

  --fs-page-title:   26px;    /* 24-28px */
  --fs-section-title: 19px;   /* 18-20px */
  --fs-product-name: 15px;    /* 14-16px */
  --fs-body:         14px;    /* 13-14px */
  --fs-price:        20px;    /* 18-24px */
  --fs-label:        13px;    /* 12-13px */
  --fs-button:       15px;    /* 14-16px */
  --fs-nav:          14px;
  --fs-breadcrumb:   13px;

  /* --------------------------------------------------------------------------
     3. Spacing & Radius
     -------------------------------------------------------------------------- */
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   8px;
  --radius-pill: 20px;

  --shadow-card: 0 1px 4px rgba(0,0,0,.08);
  --shadow-popup: 0 4px 24px rgba(0,0,0,.18);

  /* --------------------------------------------------------------------------
     4. Transition
     -------------------------------------------------------------------------- */
  --transition: all 0.25s ease;
}


/* ==========================================================================
   2. Button System
   Source: section 1.4
   ========================================================================== */

/* -- Base reset ---------------------------------------------------------- */
.v3-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  font-family: var(--font-family);
  font-size: var(--fs-button);
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  vertical-align: middle;
}
.v3-btn:hover { opacity: 0.9; }
.v3-btn:active { transform: scale(0.97); }

/* -- Primary CTA (green) ------------------------------------------------- */
.v3-btn--primary {
  background-color: var(--color-primary-light);
  color: #fff;
  border-radius: var(--radius-sm);
}
.v3-btn--primary:hover {
  background-color: var(--color-primary-dark);
  opacity: 1;
}

/* -- Add to Cart (brown/orange) ------------------------------------------ */
.v3-btn--cart,
.btn-cart-orange {
  background-color: var(--color-cta);
  color: #fff;
  border-radius: var(--radius-sm);
}
.v3-btn--cart:hover,
.btn-cart-orange:hover {
  background-color: var(--color-cta-dark);
  opacity: 1;
}

/* -- Outline (pill) ------------------------------------------------------ */
.v3-btn--outline {
  background-color: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-pill);
}
.v3-btn--outline:hover {
  background-color: var(--color-primary);
  color: #fff;
  opacity: 1;
}

/* -- Dark ---------------------------------------------------------------- */
.v3-btn--dark {
  background-color: var(--color-bg-dark);
  color: #fff;
  border-radius: var(--radius-sm);
}
.v3-btn--dark:hover {
  background-color: #222;
  opacity: 1;
}

/* -- Social -------------------------------------------------------------- */
.v3-btn--line {
  background-color: #06C755;
  color: #fff;
  border-radius: var(--radius-sm);
}
.v3-btn--google {
  background-color: #DB4437;
  color: #fff;
  border-radius: var(--radius-sm);
}

/* -- Sizes --------------------------------------------------------------- */
.v3-btn--sm { padding: 6px 14px; font-size: 13px; }
.v3-btn--lg { padding: 14px 32px; font-size: 16px; }
.v3-btn--block { display: flex; width: 100%; }

/* -- Disabled ------------------------------------------------------------ */
.v3-btn:disabled,
.v3-btn--disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}


/* ==========================================================================
   3. Tab System
   Source: section 1.4 — Tab Active/Inactive
   ========================================================================== */
.v3-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
}
.v3-tab {
  padding: 10px 20px;
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}
.v3-tab:hover {
  color: var(--color-primary);
}
.v3-tab.active,
.v3-tab--active {
  color: #fff;
  background-color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}


/* ==========================================================================
   4. Quantity Stepper
   Source: section 1.4 — Qty Stepper
   ========================================================================== */
.v3-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
}
.v3-qty__btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  color: var(--color-text);
  border: none;
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
}
.v3-qty__btn:hover { background: var(--color-bg-light); }
.v3-qty__input {
  width: 50px;
  height: 36px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  font-size: var(--fs-body);
  -moz-appearance: textfield;
}
.v3-qty__input::-webkit-inner-spin-button,
.v3-qty__input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }


/* ==========================================================================
   5. Pagination
   Source: section 1.4 — Pagination Active/Inactive
   ========================================================================== */
.v3-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  margin: 24px 0;
}
.v3-pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  font-size: var(--fs-body);
  color: var(--color-primary);
  background: var(--color-bg);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}
.v3-pagination__item:hover {
  background: var(--color-primary);
  color: #fff;
}
.v3-pagination__item.active,
.v3-pagination__item--active {
  background: var(--color-primary);
  color: #fff;
  cursor: default;
}


/* ==========================================================================
   6. Modal / Popup
   Source: section 1.6 — Modal/Popup
   ========================================================================== */
.v3-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9998;
  display: none;
}
.v3-popup-overlay.active { display: block; }

.v3-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: 28px;
  z-index: 9999;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-popup);
  display: none;
}
.v3-popup.active { display: block; }

.v3-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--color-text-muted);
  cursor: pointer;
}
.v3-popup__close:hover { color: var(--color-text); }


/* ==========================================================================
   7. Component Skeletons (will be fleshed out in later Sprints)
   Source: section 17.2
   ========================================================================== */

/* ==========================================================================
   7a. Header v3 Overrides (Sprint 1 #3)
   ========================================================================== */

/* Logo + Brand name */
.header__logo_link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.header__brand_name {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 1px;
  white-space: nowrap;
}

/* Cart badge — red circle */
.header__top_menu .btn__style2.cart .count.v3-badge {
  position: relative;
  top: -2px;
  margin-left: 2px;
}

/* Header top buttons — outline pill style per XD */
.header__top_menu .btn__style2 {
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  transition: var(--transition);
}
.header__top_menu .btn__style2:hover {
  background-color: var(--color-primary);
  color: #fff;
}
/* Cart button keeps existing icon style */
.header__top_menu .btn__style2.cart {
  border-color: var(--color-primary);
}

/* Logged-in user display */
.header__top_menu .btn__style2.login font {
  font-weight: 600;
}

/* MemberMenu dropdown v3 polish */
#MemberMenu ul {
  padding: 6px 0;
  min-width: 180px;
}
#MemberMenu ul li {
  border-bottom: 1px solid #eee;
}
#MemberMenu ul li:last-child {
  border-bottom: none;
}
#MemberMenu ul li a {
  padding: 14px 24px;
  font-size: var(--fs-body);
  color: var(--color-text);
  transition: var(--transition);
  text-align: center;
  display: block;
}
#MemberMenu ul li a:hover {
  background-color: var(--color-bg-light);
  color: var(--color-primary);
}

/* -- Mega Menu v3.0 (Sprint 1 #4) — 2.0 White Style + Tab Switch ------- */
.mega-menu-v3.Popup-categoryAll {
  background: #fff !important;
  color: #333;
}
.mega-menu-v3 .pop-container.mega-menu-v3__container {
  background: #fff;
  color: #333;
}
/* Close button */
.mega-menu-v3__close {
  color: #999 !important;
  font-size: 24px;
  z-index: 10;
}
.mega-menu-v3__close:hover { color: #333 !important; }

/* Top bar — search + outlined buttons in one row, right-aligned (XD design) */
.mega-menu-v3__topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 20px;
  padding-right: 40px;
}
.mega-menu-v3__search {
  max-width: 260px;
}
.mega-menu-v3__tab {
  padding: 8px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-primary, #5a8f3c);
  background: #fff;
  border: 1px solid var(--color-primary, #5a8f3c);
  border-radius: 4px;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.mega-menu-v3__tab:hover {
  background: var(--color-primary, #5a8f3c);
  color: #fff;
  border-color: var(--color-primary, #5a8f3c);
}
.mega-menu-v3__tab.active {
  background: var(--color-primary, #5a8f3c);
  color: #fff;
  border-color: var(--color-primary, #5a8f3c);
  font-weight: 700;
}

/* Panels */
.mega-menu-v3__panel { display: none; }
.mega-menu-v3__panel.active { display: block; }
.mega-menu-v3__search .search_box input {
  background: #f5f5f5;
  border: 1px solid #ccc;
  color: #333;
  border-radius: 4px;
}
.mega-menu-v3__search .search_box input::placeholder {
  color: #999;
}

/* Category grid inside mega menu — dark text (2.0 style) */
.mega-menu-v3 .pop_cate_linktext {
  color: #333 !important;
}
.mega-menu-v3 .pop_cate_linkbox a:hover .pop_cate_linktext {
  color: var(--color-primary, #5a8f3c) !important;
}

/* Swiper — limit to 4 per view styling */
.header__bottom .sub_nav1 .swiper-slide {
  text-align: center;
}

/* -- Member Sidebar v3 (Sprint 1 #7) ------------------------------------- */
.index_subtype_ul .subpage_type_link.active {
  background-color: var(--color-primary) !important;
  color: #fff !important;
}
.index_subtype_ul .subpage_type_link.active .qa_type_title {
  color: #fff !important;
}
.index_subtype_ul .subpage_type_link:hover:not(.active) {
  background-color: var(--color-bg-light);
  color: var(--color-primary);
}

/* -- Sidebar v3 Overrides (Sprint 1 #6) ---------------------------------- */
/* Hide elements not in 3.0 spec (版面切換 + banner) */
.side__link_box > a.side__link_quote,
.side__link_box > a.side__link_all {
  display: none !important;
}
/* Cart → brown/orange CTA */
.side__link_box > a.side__link_cart:after {
  background: var(--color-cta) !important;
}
.side__link_box > a.side__link_cart:hover:after {
  background: var(--color-cta-dark) !important;
}
/* Service → green (already green via fix.css, reinforce) */
.side__link_box > a.side__link_service:after {
  background: var(--color-primary) !important;
}

/* -- Footer v3 Overrides (Sprint 1 #5) ----------------------------------- */
footer .footer__copyright h4 {
  font-size: var(--fs-label);
  color: var(--color-text-muted);
  text-align: center;
}
footer .footer__maplinkul .head > a {
  font-weight: 600;
  color: var(--color-text);
}
footer .footer__submaplinkul li a {
  color: var(--color-text-secondary);
  transition: var(--transition);
}
footer .footer__submaplinkul li a:hover {
  color: var(--color-primary);
}

/* -- Filter Panel (Sprint 2 #9-11) --------------------------------------- */
.filter-panel {
  background: var(--color-bg-light);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.filter-group:last-child { margin-bottom: 0; }
.filter-group__label {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--color-text);
  min-width: 70px;
}

/* -- Order Tab Bar (Sprint 4 #4) ----------------------------------------- */
.order-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 20px;
}
.order-tab {
  padding: 10px 16px;
  font-size: var(--fs-body);
  color: var(--color-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  white-space: nowrap;
}
.order-tab:hover { color: var(--color-primary); }
.order-tab--active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}
.order-tab__count {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 11px;
  background: var(--color-danger);
  color: #fff;
  border-radius: 9px;
  margin-left: 4px;
  padding: 0 5px;
}

/* -- Bonus Summary (Sprint 1 #20) ---------------------------------------- */
.bonus-summary {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  background: var(--color-bg-light);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}
.bonus-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--color-primary);
  color: #fff;
  font-size: var(--fs-label);
  font-weight: 600;
  border-radius: var(--radius-pill);
}

/* -- Detail Popup (Sprint 4 #7-9) ---------------------------------------- */
.detail-popup { width: 480px; }
.detail-popup__title {
  font-size: var(--fs-section-title);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}
.detail-popup__row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: var(--fs-body);
  color: var(--color-text);
}
.detail-popup__row + .detail-popup__row {
  border-top: 1px solid var(--color-bg-light);
}
.detail-popup__label { color: var(--color-text-secondary); }
.detail-popup__value { font-weight: 600; }
.detail-popup__total {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-danger);
}

/* -- File Upload Zone (Sprint 3 #12) ------------------------------------- */
.file-upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.file-upload-zone:hover,
.file-upload-zone.dragover {
  border-color: var(--color-primary);
  background: rgba(61,151,56,.04);
  color: var(--color-primary);
}

/* -- Invoice Form (Sprint 1 #14) ----------------------------------------- */
.invoice-form { margin-top: 16px; }
.invoice-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
}
.invoice-option input[type="radio"] { accent-color: var(--color-primary); }
.invoice-option__fields {
  display: none;
  padding: 8px 0 8px 28px;
}
.invoice-option__fields.active { display: block; }

/* Readonly fields: gray background (#09) */
.memberinfo_grid input[readonly] { background: #f5f5f5 !important; color: #666; }

/* Invoice carrier 2-column grid (#09 發票佈局) */
.invoice-carrier-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
  margin-top: 12px;
}
.invoice-carrier-col .radiobox { margin-bottom: 6px; }
.invoice-carrier-col .input-style { margin-bottom: 4px; }
.invoice-carrier-col .other_words { font-size: 12px; color: #999; }
@media (max-width: 768px) {
  .invoice-carrier-grid { grid-template-columns: 1fr; }
}

/* -- Cart Page (Sprint 3 #10-13) ----------------------------------------- */
.cart-page { max-width: 960px; margin: 0 auto; }
.cart-item--custom { background: var(--color-bg-light); }

/* -- Checkout Summary (Sprint 3 #15-18) ---------------------------------- */
.checkout-summary {
  background: var(--color-bg-light);
  border-radius: var(--radius-md);
  padding: 20px;
}
.checkout-total {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-danger);
}


/* ==========================================================================
   8. Utility Helpers
   ========================================================================== */
.v3-text-primary   { color: var(--color-primary) !important; }
.v3-text-danger    { color: var(--color-danger) !important; }
.v3-text-muted     { color: var(--color-text-muted) !important; }
.v3-text-secondary { color: var(--color-text-secondary) !important; }
.v3-bg-light       { background-color: var(--color-bg-light) !important; }
.v3-bg-dark        { background-color: var(--color-bg-dark) !important; }
.v3-border         { border: 1px solid var(--color-border) !important; }

/* Price display */
.v3-price {
  font-size: var(--fs-price);
  font-weight: 700;
  color: var(--color-danger);
}
.v3-price-original {
  font-size: 14px;
  color: var(--color-text-muted);
  text-decoration: line-through;
}

/* Badge (cart count, notification) */
.v3-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--color-danger);
  border-radius: 9px;
}

/* Breadcrumb override */
.v3-breadcrumb {
  font-size: var(--fs-breadcrumb);
  color: var(--color-text-muted);
}
.v3-breadcrumb a {
  color: var(--color-text-muted);
  text-decoration: none;
}
.v3-breadcrumb a:hover { color: var(--color-primary); }
.v3-breadcrumb .active { color: var(--color-text); }

/* Share buttons (display:none per developer decision #6) */
.v3-share-buttons { display: none !important; }

/* Section title */
.v3-section-title {
  font-size: var(--fs-section-title);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 16px;
}

/* Card */
.v3-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.v3-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
}

/* Accordion (FAQ) */
.v3-accordion__item {
  border-bottom: 1px solid var(--color-border);
}
.v3-accordion__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text);
}
.v3-accordion__header:hover { color: var(--color-primary); }
.v3-accordion__arrow {
  transition: transform 0.25s ease;
}
.v3-accordion__item.active .v3-accordion__arrow {
  transform: rotate(180deg);
}
.v3-accordion__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0;
  color: var(--color-text-secondary);
  font-size: var(--fs-body);
  line-height: 1.7;
}
.v3-accordion__item.active .v3-accordion__body {
  max-height: 2000px;
  padding: 0 0 14px;
}

/* -- Registration Form v3 (Sprint 1 #11) --------------------------------- */
.reg-form-v3 { padding: 0 !important; }
.reg-form-v3 .reg-row { margin-bottom: 10px; }
.reg-form-v3 .reg-row-sms { display: flex; gap: 8px; align-items: center; }
.reg-form-v3 .reg-sms-input { flex: 1; }
.reg-form-v3 .btn-send-sms {
  display: inline-block; padding: 8px 14px; font-size: 13px;
  background: var(--color-primary); color: #fff; border-radius: 4px;
  cursor: pointer; white-space: nowrap; text-align: center; min-width: 90px;
}
.reg-form-v3 .btn-send-sms:hover { background: var(--color-primary-dark); }
.reg-form-v3 .btn-send-sms.disabled {
  background: #ccc !important; color: #999 !important; pointer-events: none;
}
.reg-form-v3 .sms-status {
  display: inline-block; font-size: 12px; color: var(--color-primary);
  margin-left: 4px; line-height: 1.4;
}
.reg-form-v3 .reg-row-phone { display: flex; gap: 8px; }
.reg-form-v3 .reg-phone-input { flex: 3; }
.reg-form-v3 .reg-ext-input { flex: 1; min-width: 60px; }
.reg-form-v3 .reg-row-addr { display: flex; gap: 8px; }
.reg-form-v3 .reg-addr-select { flex: 1; }
.reg-form-v3 .reg-addr-select select {
  width: 100%; padding: 8px; border: 1px solid var(--color-border);
  border-radius: 4px; font-size: 14px; background: #fff;
}
.reg-form-v3 .reg-row-addr2 { display: flex; gap: 8px; }
.reg-form-v3 .reg-zipcode-input { flex: 1; max-width: 80px; }
.reg-form-v3 .reg-addr-input { flex: 3; }

/* == Homepage v3 Overrides (Sprint 1 #19) ================================= */

/* -- Banner left/right split (XD 設計稿：左 Banner 輪播 + 右 版位圖) ------- */
.index__bannerflex {
  flex-wrap: nowrap !important;
}
.index__banner_left {
  flex: 1 1 0% !important;
  width: auto !important;
  min-width: 0;
}
.index__banner_right {
  flex: 0 0 320px !important;
  width: 320px !important;
  min-height: 300px;
  background-size: cover !important;
  background-position: left center !important;
  background-repeat: no-repeat !important;
  margin-top: 0;
}
/* If no position image uploaded, hide the empty right block */
.index__banner_right:empty,
.index__banner_right a:empty {
  display: none;
}

/* -- Category flex wrap with arrow ---------------------------------------- */
.index__category_flex_wrap {
  display: flex; align-items: center; gap: 12px;
}
.index__category_flex_wrap .index__category_flex {
  flex: 1;
}
.index__category_arrow {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  font-size: 28px; line-height: 1; cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
}
.index__category_arrow:hover { background: var(--color-primary-dark); }
.index__category_arrow .arrow_icon { margin-top: -2px; }

/* -- Clients grid 8×3 ---------------------------------------------------- */
.index__clientsbox .index__subbox {
  display: grid !important;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px; align-items: center;
}
.index__clientsbox .index__subbox a {
  display: flex; align-items: center; justify-content: center;
}
.index__clientsbox .index__subbox a img {
  max-width: 100%; height: auto; object-fit: contain;
}
@media (max-width: 768px) {
  .index__clientsbox .index__subbox {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 480px) {
  .index__clientsbox .index__subbox {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* -- Blog list v3: category tabs (XD: underline active, not filled) --------- */
.knowledgetype_desktop > a.index__knowledgetype_link {
  padding: 8px 16px;
  border-radius: 0;
  border-bottom: 2px solid transparent !important;
  margin-right: 4px;
  font-size: var(--fs-body);
  color: var(--color-text);
  background: none !important;
  transition: var(--transition);
}
.knowledgetype_desktop > a.index__knowledgetype_link.active {
  background: none !important;
  color: var(--color-primary) !important;
  border-bottom: 2px solid var(--color-primary) !important;
  font-weight: bold;
}
.knowledgetype_desktop > a.index__knowledgetype_link:hover {
  background: none !important;
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-primary-light, #e8f5e3) !important;
}
.knowledgetype_desktop > a.index__knowledgetype_link.active:hover {
  background: none !important;
  color: var(--color-primary-dark, #3a7a1a);
  border-bottom: 2px solid var(--color-primary-dark, #3a7a1a) !important;
}

/* -- Blog keyword search v3 (XD: label + wider input + placeholder "標題,內文") --------- */
.blog-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.blog-search-bar .blog-search-label {
  white-space: nowrap;
  font-size: var(--fs-body);
  color: var(--color-text);
}
.blog-search-bar input {
  flex: 1;
  max-width: 500px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: var(--fs-body);
  outline: none;
  background: #fff;
}
.blog-search-bar input:focus {
  border-color: var(--color-primary);
}
.blog-search-bar button {
  width: 42px;
  height: 42px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.blog-search-bar button:hover {
  background: var(--color-primary-dark, #3a7a1a);
}

/* -- Blog list v3: 4-column grid layout (XD spec) --------- */
.index__knowledgebox .index__knowledgeflex {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  max-width: 100%;
  box-sizing: border-box;
}
.index__knowledgebox .index__knowledgeflex > div {
  flex-basis: unset !important;
  width: auto !important;
  padding: 0 !important;
}
.index__knowledgebox .index__knowledgeflex > div > a {
  display: block !important;
  flex-direction: unset !important;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
}
.index__knowledgebox .index__knowledgeflex > div > a:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.index__knowledgebox .index__knowledgeflex .index__knowledgeimgbox {
  aspect-ratio: 16/10;
  overflow: hidden;
  width: 100% !important;
  max-width: unset !important;
}
.index__knowledgebox .index__knowledgeflex .index__knowledgeimgbox img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}
.index__knowledgebox .index__knowledgeflex .index__knowledgedesbox {
  padding: 16px;
  display: block !important;
  width: 100% !important;
}
.index__knowledgedesbox h1.words_ellipsis {
  -webkit-line-clamp: 1 !important; /* v3: title single line */
  font-size: 16px;
  margin-bottom: 8px;
}
.index__knowledgedesbox p.words_ellipsis {
  -webkit-line-clamp: 2 !important; /* v3: intro 2 lines */
  font-size: 14px;
  color: var(--color-text-light);
  margin-bottom: 12px;
  line-height: 1.5;
}
.index__knowledgedesbox h3 {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--color-text-light);
  margin: 0;
}
.index__knowledgedesbox h3 .blog-cat-badge {
  display: inline-block; padding: 2px 8px;
  background: var(--color-primary); color: #fff;
  border-radius: 3px; font-size: 12px; white-space: nowrap;
}
/* Blog list v3: hide sort section (not in spec) */
.knowledgesort_section {
  display: none !important;
}
/* Blog list v3: RWD */
/* 防止部落格區塊在中尺寸裝置溢出 */
.index__knowledgebox { overflow: hidden; max-width: 100%; box-sizing: border-box; }
.index__knowledgebox .index__title { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
@media (max-width: 1024px) {
  .index__knowledgebox .index__knowledgeflex {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}
@media (max-width: 768px) {
  .index__knowledgebox .index__knowledgeflex {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}
@media (max-width: 480px) {
  .index__knowledgebox .index__knowledgeflex {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* -- 首頁最新消息箭頭修正（width被flex壓成0） ---------- */
.index__newsEachbox .arrow {
  min-width: 20px;
  width: 20px;
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* -- Blog detail v3: meta info bar --------- */
.blog-detail-meta {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--color-text-light);
}
.blog-detail-meta span:not(:last-child)::after {
  content: '';
}
.detail_title .titleflag .title h1 {
  text-align: center;
}
.detail_title .titleflag .date {
  display: none; /* v3: replaced by .blog-detail-meta */
}
.detail_title .titleflag iframe {
  display: none; /* v3: hide FB like */
}

/* -- News list v3: featured first + rest list --------- */
.v3-news-list .news-featured {
  margin-bottom: 32px;
  border-bottom: 1px solid #e8e8e8;
  padding-bottom: 24px;
  background: var(--color-bg-light);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.v3-news-list .news-featured a {
  display: block;
  text-decoration: none;
  color: inherit;
}
.v3-news-list .news-featured-inner {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.v3-news-list .news-featured-date-box {
  flex-shrink: 0;
  text-align: center;
  min-width: 80px;
}
.v3-news-list .news-featured-dd {
  display: block;
  font-size: 48px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}
.v3-news-list .news-featured-ym {
  display: block;
  font-size: 14px;
  color: var(--color-text-muted);
  margin-top: 4px;
}
.v3-news-list .news-featured-body {
  flex: 1;
  min-width: 0;
}
.v3-news-list .news-featured-title {
  font-size: 22px;
  font-weight: bold;
  color: var(--color-text);
  line-height: 1.4;
  margin-bottom: 8px;
}
.v3-news-list .news-featured-excerpt {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin: 0;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  display: -webkit-box;
  overflow: hidden;
}
.v3-news-list .news-rest-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 32px;
}
@media (max-width: 768px) {
  .v3-news-list .news-rest-list { grid-template-columns: 1fr; }
}
.v3-news-list .news-rest-item {
  border-bottom: 1px solid #f0f0f0;
}
.v3-news-list .news-rest-item:nth-child(odd) {
  background: #faf8f5;
}
.v3-news-list .news-rest-item:nth-child(even) {
  background: #fff;
}
.v3-news-list .news-rest-item a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--color-text);
  transition: color 0.2s;
}
.v3-news-list .news-rest-arrow {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 2px solid var(--color-primary, #5a8f3c);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  transition: all 0.2s;
}
.v3-news-list .news-rest-arrow::after {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--color-primary, #5a8f3c);
  border-right: 2px solid var(--color-primary, #5a8f3c);
  transform: rotate(45deg);
  margin-left: -2px;
}
.v3-news-list .news-rest-item a:hover .news-rest-arrow {
  background: var(--color-primary, #5a8f3c);
}
.v3-news-list .news-rest-item a:hover .news-rest-arrow::after {
  border-color: #fff;
}
.v3-news-list .news-rest-item a:hover {
  color: var(--color-primary);
}
.v3-news-list .news-rest-date-box {
  flex-shrink: 0;
  text-align: center;
  min-width: 60px;
}
.v3-news-list .news-rest-dd {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}
.v3-news-list .news-rest-ym {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.v3-news-list .news-rest-title {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
/* v3: hide original news list style */
.v3-news-list .index__newsEachbox {
  display: none !important;
}

/* -- FAQ v3: vertical sidebar + accordion (#32) --------- */
/* Keep the original left sidebar layout (same as member pages) */
.qa-index-section .index_subtype_ul li a.subpage_type_link.active {
  background-color: var(--color-primary);
  color: #fff !important;
  border-radius: 4px;
}
.qa-index-section .index_subtype_ul li a.subpage_type_link:hover {
  background-color: var(--color-primary-light, #e8f5e3);
}
/* Hide anchor quick navigation (not in XD) */
.qa-index-section .qa_d_options {
  display: none !important;
}
.qa-index-section .qa_m_options {
  display: none !important;
}
/* Accordion Q title styling */
.qa-index-section .qa_list_each .qa__title {
  border-bottom: 1px solid #e8e8e8;
  padding: 14px 0;
  cursor: pointer;
}
.qa-index-section .qa_list_each .qa__title .word span {
  color: var(--color-primary);
  font-weight: bold;
  margin-right: 8px;
}
/* Accordion: keep 2.0 original btn-close_style1, just fix vertical alignment */
.qa-index-section .qa_list_each .qa__title {
  align-items: center !important;
}

/* -- Ready product v3: hide share links (Sprint #6) --------- */
.avaipro_withnumber_each .link_share,
.avaipro-details-section .share_linklist,
.avaipro-details-section .shares {
  display: none !important;
}
/* Ready product v3: summary line below card */
.avaipro_withnumber_each .product-summary-line {
  font-size: 13px;
  color: var(--color-text-light);
  padding: 8px 0;
  border-top: 1px solid #f0f0f0;
  margin-top: 8px;
}

/* ==========================================================================
   Cart v3: 現貨/客製分區 + 分開結帳
   ========================================================================== */
/* 客製商品區塊淺灰背景 */
.c_p_box.custom-item {
  background-color: #f8f8f8;
  border-radius: 5px;
  padding: 10px;
  margin-bottom: 10px;
}

/* 分區標題 */
.cart_section_title {
  font-size: 16px;
  font-weight: bold;
  color: var(--color-primary, #5a8f3c);
  padding: 10px 0;
  border-bottom: 2px solid var(--color-primary, #5a8f3c);
  margin-bottom: 15px;
}

/* 分開結帳按鈕區 */
.cart_section_checkout {
  text-align: right;
  padding: 15px 0;
  margin-top: 10px;
  border-top: 1px solid #eee;
}

.cart_section_checkout .btn__style7 {
  min-width: 160px;
}

/* 紅利折抵 */
.bonus_discount_row .bonus_input_area {
  display: flex;
  align-items: center;
  gap: 4px;
}
.bonus_discount_row .bonus_input_area input[type="number"] {
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 14px;
}
.bonus_discount_row .bonus_hint {
  font-size: 12px;
  color: #999;
}

/* --------------------------------------------------------------------------
   Login/Register POPUP — Scroll Fix & Forget Password Tab
   -------------------------------------------------------------------------- */

/* POPUP 內容區域滾動修正（註冊表單超出 viewport 時可滾動）*/
.Popup-box.Popup-login .pop_login_bottom {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
}

/* 忘記密碼 section — 隱藏在一般狀態 */
.Popup-box.Popup-login #section_forget {
  display: none;
  padding: 0 70px;
}

/* 忘記密碼 — 啟用時覆蓋顯示 */
.Popup-box.Popup-login[data-switchtype="forget"] .switch_outerbox {
  transform: translate(0, 0) !important;
  width: 100% !important;
}
.Popup-box.Popup-login[data-switchtype="forget"] #section_login,
.Popup-box.Popup-login[data-switchtype="forget"] #section_regist {
  display: none !important;
}
.Popup-box.Popup-login[data-switchtype="forget"] #section_forget {
  display: block;
  opacity: 1;
  flex: 1;
}
.Popup-box.Popup-login[data-switchtype="forget"] #pop_btn_forget {
  color: var(--color-primary);
  border-bottom: 1px solid var(--color-primary);
}

/* 忘記密碼 mention 提示文字 */
#section_forget .mention_t {
  color: var(--color-text-secondary);
  font-size: 14px;
  text-align: center;
}
#section_forget .mention_to_regist a {
  color: var(--color-primary);
  cursor: pointer;
}
#section_forget .mention_to_regist a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   P1 #01/#08 Homepage — Banner full-width + Position 2 fix
   -------------------------------------------------------------------------- */

/* 版位 2: 巨大自動報價圖（276px 被拉伸到 1280px），XD 設計稿此處無此區塊 */
.index__position2 {
  display: none !important;
}

/* == Checkout v3.0 (P1-C) ================================================== */

/* -- 金額計算表：水平 6 欄（XD 設計） ------- */
.checkout-calc-table {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  margin: 16px 0;
  overflow: hidden;
}
.checkout-calc-table .calc-row {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
}
.checkout-calc-table .calc-row:last-child { border-bottom: none; }
.checkout-calc-table .calc-col {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  border-right: 1px solid #e0e0e0;
}
.checkout-calc-table .calc-col:last-child { border-right: none; }
.checkout-calc-table .calc-label {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}
.checkout-calc-table .calc-value {
  font-size: 18px;
  font-weight: 700;
  color: #333;
}
.checkout-calc-table .calc-input {
  width: 100%;
  max-width: 120px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 16px;
}
.checkout-calc-table .calc-input.readonly {
  background: #f5f5f5;
  color: #333;
  border-color: #e0e0e0;
}

/* -- 合計行 ------- */
.checkout-total-row {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 16px;
  padding: 16px 0;
}
.checkout-total-row .zh {
  font-size: 16px;
  color: #333;
}
.checkout-total-row .price {
  font-size: 28px;
  font-weight: 700;
  color: #dd4b39;
}

/* -- 會員資料 readonly ------- */
.cart_member_info .readonly_value {
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  color: #666;
  min-height: 38px;
  line-height: 22px;
}
@media (max-width: 768px) {
  .checkout-calc-table .calc-row { flex-wrap: wrap; }
  .checkout-calc-table .calc-col { flex: 0 0 33.33%; border-bottom: 1px solid #e0e0e0; }
}

/* --------------------------------------------------------------------------
   RWD Fix: 390px 會員頁面 SPAN.border 溢出 (Sprint 5 #12)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .select-style.input_textbox_pad,
  .input-style.input_textbox_pad {
    overflow: hidden;
  }
}

/* ---- P2 QC Fixes (2026-03-19) ---- */

/* P2-1: 登入按鈕綠色（XD 設計稿） */
.Popup-login #btnLogin {
  background-color: var(--color-primary);
}
.Popup-login #btnLogin:hover {
  background-color: var(--color-primary-dark);
}

/* P2-2: 側邊購物車 icon 修正（shop-w.png → shop.png） */
.side__link_box .side__link_cart .side__link_imgbox {
  background-image: url(../images/icon/shop.png);
}

/* P2-4: 訂單查詢無資料時隱藏分頁器 */
.member_orderhistory-section .page-number:empty,
.member_orderhistory-section .page-number ul:has(li.paginationjs-first a[style*="display: none"]) {
  display: none;
}
