/* =========================================================
   DAIVAVARNA GLOBAL MARKETPLACE
   ========================================================= */

/* =========================================================
   DOKAN PRODUCT-LIST QUICK-CREATE GUARD
   DaivaVarna uses the full Add Product screen because the marketplace's
   country/pricing controls live there. On the Products LIST page we disable
   Dokan's quick-create popup/drawer entirely. This also prevents its hidden
   action bar from leaving a purple sliver at the sidebar edge.
   ========================================================= */
html.dvgm-products-list-guard #dokan-add-product-popup,
html.dvgm-products-list-guard #dokan-add-new-product-popup,
html.dvgm-products-list-guard .dokan-add-new-product-popup,
html.dvgm-products-list-guard [data-dvgm-quick-create-artifact="1"] {
  display:none !important;
  visibility:hidden !important;
  pointer-events:none !important;
  width:0 !important;
  height:0 !important;
  min-width:0 !important;
  min-height:0 !important;
  max-width:0 !important;
  max-height:0 !important;
  margin:0 !important;
  padding:0 !important;
  border:0 !important;
  overflow:hidden !important;
  opacity:0 !important;
  transform:none !important;
}


/* =========================================================
   CHECKOUT DELIVERY COUNTRY LOCK
   Keep the WooCommerce country <select> enabled so its native Country ->
   State/Province logic continues to work. Only block customer interaction
   with the country control that is serving as the fixed delivery country.
   State/Province fields are intentionally untouched.
   ========================================================= */
.woocommerce-checkout .dvgm-country-locked select.country_to_state,
.woocommerce-checkout .dvgm-country-locked .select2-container,
.woocommerce-checkout .dvgm-country-locked .select2-selection,
.woocommerce-checkout .dvgm-country-locked .selectWoo-container {
  pointer-events:none !important;
  cursor:default !important;
}
.woocommerce-checkout .dvgm-country-locked select.country_to_state {
  user-select:none;
}
.woocommerce-checkout .dvgm-country-locked .select2-selection,
.woocommerce-checkout .dvgm-country-locked .select2-selection__rendered {
  cursor:default !important;
}

/* Make a locked delivery country visibly different from an editable field. */
.woocommerce-checkout .dvgm-country-locked .select2-selection {
  background:#f4f4f4 !important;
  border-color:#e3e3e3 !important;
  box-shadow:none !important;
}
.woocommerce-checkout .dvgm-country-locked .select2-selection__rendered {
  color:#777 !important;
}
.woocommerce-checkout .dvgm-country-locked .select2-selection__arrow {
  display:none !important;
}
.woocommerce-checkout .dvgm-country-locked select.country_to_state {
  background-color:#f4f4f4 !important;
  color:#777 !important;
  border-color:#e3e3e3 !important;
  background-image:none !important;
}

/* State/Province deliberately uses the native browser select on checkout.
   This avoids WoodMart/SelectWoo's upward-opening popup closing immediately
   when the field is near the bottom of the viewport. */
.woocommerce-checkout select.dvgm-native-state-select {
  display:block !important;
  visibility:visible !important;
  opacity:1 !important;
  width:100% !important;
  min-height:42px;
  pointer-events:auto !important;
  position:relative !important;
}
.woocommerce-checkout select.dvgm-native-state-select + .select2-container {
  display:none !important;
}

/* Customer country selector lives in the WoodMart header beside Cart. */
.dvgm-header-country-source { display:none !important; }
.dvgm-country-selector--header {
  position:relative;
  display:inline-flex;
  align-items:center;
  flex:0 0 auto;
  margin:0 10px 0 0;
  padding:0;
  border:0;
  background:transparent;
  z-index:390;
  font:inherit;
}
.dvgm-country-trigger {
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:42px;
  padding:5px 14px 5px 12px;
  border:0;
  border-radius:999px;
  background:#f3f1ed;
  color:#2b2b2b;
  cursor:pointer;
  box-shadow:none;
  line-height:1.15;
  white-space:nowrap;
}
.dvgm-country-trigger:hover,
.dvgm-country-trigger:focus-visible {
  background:#ebe8e2;
  outline:none;
}
.dvgm-country-trigger-flag,
.dvgm-country-option-flag {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:24px;
  flex:0 0 24px;
  font-size:20px;
  line-height:1;
}
.dvgm-country-trigger-copy {
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  min-width:0;
}
.dvgm-country-trigger-kicker {
  color:#8a8a8a;
  font-size:10px;
  font-weight:500;
  line-height:1.05;
}
.dvgm-country-trigger-name {
  max-width:130px;
  overflow:hidden;
  text-overflow:ellipsis;
  color:#262626;
  font-size:13px;
  font-weight:600;
  line-height:1.2;
}
.dvgm-country-trigger-caret {
  margin-left:1px;
  color:#777;
  font-size:14px;
  line-height:1;
}
.dvgm-country-selector--header.is-loading .dvgm-country-trigger { opacity:.65; }
.dvgm-country-menu {
  position:absolute;
  top:calc(100% + 8px);
  right:0;
  width:310px;
  max-width:min(310px, calc(100vw - 24px));
  max-height:380px;
  overflow-y:auto;
  overflow-x:hidden;
  padding:8px;
  border:1px solid rgba(0,0,0,.10);
  border-radius:12px;
  background:#fff;
  box-shadow:0 14px 36px rgba(0,0,0,.15);
  z-index:99999;
}
.dvgm-country-menu[hidden] { display:none !important; }
.dvgm-country-menu-title {
  padding:6px 9px 9px;
  color:#777;
  font-size:12px;
  font-weight:600;
}
.dvgm-country-option {
  display:grid;
  grid-template-columns:28px minmax(0,1fr) auto;
  align-items:center;
  gap:8px;
  width:100%;
  min-height:42px;
  padding:7px 9px;
  border:0;
  border-radius:8px;
  background:transparent;
  color:#2b2b2b;
  cursor:pointer;
  text-align:left;
  font:inherit;
}
.dvgm-country-option:hover,
.dvgm-country-option:focus-visible { background:#f5f5f5; outline:none; }
.dvgm-country-option.is-selected { background:#f1edff; }
.dvgm-country-option-name {
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:13px;
  font-weight:500;
}
.dvgm-country-option-currency {
  color:#8a8a8a;
  font-size:11px;
  font-weight:600;
}

/* Friendly single-product message when the selected delivery country is unavailable. */
.dvgm-country-unavailable {
  margin:14px 0 18px;
  padding:11px 14px;
  border:1px solid #eee8df;
  border-radius:14px;
  background:#faf8f4;
  color:#6b6259;
  font-size:14px;
  line-height:1.5;
}
.dvgm-country-unavailable strong { color:#3d3833; font-weight:600; }

.dvgm-customer-price { color:inherit; }
.dvgm-base-charge { display:block; margin-top:4px; color:#888; font-size:11px; font-weight:400; }

.dvgm-vendor-settings { margin-top:30px; padding-top:5px; }
.dvgm-vendor-settings h3 {
  margin:18px 0 8px !important;
  color:#242424 !important;
  font-size:22px !important;
  line-height:1.35 !important;
  font-weight:600 !important;
}
.dvgm-product-marketplace h4 {
  margin:0 0 10px !important;
  color:#242424 !important;
  font-size:20px !important;
  line-height:1.35 !important;
  font-weight:600 !important;
}
.dvgm-vendor-settings label,
.dvgm-product-marketplace > label { display:block; margin:16px 0 7px; color:#242424; }
.dvgm-vendor-country-list,
.dvgm-vendor-markup,
.dvgm-product-country-list,
.dvgm-product-markup { margin-top:12px; }

/* Clear, clickable country list instead of native multi-selects. */
.dvgm-country-choice-box {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:7px 12px;
  width:100%;
  max-height:320px;
  overflow-y:auto;
  overflow-x:hidden;
  scrollbar-gutter:stable;
  padding:12px;
  border:1px solid #dedede;
  border-radius:7px;
  background:#fff;
  box-sizing:border-box;
}
.dvgm-country-choice {
  display:flex !important;
  align-items:center;
  gap:8px;
  min-width:0;
  margin:0 !important;
  padding:8px 9px;
  border-radius:5px;
  cursor:pointer;
  line-height:1.35;
}
.dvgm-country-choice:hover { background:#f7f7f7; }
.dvgm-country-choice input { flex:0 0 auto; margin:0 !important; }
.dvgm-country-choice span { min-width:0; }

.dvgm-product-marketplace {
  margin-top:22px;
  padding:22px;
  border:1px solid #e5e5e5;
  border-radius:8px;
  background:#fff;
}

.dvgm-increase-grid {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  align-items:end;
}
.dvgm-increase-grid label { display:block; margin:0 0 6px; font-weight:600; }
.dvgm-price-final-input[readonly],
.dvgm-override-regular[readonly] { background:#f7f7f7 !important; color:#555 !important; }

.dvgm-money-field {
  display:flex;
  align-items:stretch;
  width:100%;
  min-width:0;
}
.dvgm-money-prefix {
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  min-width:42px;
  padding:0 10px;
  border:1px solid #ddd;
  border-right:0;
  border-radius:4px 0 0 4px;
  background:#f7f7f7;
  color:#555;
  font-weight:600;
  box-sizing:border-box;
}
.dvgm-money-field .dokan-form-control {
  min-width:0;
  width:100%;
  border-radius:0 4px 4px 0 !important;
}

.dvgm-default-price-summary {
  margin-top:18px;
  padding:14px 16px;
  border:1px solid #ececec;
  border-radius:7px;
  background:#f8f8f8;
  color:#555;
}
.dvgm-default-price-summary > strong { color:#242424; }
.dvgm-summary-line { margin-top:6px; }
.dvgm-summary-help { margin-top:7px; color:#888; font-size:13px; }

.dvgm-country-price-overrides,
.dvgm-price-preview { margin-top:20px; }
.dvgm-country-price-overrides summary,
.dvgm-price-preview summary { cursor:pointer; font-weight:600; color:#242424; }

.dvgm-country-price-row {
  display:grid;
  grid-template-columns:minmax(175px,1.25fr) minmax(110px,.75fr) minmax(160px,1fr) minmax(155px,1fr) auto;
  gap:8px;
  align-items:center;
  margin:10px 0;
}
.dvgm-country-price-head {
  display:grid;
  grid-template-columns:minmax(175px,1.25fr) minmax(110px,.75fr) minmax(160px,1fr) minmax(155px,1fr) auto;
  gap:8px;
  align-items:end;
  margin:15px 0 2px;
  color:#555;
  font-size:12px;
  font-weight:600;
}
.dvgm-country-price-head span { min-width:0; }
.dvgm-add-country-price { margin-top:8px !important; }

.dvgm-price-preview-status { margin:12px 0; color:#777; }
.dvgm-price-preview-table-wrap {
  width:100%;
  max-height:340px;
  overflow-y:auto;
  overflow-x:auto;
  scrollbar-gutter:stable;
  margin-top:10px;
  border:1px solid #e8e8e8;
  border-radius:7px;
}
.dvgm-price-preview-table {
  width:100%;
  border-collapse:collapse;
  background:#fff;
  font-size:14px;
}
.dvgm-price-preview-table th,
.dvgm-price-preview-table td {
  padding:10px 12px;
  border-bottom:1px solid #eee;
  text-align:left;
  vertical-align:middle;
}
.dvgm-price-preview-table th {
  position:sticky;
  top:0;
  z-index:1;
  background:#f7f7f7;
  color:#333;
  font-weight:600;
}

@media (max-width:900px) {
  .dvgm-country-choice-box { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .dvgm-increase-grid { grid-template-columns:1fr; }
  .dvgm-country-price-head { display:none; }
  .dvgm-country-price-row { grid-template-columns:1fr 1fr; padding:12px 0; border-bottom:1px solid #eee; }
  .dvgm-country-price-row .dvgm-remove-country-price { grid-column:1/-1; justify-self:start; }
}

@media (max-width:767px) {
  .dvgm-country-selector--header { margin-right:6px; }
  .dvgm-country-trigger { min-height:38px; padding:4px 7px; gap:5px; }
  .dvgm-country-trigger-kicker { display:none; }
  .dvgm-country-trigger-name { max-width:82px; font-size:12px; }
  .dvgm-country-trigger-flag { width:21px; flex-basis:21px; font-size:18px; }
  .dvgm-country-menu { position:fixed; top:64px; right:10px; width:300px; max-height:calc(100vh - 84px); }
  .dvgm-product-marketplace { padding:15px; }
  .dvgm-country-choice-box { grid-template-columns:1fr; max-height:300px; }
  .dvgm-country-price-row { grid-template-columns:1fr; gap:7px; }
  .dvgm-country-price-row .dvgm-remove-country-price { grid-column:auto; }
  .dvgm-price-preview-table { min-width:650px; }
}
