/*
 * Popup nhận mẫu vật liệu - Trang chi tiết sản phẩm
 */

/* Nút mở popup (ngoài popup) - không cho wrap text */
.js-popup-nhan-mau {
  white-space: nowrap;
}
/* Mobile + tablet: button full width để text dài không bị crop (đè product-detail.css 50%) */
@media screen and (max-width: 768px) {
  .js-popup-nhan-mau {
    width: 100%;
    padding: 1.6rem 2.4rem;
  }
}

.popup-nhan-mau {
  width: 92vw;
  max-width: 56rem;
  background: #fff;
  border-radius: var(--radius-l, 1.6rem);
  padding: 4rem;
  position: relative;
  max-height: calc(100vh - 4rem) !important;
  max-height: calc(100dvh - 4rem) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  font-family: var(--font-pri, "Montserrat", sans-serif);
  color: #1a1a1a;
  box-sizing: border-box;
}
.popup-nhan-mau *,
.popup-nhan-mau *::before,
.popup-nhan-mau *::after {
  box-sizing: border-box;
}
.popup-nhan-mau_inner {
  display: flex;
  flex-direction: column;
  gap: 2.4rem;
}
.popup-nhan-mau_close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 50%;
  background: #f5f5f5;
  border: none;
  font-size: 2.4rem;
  font-weight: 400;
  line-height: 1;
  color: #1a1a1a;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease;
  padding: 0;
}
.popup-nhan-mau_close:hover,
.popup-nhan-mau_close:focus-visible {
  background: #784123;
  color: #fff;
  outline: none;
}
.popup-nhan-mau_head {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding-right: 3rem;
}
.popup-nhan-mau_title {
  font-family: var(--font-title, "Nunito Sans", sans-serif);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.2;
  color: #784123;
  margin: 0;
  text-transform: uppercase;
}
.popup-nhan-mau_desc {
  font-size: 1.4rem;
  line-height: 1.4;
  color: #4a4a4a;
}
.popup-nhan-mau_product {
  display: flex;
  gap: 1.6rem;
  align-items: center;
  padding: 1.2rem 1.6rem;
  background: #f7f3ee;
  border-radius: var(--radius, 1.2rem);
  border: 1px solid rgba(120, 65, 35, 0.12);
}
.popup-nhan-mau_product-img {
  width: 8rem;
  height: 8rem;
  flex-shrink: 0;
  border-radius: var(--radius-m, 0.8rem);
  overflow: hidden;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-nhan-mau_product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.popup-nhan-mau_product-img--default img {
  width: 60%;
  height: 60%;
  object-fit: contain;
}
.popup-nhan-mau_product-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}
.popup-nhan-mau_product-code {
  font-size: 1.2rem;
  font-weight: 600;
  color: #656565;
  letter-spacing: 0.04em;
}
.popup-nhan-mau_product-name {
  font-family: var(--font-title, "Nunito Sans", sans-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.3;
  word-break: break-word;
}
.popup-nhan-mau_form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.popup-nhan-mau_form .wpcf7-form p {
  position: relative;
  width: 100% !important;
  display: block !important;
  margin: 0 0 1.6rem;
  padding: 0;
  vertical-align: top;
}
.popup-nhan-mau_form input[type="text"],
.popup-nhan-mau_form input[type="email"],
.popup-nhan-mau_form input[type="tel"],
.popup-nhan-mau_form input[type="number"],
.popup-nhan-mau_form textarea,
.popup-nhan-mau_form select {
  width: 100%;
  padding: 1.2rem 1.6rem;
  border: 1px solid #e5e5e5;
  border-radius: var(--radius-m, 0.8rem);
  font-size: 1.4rem;
  font-family: inherit;
  background: #fff;
  color: #1a1a1a;
  transition: border-color 0.2s ease;
}
.popup-nhan-mau_form input:focus,
.popup-nhan-mau_form textarea:focus,
.popup-nhan-mau_form select:focus {
  outline: none;
  border-color: #784123;
}
.popup-nhan-mau_form textarea {
  min-height: 10rem;
  resize: vertical;
}
.popup-nhan-mau_form input[readonly] {
  background: #f5f5f5;
  color: #656565;
  cursor: not-allowed;
}
.popup-nhan-mau_form label {
  display: block;
  font-size: 1.3rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.4rem;
  white-space: nowrap;
}
.popup-nhan-mau_form .wpcf7-form-control.wpcf7-submit,
.popup-nhan-mau_form button[type="submit"] {
  background: #784123;
  color: #fff;
  padding: 1.4rem 3.2rem;
  border-radius: 999rem;
  font-weight: 700;
  font-size: 1.4rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s ease;
  width: 100%;
  text-align: center;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}
.popup-nhan-mau_form .wpcf7-form-control.wpcf7-submit:hover,
.popup-nhan-mau_form button[type="submit"]:hover {
  opacity: 0.85;
}
.popup-nhan-mau_form .wpcf7-not-valid {
  border-color: #d32f2f !important;
}
.popup-nhan-mau_form .wpcf7-not-valid-tip {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  right: auto;
  display: block;
  width: auto;
  /* min-width: 28rem; */
  /* max-width: 100%; */
  padding: 0.6rem 1rem;
  background: #d32f2f;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.4;
  border-radius: 0.6rem;
  z-index: 2;
  white-space: normal;
  box-sizing: border-box;
  bottom: unset;
}
.popup-nhan-mau_form .wpcf7-not-valid-tip::before {
  display: none;
}
.popup-nhan-mau_form .wpcf7-not-valid-tip::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 1.6rem;
  border: 0.5rem solid transparent;
  border-bottom-color: #d32f2f;
  display: block;
}
.popup-nhan-mau_form .wpcf7-response-output {
  margin: 1rem 0 0;
  padding: 1.2rem 1.6rem;
  border-radius: var(--radius-m, 0.8rem);
  font-size: 1.3rem;
}
@media screen and (max-width: 768px) {
  .popup-nhan-mau {
    padding: 2.4rem 1.6rem;
    width: 95vw;
    max-height: calc(100vh - 2rem) !important;
    max-height: calc(100dvh - 2rem) !important;
  }
  .popup-nhan-mau_title {
    font-size: 1.8rem;
  }
  .popup-nhan-mau_product {
    flex-direction: row;
    align-items: center;
    gap: 1.2rem;
  }
  .popup-nhan-mau_product-img {
    width: 6.4rem;
    height: 6.4rem;
  }
  /* Mobile: tooltip full width, flow tự nhiên, không cần arrow */
  .popup-nhan-mau_form .wpcf7-not-valid-tip {
    position: static;
    margin-top: 0.4rem;
    bottom: 0;
  }
  .popup-nhan-mau_form .wpcf7-not-valid-tip::after {
    display: none;
  }
}
/* Force form single-column trong popup (chỉ áp dụng mobile) */
@media screen and (max-width: 768px) {
  .popup-nhan-mau_form .form-group {
    flex-direction: column !important;
    gap: 1.2rem !important;
  }
  .popup-nhan-mau_form .form-box {
    width: 100% !important;
  }
  .popup-nhan-mau_form .form-wrap {
    row-gap: 1.6rem;
  }
}
/* Safe area cho iPhone có notch */
.popup-nhan-mau {
  padding-top: max(4rem, env(safe-area-inset-top));
  padding-left: max(4rem, env(safe-area-inset-left));
  padding-right: max(4rem, env(safe-area-inset-right));
  padding-bottom: max(4rem, env(safe-area-inset-bottom));
}
@media screen and (max-width: 768px) {
  .popup-nhan-mau {
    padding-top: max(2.4rem, env(safe-area-inset-top));
    padding-bottom: max(2.4rem, env(safe-area-inset-bottom));
  }
}
/* Close button dễ bấm hơn (chuẩn touch 44px) */
.popup-nhan-mau_close {
  min-width: 4.4rem;
  min-height: 4.4rem;
}
/* Mobile rất nhỏ */
@media screen and (max-width: 480px) {
  .prdt-action > .btn {
    width: 100%;
  }
  .popup-nhan-mau_product-img {
    width: 5.6rem;
    height: 5.6rem;
  }
  .popup-nhan-mau_product-name {
    font-size: 1.4rem;
  }
  .popup-nhan-mau_form input[type="text"],
  .popup-nhan-mau_form input[type="email"],
  .popup-nhan-mau_form input[type="tel"],
  .popup-nhan-mau_form input[type="number"],
  .popup-nhan-mau_form textarea,
  .popup-nhan-mau_form select {
    font-size: 1.6rem; /* Tránh iOS zoom khi focus input */
  }
}


/* Custom select icon — gắn qua wrapper CF7 (::after) để KHÔNG phá native dropdown.
   Select giữ appearance mặc định → native arrow + native picker hoạt động đúng vị trí.
   Custom icon overlay lên native arrow. */
.popup-nhan-mau_form .wpcf7-form-control-wrap:has(> select) {
  position: relative;
  display: block;
}
.popup-nhan-mau_form .wpcf7-form-control-wrap:has(> select)::after {
  content: "";
  position: absolute;
  right: 1.6rem;
  top: 50%;
  width: 1rem;
  height: 0.65rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23784123' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 2;
}
.popup-nhan-mau_form select,
.popup-nhan-mau_form .wpcf7-form-control.wpcf7-select {
  padding-right: 4rem !important;
}
@media screen and (max-width: 768px) {
  .popup-nhan-mau_form .wpcf7-form-control-wrap:has(> select)::after {
    right: 1.2rem;
  }
  .popup-nhan-mau_form select,
  .popup-nhan-mau_form .wpcf7-form-control.wpcf7-select {
    padding-right: 3.6rem !important;
  }
}