/* Form Lucky Draw — CSS riêng cho component (precedent: public/css/live_wall_card.css).
   Desktop-first: khai báo base ở trên là desktop, khối @media ở cuối file override cho viewport < 1023px. */

:root {
  --ldf-brand: #079b4e;
  --ldf-brand-dark: #05783b;
  --ldf-yellow: #ffc43d;
  --ldf-page-bg: #fff3df;
  --ldf-card-bg: #fefaee;
  --ldf-border: rgba(7, 155, 78, 0.2);
  --ldf-shadow-field: 0 4px 12px #00000014;
  --ldf-radius-field: 36px;
  --ldf-gap: 12px;
  --ldf-font: var(--font-sans, 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
}

* {
  box-sizing: border-box;
}

.break{
  display: none;
}

/* ---------- Khung trang + card ---------- */
.ldf-page {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background: var(--ldf-page-bg);
  font-family: var(--ldf-font);
  color: var(--ldf-brand-dark);
}

.ldf-card {
  position: relative;
  width: 480px;
  max-width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ldf-gap);
  background: var(--ldf-card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(5, 120, 59, 0.12);
}

/* ---------- Nút đóng (góc trên phải của card) ---------- */
.ldf-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--ldf-brand);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.ldf-close__icon {
  width: 24px;
  height: 24px;
}

.ldf-close:hover {
  opacity: 0.9;
}

.ldf-close:focus-visible {
  outline: 2px solid var(--ldf-brand-dark);
  outline-offset: 2px;
}

/* ---------- A. Header ---------- */
.ldf-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 24px 28px;
  text-align: center;
  background-color: var(--ldf-card-bg);
  background-image: url('/images/bg_header_form.webp');
  background-repeat: no-repeat;
  background-position: top center;
  background-size: cover;
}

.ldf-head__lead,
.ldf-head__note {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ldf-brand-dark);
}

.ldf-head__title {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ldf-brand-dark);
}

/* ---------- B. 4 trường thông tin ---------- */
.ldf-body {
  display: flex;
  flex-direction: column;
  gap: var(--ldf-gap);
  padding: 0 16px; /* trường cách mép trái/phải của form 16px */
}

.ldf-field {
  position: relative;
  display: flex;
  align-items: center;
}

.ldf-field__icon {
  position: absolute;
  left: 17px;
  width: 24px;
  height: 24px;
  pointer-events: none;
}

.ldf-field__input {
  width: 100%;
  height: 48px; /* radius 36px bị browser clamp thành pill ở chiều cao này */
  padding: 0 16px 0 53px; /* 17px inset + 24px icon + 12px khoảng cách */
  border: 1px solid var(--ldf-border);
  border-radius: var(--ldf-radius-field);
  background: #ffffff;
  box-shadow: var(--ldf-shadow-field);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  color: var(--ldf-brand-dark);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ldf-field__input::placeholder {
  color: var(--ldf-brand-dark);
  opacity: 1;
}

.ldf-field__input:focus {
  border-color: var(--ldf-brand);
  box-shadow: var(--ldf-shadow-field), 0 0 0 3px rgba(7, 155, 78, 0.12);
}

/* ---------- C. Footer ---------- */
.ldf-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--ldf-gap);
  padding: 24px 32px 32px;
}

.ldf-terms {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ldf-terms__checkbox {
  position: relative;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  appearance: none;
  border: 1px solid var(--ldf-brand);
  border-radius: 4px;
  background: #ffffff;
  accent-color: var(--ldf-brand);
  cursor: pointer;
}

.ldf-terms__checkbox:checked {
  background: var(--ldf-brand);
}

.ldf-terms__checkbox:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.ldf-terms__checkbox:focus-visible {
  outline: 2px solid var(--ldf-brand);
  outline-offset: 2px;
}

.ldf-terms__label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ldf-brand-dark);
}

.ldf-submit {
  width: 173px;
  height: 48px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid var(--ldf-brand);
  border-radius: var(--ldf-radius-field);
  background: #ffffff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--ldf-brand);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ldf-submit__icon {
  color: var(--ldf-brand);
}

.ldf-submit:hover:not(:disabled) {
  background: var(--ldf-brand);
  color: #ffffff;
}

.ldf-submit:hover:not(:disabled) .ldf-submit__icon {
  color: #ffffff;
}

.ldf-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ldf-notice {
  margin: 0;
  align-self: stretch;
  padding: 12px 16px;
  border-radius: 41px;
  background: var(--ldf-yellow);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--color-brand);
  text-align: center;
}

.ldf-notice strong {
  font-weight: 700;
}

.ldf-notice[data-state='success'] {
  background: var(--ldf-brand);
  color: #ffffff;
}

.ldf-notice[data-state='error'] {
  background: #fee2e2;
  color: #991b1b;
}

/* ---------- Mobile: viewport < 1023px (khai báo base ở trên là desktop) ---------- */
@media (max-width: 1023px) {
    .break{
      display: block;
    }

  /* A. Header: 14/28/14 -> 12/24/12 */
  .ldf-head__lead,
  .ldf-head__note {
    font-size: 12px;
  }

  .ldf-head__title {
    font-size: 24px;
  }

  /* B. Trường: height 48 -> 44px, icon 24 -> 20px,
     padding-left 53 -> 49px = 17px inset + icon 20px + 12px khoảng cách */
  .ldf-field__icon {
    width: 20px;
    height: 20px;
  }

  .ldf-field__input {
    height: 44px;
    padding-left: 49px;
  }

  /* C. Footer: label 13 -> 12px, nút gửi 48 -> 44px, notice 12 -> 10px */
  .ldf-terms__label {
    font-size: 12px;
  }

  .ldf-submit {
    height: 44px;
  }

  .ldf-foot{
    padding:12px 16px;
  }

  .ldf-notice {
    font-size: 10px;
    padding: 6px 8px;
  }
}

/* ---------- Popup trong ngôi nhà (Message Builder) ----------
   Nằm trong `.qz-card` (cao 652px, overflow hidden, bo 20px) nên bị cắt theo hình nhà. Chừa mái +
   logo phía trên; backdrop là rect thuần phủ khung nhà như .gc-ip::before (cái mái cắt bằng polygon
   từng làm Chrome paint rect chưa clip ở frame đầu → khối xám "trượt xuống"). Form thu gọn hơn trang
   riêng để lọt trong thân nhà. */
.ldf-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 112px 24px 20px;
  overflow: hidden; /* card trượt từ đáy lên giữa bị clip trong vùng phủ, không lòi ra ngoài ngôi nhà */
  font-family: var(--ldf-font);
  color: var(--ldf-brand-dark);
}

.ldf-overlay[hidden] {
  display: none;
}

.ldf-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

/* Lớp tối fade cùng khung hình với lúc overlay hiện (mẫu .gc-ip[open]::before: tránh chớp/khựng). */
.ldf-overlay:not([hidden])::before {
  animation: ldf-fade-in 320ms ease-out both;
}

.ldf-overlay.is-closing::before {
  animation: ldf-fade-out 320ms ease-in both;
}

@keyframes ldf-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ldf-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ldf-overlay:not([hidden])::before,
  .ldf-overlay.is-closing::before {
    animation: none;
  }
}

.ldf-overlay .ldf-card {
  position: relative;
  z-index: 1;
  width: min(100%, 380px);
  max-height: 100%;
  overflow-y: auto;
  gap: 10px;
}

.ldf-overlay .ldf-close {
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
}

.ldf-overlay .ldf-close__icon {
  width: 20px;
  height: 20px;
}

.ldf-overlay .ldf-head {
  gap: 4px;
  padding: 20px 20px 12px;
}

.ldf-overlay .ldf-head__lead,
.ldf-overlay .ldf-head__note {
  font-size: 12px;
}

.ldf-overlay .ldf-head__title {
  font-size: 22px;
}

.ldf-overlay .ldf-body {
  gap: 10px;
  padding: 0 16px;
}

.ldf-overlay .ldf-field__icon {
  left: 15px;
  width: 20px;
  height: 20px;
}

.ldf-overlay .ldf-field__input {
  height: 40px;
  padding-left: 45px;
  font-size: 13px;
}

.ldf-overlay .ldf-foot {
  gap: 10px;
  padding: 12px 16px 16px;
}

.ldf-overlay .ldf-terms__label {
  font-size: 12px;
}

.ldf-overlay .ldf-submit {
  height: 40px;
}

.ldf-overlay .ldf-notice {
  font-size: 10px;
  padding: 6px 8px;
}
