/* ============================================================
   POPUP TƯ VẤN — popup-tuvan.css  v2.0
   Design cao cấp: layout cân đối, typography sắc nét,
   input rõ ràng, hiệu ứng mượt mà chuyên nghiệp
   ============================================================ */

/* ── GOOGLE FONT ── */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700;800&display=swap');

/* ── CSS VARIABLES ── */
:root {
  --tv-green:        #1e4d8c;
  --tv-green-dark:   #163a6e;
  --tv-green-deep:   #0e2850;
  --tv-green-rgb:    30, 77, 140;
  --tv-red:          #c0392b;
  --tv-red-hover:    #a93226;
  --tv-white:        #ffffff;
  --tv-gold:         #d4a843;
  --tv-radius-lg:    20px;
  --tv-radius-md:    10px;
  --tv-radius-sm:    6px;
  --tv-shadow-popup: 0 40px 100px rgba(0, 0, 0, 0.45), 0 12px 32px rgba(0, 0, 0, 0.25);
  --tv-ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --tv-ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --tv-ease-std:     cubic-bezier(0.4, 0, 0.2, 1);
  --tv-font:         'Be Vietnam Pro', 'Inter', 'Segoe UI', sans-serif;
  --tv-z:            999999;
}

/* ════════════════════════════════════════════════════════════
   1. OVERLAY
   ════════════════════════════════════════════════════════════ */
.tuvan-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--tv-z);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 12, 20, 0.72);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--tv-ease-std),
              visibility 0.4s var(--tv-ease-std);
}

.tuvan-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* ════════════════════════════════════════════════════════════
   2. POPUP BOX
   ════════════════════════════════════════════════════════════ */
.tuvan-popup {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 940px;
  min-height: 520px;
  border-radius: var(--tv-radius-lg);
  overflow: hidden;
  box-shadow: var(--tv-shadow-popup);
  transform: scale(0.9) translateY(30px);
  transition: transform 0.5s var(--tv-ease-spring);
  will-change: transform;
}

.tuvan-overlay.is-open .tuvan-popup {
  transform: scale(1) translateY(0);
}

/* ════════════════════════════════════════════════════════════
   3. NÚT ĐÓNG (×)
   ════════════════════════════════════════════════════════════ */
.tuvan-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: 38px;
  height: 38px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.25s var(--tv-ease-std),
              border-color 0.25s var(--tv-ease-std),
              transform 0.3s var(--tv-ease-spring);
}

.tuvan-close svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

.tuvan-close:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.55);
  transform: rotate(90deg) scale(1.1);
}

/* ════════════════════════════════════════════════════════════
   4. CỘT ẢNH (TRÁI)
   ════════════════════════════════════════════════════════════ */
.tuvan-image-col {
  position: relative;
  flex: 0 0 65%;
  width: 65%;
  overflow: hidden;
}

/* Zoom ảnh khi mở popup */
.tuvan-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform-origin: center;
  transition: transform 7s ease;
}

.tuvan-overlay.is-open .tuvan-image {
  transform: scale(1.06);
}

/* Gradient đen phủ lên ảnh */
.tuvan-image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    175deg,
    rgba(0, 0, 0, 0.08) 0%,
    rgba(0, 0, 0, 0.12) 45%,
    rgba(10, 20, 50, 0.82) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px 24px;
}

/* Badge "Dịch vụ 5 sao" */
.tuvan-image-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(212, 168, 67, 0.2);
  border: 1px solid rgba(212, 168, 67, 0.55);
  border-radius: 100px;
  padding: 5px 14px 5px 10px;
  color: #f0c96a;
  font-family: var(--tv-font);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  margin-bottom: 11px;
  width: fit-content;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.tuvan-image-badge svg {
  color: #f0c96a;
  flex-shrink: 0;
}

.tuvan-image-tagline {
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--tv-font);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  margin: 0;
}

/* ════════════════════════════════════════════════════════════
   5. CỘT FORM (PHẢI)
   ════════════════════════════════════════════════════════════ */
.tuvan-form-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--tv-green);
  /* Subtle texture-like gradient */
  background-image: linear-gradient(
    160deg,
    var(--tv-green) 0%,
    #1a4580 60%,
    var(--tv-green-dark) 100%
  );
  padding: 36px 34px 28px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.tuvan-form-col::-webkit-scrollbar {
  width: 4px;
}
.tuvan-form-col::-webkit-scrollbar-track {
  background: transparent;
}
.tuvan-form-col::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

/* ── Header ── */
.tuvan-form-header {
  margin-bottom: 26px;
  text-align: center;
}

.tuvan-form-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  color: rgba(255,255,255,0.9);
}

.tuvan-title {
  font-family: var(--tv-font) !important;
  font-size: 26px !important;
  font-weight: 800 !important;
  color: var(--tv-white) !important;
  letter-spacing: 2.5px !important;
  text-transform: uppercase !important;
  margin: 0 0 8px !important;
  line-height: 1.15 !important;
  text-shadow: 0 1px 8px rgba(0,0,0,0.18);
}

.tuvan-subtitle {
  font-family: var(--tv-font);
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
  letter-spacing: 0.2px;
}

/* ════════════════════════════════════════════════════════════
   6. FORM FIELDS
   ════════════════════════════════════════════════════════════ */
.tuvan-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}

.tuvan-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.tuvan-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.tuvan-field--full {
  grid-column: 1 / -1;
}

/* Label */
.tuvan-label {
  font-family: var(--tv-font) !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  letter-spacing: 1.2px !important;
  text-transform: uppercase !important;
  color: rgba(255, 255, 255, 0.65) !important;
  margin: 0 !important;
  line-height: 1 !important;
  user-select: none;
}

.tuvan-required {
  color: #ff9d97;
  font-weight: 700;
}

/* Input & Textarea */
.tuvan-input {
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.28) !important;
  border-radius: 0 !important;
  padding: 9px 0 9px !important;
  color: var(--tv-white) !important;
  font-family: var(--tv-font) !important;
  font-size: 14.5px !important;
  font-weight: 400 !important;
  outline: none !important;
  box-shadow: none !important;
  caret-color: rgba(255,255,255,0.9);
  transition: border-color 0.3s var(--tv-ease-std) !important;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.4;
}

.tuvan-input::placeholder {
  color: rgba(255, 255, 255, 0.3) !important;
  font-weight: 300 !important;
}

.tuvan-input:focus {
  border-bottom-color: rgba(255, 255, 255, 0.85) !important;
}

.tuvan-input:-webkit-autofill,
.tuvan-input:-webkit-autofill:hover,
.tuvan-input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff !important;
  -webkit-box-shadow: 0 0 0 1000px #1e4d8c inset !important;
  transition: background-color 5000s ease-in-out 0s !important;
}

/* Textarea */
.tuvan-textarea {
  resize: none !important;
  min-height: 62px !important;
  font-family: var(--tv-font) !important;
  line-height: 1.55 !important;
}

/* ════════════════════════════════════════════════════════════
   7. KẾT QUẢ THÔNG BÁO
   ════════════════════════════════════════════════════════════ */
.tuvan-result {
  padding: 11px 16px;
  border-radius: var(--tv-radius-sm);
  font-family: var(--tv-font);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
}

.tuvan-result.is-success {
  background: rgba(255, 255, 255, 0.12);
  color: #a7f3cc;
  border: 1px solid rgba(167, 243, 204, 0.35);
}

.tuvan-result.is-error {
  background: rgba(231, 76, 60, 0.18);
  color: #ffc9c3;
  border: 1px solid rgba(231, 76, 60, 0.4);
}

/* ════════════════════════════════════════════════════════════
   8. NÚT GỬI ĐĂNG KÝ
   ════════════════════════════════════════════════════════════ */
.tuvan-submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 24px;
  background: var(--tv-red);
  border: none;
  border-radius: var(--tv-radius-md);
  color: var(--tv-white);
  font-family: var(--tv-font);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(192, 57, 43, 0.5),
              0 2px 6px rgba(0, 0, 0, 0.18);
  transition: background 0.25s var(--tv-ease-std),
              box-shadow 0.25s var(--tv-ease-std),
              transform 0.2s var(--tv-ease-spring);
}

/* Shimmer effect */
.tuvan-submit::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.18) 50%,
    transparent 100%
  );
  transform: skewX(-20deg);
  transition: left 0.55s var(--tv-ease-out);
}

.tuvan-submit:hover::after {
  left: 160%;
}

.tuvan-submit:hover {
  background: var(--tv-red-hover);
  box-shadow: 0 8px 28px rgba(169, 50, 38, 0.6),
              0 3px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

.tuvan-submit:active {
  transform: translateY(0);
  box-shadow: 0 4px 14px rgba(192, 57, 43, 0.4);
}

.tuvan-submit:disabled {
  opacity: 0.68;
  cursor: not-allowed;
  transform: none;
}

.tuvan-submit-text {
  letter-spacing: 1.5px;
}

.tuvan-submit-icon {
  display: flex;
  align-items: center;
  transition: transform 0.25s var(--tv-ease-spring);
}

.tuvan-submit:hover .tuvan-submit-icon {
  transform: translateX(4px);
}

/* Loading state */
.tuvan-submit-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 0.5px;
}

@keyframes tuvan-spin {
  to { transform: rotate(360deg); }
}

.tuvan-spinner {
  animation: tuvan-spin 0.85s linear infinite;
}

/* ── Phone note ── */
.tuvan-phone-note {
  text-align: center;
  font-family: var(--tv-font);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
  letter-spacing: 0.2px;
}

.tuvan-phone-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  margin-left: 2px;
  transition: color 0.2s var(--tv-ease-std);
}

.tuvan-phone-link:hover {
  color: var(--tv-white);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ════════════════════════════════════════════════════════════
   9. TRIGGER BUTTON (nút cố định góc phải)
   ════════════════════════════════════════════════════════════ */
.tuvan-trigger {
  position: fixed;
  right: 22px;
  bottom: 88px;
  z-index: calc(var(--tv-z) - 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: linear-gradient(145deg, var(--tv-green), var(--tv-green-dark));
  color: var(--tv-white);
  border: none;
  border-radius: 50px;
  padding: 14px 15px 11px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(var(--tv-green-rgb), 0.5),
              0 2px 8px rgba(0, 0, 0, 0.22),
              inset 0 1px 0 rgba(255,255,255,0.15);
  transition: transform 0.3s var(--tv-ease-spring),
              box-shadow 0.3s var(--tv-ease-std);
  font-family: var(--tv-font);
  line-height: 1;
}

.tuvan-trigger:hover {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 14px 40px rgba(var(--tv-green-rgb), 0.6),
              0 4px 14px rgba(0, 0, 0, 0.28);
}

.tuvan-trigger:active {
  transform: translateY(-1px) scale(1.02);
}

.tuvan-trigger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tuvan-trigger-label {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.88;
}

/* Vòng pulse */
.tuvan-trigger-pulse {
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid var(--tv-green);
  opacity: 0;
  pointer-events: none;
  animation: tuvan-pulse 2.6s ease-out infinite;
}

@keyframes tuvan-pulse {
  0%   { opacity: 0.75; transform: scale(1);    }
  80%  { opacity: 0;    transform: scale(1.32); }
  100% { opacity: 0;    transform: scale(1.32); }
}

/* ════════════════════════════════════════════════════════════
   10. RESPONSIVE — Tablet (≤ 768px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .tuvan-overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .tuvan-popup {
    flex-direction: column;
    max-height: 94vh;
    border-radius: var(--tv-radius-lg) var(--tv-radius-lg) 0 0;
    min-height: unset;
    transform: scale(1) translateY(100%);
  }

  .tuvan-overlay.is-open .tuvan-popup {
    transform: scale(1) translateY(0);
  }

  .tuvan-image-col {
    flex: 0 0 170px;
    width: 100%;
  }

  .tuvan-image-overlay {
    padding: 16px 18px;
  }

  .tuvan-image-tagline {
    font-size: 12.5px;
  }

  .tuvan-form-col {
    padding: 24px 20px 20px;
  }

  .tuvan-title {
    font-size: 21px !important;
    letter-spacing: 1.8px !important;
  }

  .tuvan-form-header {
    margin-bottom: 18px;
  }

  .tuvan-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .tuvan-trigger {
    right: 14px;
    bottom: 72px;
  }
}

/* ════════════════════════════════════════════════════════════
   11. RESPONSIVE — Mobile (≤ 480px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .tuvan-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .tuvan-popup {
    border-radius: 18px 18px 0 0;
  }

  .tuvan-image-col {
    flex: 0 0 140px;
  }

  .tuvan-form-col {
    padding: 20px 18px 18px;
  }

  .tuvan-title {
    font-size: 19px !important;
    letter-spacing: 1.5px !important;
  }

  .tuvan-form {
    gap: 15px;
  }

  .tuvan-submit {
    padding: 13px 20px;
    font-size: 12.5px;
  }
}
