/**
 * Quick Contact Buttons - Production Stylesheet
 * 
 * High-performance, accessible floating contact widget and modal popups.
 * Fully compliant with WordPress standards and vector branding specifications.
 */

/* ==========================================================================
   0. RESET & ISOLATION
   ========================================================================== */
#qcb-floating-bar,
#qcb-floating-bar *,
.qcb-modal,
.qcb-modal * {
  box-sizing: border-box;
}

/* ==========================================================================
   1. FLOATING BAR
   ========================================================================== */
#qcb-floating-bar {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  pointer-events: auto;
}

/* Position variants */
#qcb-floating-bar.qcb-bottom-right {
  bottom: 20px;
  right: 20px;
}

#qcb-floating-bar.qcb-bottom-left {
  bottom: 20px;
  left: 20px;
}

/* Optional top & side alignments for compatibility */
#qcb-floating-bar.qcb-top-right {
  top: 20px;
  right: 20px;
}

#qcb-floating-bar.qcb-top-left {
  top: 20px;
  left: 20px;
}

/* ==========================================================================
   2. RIGID CIRCULAR BUTTONS (.qcb-btn)
   ========================================================================== */
.qcb-btn {
  width: 60px !important;
  height: 60px !important;
  border-radius: 50% !important;
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border: none !important;
  margin: 0 !important;
  cursor: pointer;
  position: relative;
  outline: none;
  text-decoration: none;
  line-height: 0;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  -webkit-tap-highlight-color: transparent;
}

.qcb-btn:hover {
  transform: scale(1.08);
}

.qcb-btn:active {
  transform: scale(0.96);
}

.qcb-btn:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 4px;
}

/* SVGs inside buttons */
.qcb-btn svg {
  flex-shrink: 0;
  pointer-events: none;
  display: block;
}

/* ==========================================================================
   3. BUTTON COLORS (from design image)
   ========================================================================== */
.qcb-zalo {
  background: #0068FF !important;
  color: #ffffff !important;
}

.qcb-call {
  background: #25D366 !important;
  color: #ffffff !important;
}

.qcb-email {
  background: #F5A623 !important; /* AMBER/GOLD, not red — matches design image */
  color: #ffffff !important;
}

/* ==========================================================================
   4. DOUBLE PINK PULSE RINGS (CRITICAL — matches design image)
   ========================================================================== */
@keyframes qcb-double-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(248, 187, 208, 0.6), 0 0 0 0 rgba(248, 187, 208, 0.3);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(248, 187, 208, 0), 0 0 0 24px rgba(248, 187, 208, 0);
  }
}

.qcb-btn {
  animation: qcb-double-pulse 2s infinite;
}

/* ==========================================================================
   5. MODAL OVERLAY & BACKDROP (Bulletproof against theme overrides)
   ========================================================================== */
.qcb-modal {
  display: none !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 999999 !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  margin: 0 !important;
  background-color: rgba(15, 23, 42, 0.7) !important;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.qcb-modal.is-active {
  display: flex !important;
}

/* Backdrop (secondary reinforcement layer) */
.qcb-modal-backdrop {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background-color: rgba(15, 23, 42, 0.7) !important;
  z-index: 1 !important;
  cursor: pointer !important;
}

/* Content card (the white popup box) */
.qcb-modal-content,
.qcb-modal-dialog {
  position: relative !important;
  z-index: 10 !important;
  width: 90% !important;
  max-width: 480px !important;
  background-color: #ffffff !important;
  border-radius: 18px !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4) !important;
  overflow: hidden !important;
  max-height: 85vh !important;
  padding: 0 !important;
  transform: none !important;
}

.qcb-modal.is-active .qcb-modal-content,
.qcb-modal.is-active .qcb-modal-dialog {
  transform: none !important;
}

/* Modal header */
.qcb-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}

.qcb-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.4;
}

.qcb-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.qcb-modal-close:hover {
  background-color: #e2e8f0;
  color: #0f172a;
  transform: rotate(90deg);
}

.qcb-modal-close:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Modal body */
.qcb-modal-body {
  padding: 20px 22px 22px;
  max-height: calc(85vh - 72px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ==========================================================================
   6. PREMIUM CARD ITEMS (.qcb-card-item)
   ========================================================================== */
.qcb-card-item {
  display: flex;
  align-items: center;
  padding: 16px;
  margin-bottom: 14px;
  border-radius: 12px;
  border: 2px solid #f1f5f9;
  background: #ffffff;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s ease,
              box-shadow 0.25s ease,
              border-color 0.25s ease,
              background 0.25s ease;
}

.qcb-card-item:last-child {
  margin-bottom: 0;
}

.qcb-card-item:hover {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

/* ==========================================================================
   7. CARD ICON (.qcb-card-icon) & ANIMATIONS
   ========================================================================== */
.qcb-card-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  background: #4f46e5;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.qcb-card-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Card content layout */
.qcb-card-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

.qcb-card-arrow {
  margin-left: auto;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 12px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.qcb-card-item:hover .qcb-card-arrow {
  transform: translateX(4px);
  color: #4f46e5;
}

/* Phone icon hover ringing animation */
@keyframes qcb-ring {
  0% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-14deg); }
  30% { transform: rotate(12deg); }
  40% { transform: rotate(-12deg); }
  50% { transform: rotate(8deg); }
  60% { transform: rotate(-8deg); }
  70% { transform: rotate(4deg); }
  80% { transform: rotate(-4deg); }
  100% { transform: rotate(0deg); }
}

#qcb-modal-call .qcb-card-item:hover .qcb-card-icon,
.qcb-card-item:hover .qcb-card-icon-call,
.qcb-card-item:hover .qcb-card-icon[data-type="call"] {
  animation: qcb-ring 0.8s ease-in-out;
}

/* Zalo icon hover bounce animation */
@keyframes qcb-bounce {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
  50% { transform: translateY(0); }
  70% { transform: translateY(-3px); }
}

#qcb-modal-zalo .qcb-card-item:hover .qcb-card-icon,
.qcb-card-item:hover .qcb-card-icon-zalo,
.qcb-card-item:hover .qcb-card-icon[data-type="zalo"] {
  animation: qcb-bounce 0.8s ease-in-out;
}

/* ==========================================================================
   8. TYPOGRAPHY
   ========================================================================== */
.qcb-card-title {
  font-size: 14px;
  color: #64748b;
  font-weight: 700 !important;
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.qcb-card-number {
  font-size: 17px;
  color: #0f172a;
  font-weight: 700 !important;
  margin: 0;
  line-height: 1.3;
}

/* ==========================================================================
   9. EMAIL / CF7 MODAL
   ========================================================================== */
#qcb-modal-email .qcb-modal-content,
#qcb-modal-email .qcb-modal-dialog {
  max-width: 550px;
}

#qcb-modal-email form,
#qcb-modal-email .wpcf7-form {
  display: flex;
  flex-direction: column;
}

#qcb-modal-email p {
  margin: 0 0 16px 0;
}

#qcb-modal-email p:last-of-type {
  margin-bottom: 0;
}

#qcb-modal-email label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

/* Input fields */
#qcb-modal-email input[type="text"],
#qcb-modal-email input[type="email"],
#qcb-modal-email input[type="tel"],
#qcb-modal-email input[type="url"],
#qcb-modal-email textarea,
#qcb-modal-email select,
.qcb-modal input[type="text"],
.qcb-modal input[type="email"],
.qcb-modal input[type="tel"],
.qcb-modal textarea {
  width: 100% !important;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  color: #0f172a;
  background-color: #ffffff;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

#qcb-modal-email input[type="text"]:focus,
#qcb-modal-email input[type="email"]:focus,
#qcb-modal-email input[type="tel"]:focus,
#qcb-modal-email input[type="url"]:focus,
#qcb-modal-email textarea:focus,
#qcb-modal-email select:focus,
.qcb-modal input:focus,
.qcb-modal textarea:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

#qcb-modal-email textarea,
.qcb-modal textarea {
  min-height: 100px;
  resize: vertical;
}

/* Submit button */
#qcb-modal-email input[type="submit"],
#qcb-modal-email button[type="submit"],
.qcb-modal input[type="submit"],
.qcb-modal button[type="submit"] {
  background: linear-gradient(135deg, #ef4444, #f59e0b) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
  padding: 13px 14px !important;
  border: none !important;
  cursor: pointer !important;
  width: 100% !important;
  font-size: 16px;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

#qcb-modal-email input[type="submit"]:hover,
#qcb-modal-email button[type="submit"]:hover,
.qcb-modal input[type="submit"]:hover,
.qcb-modal button[type="submit"]:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.4);
}

#qcb-modal-email input[type="submit"]:active,
#qcb-modal-email button[type="submit"]:active,
.qcb-modal input[type="submit"]:active,
.qcb-modal button[type="submit"]:active {
  transform: translateY(0);
}

/* Contact Form 7 Response and Loader */
#qcb-modal-email .wpcf7-response-output {
  margin: 14px 0 0 0 !important;
  padding: 12px 14px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
}

#qcb-modal-email .wpcf7-spinner {
  margin: 12px auto 0 auto;
  display: block;
}

/* ==========================================================================
   9B. NUT LEN DAU TRANG + NHAN HOVER (kieu DUDI) + TINH CHINH FORM CF7
   ========================================================================== */
/* Nut len dau trang: nen trang, chi hien khi da cuon xuong (JS them .qcb-show) */
.qcb-topbtn {
  background: #ffffff !important;
  color: #334155 !important;
  animation: none !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.85);
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease, visibility 0.3s ease;
}

.qcb-topbtn.qcb-show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.qcb-topbtn.qcb-show:hover {
  transform: scale(1.08);
}

/* Nhan chu truot ra khi di chuot (desktop) */
.qcb-label {
  position: absolute;
  top: 50%;
  right: calc(100% + 12px);
  transform: translateY(-50%) translateX(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  white-space: nowrap;
  background: #ffffff;
  color: #0f172a;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  padding: 9px 14px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  z-index: 2;
}

.qcb-btn:hover .qcb-label,
.qcb-btn:focus-visible .qcb-label {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/* Cot nut nam ben trai: nhan hien sang phia phai */
#qcb-floating-bar.qcb-bottom-left .qcb-label,
#qcb-floating-bar.qcb-top-left .qcb-label {
  right: auto;
  left: calc(100% + 12px);
  transform: translateY(-50%) translateX(-8px);
}

#qcb-floating-bar.qcb-bottom-left .qcb-btn:hover .qcb-label,
#qcb-floating-bar.qcb-bottom-left .qcb-btn:focus-visible .qcb-label,
#qcb-floating-bar.qcb-top-left .qcb-btn:hover .qcb-label,
#qcb-floating-bar.qcb-top-left .qcb-btn:focus-visible .qcb-label {
  transform: translateY(-50%) translateX(0);
}

/* Man hinh cam ung khong co hover: an nhan */
@media (hover: none) {
  .qcb-label {
    display: none !important;
  }
}

/* Form CF7 trong popup: cac o deu 48px, het cat chu o dropdown */
.qcb-cf7-container .wpcf7-form-control-wrap {
  display: block;
}

.qcb-cf7-container br {
  display: none;
}

#qcb-modal-email p {
  margin: 0 0 14px 0;
}

#qcb-modal-email label {
  font-size: 13.5px;
  margin-bottom: 7px;
}

#qcb-modal-email input[type="text"],
#qcb-modal-email input[type="email"],
#qcb-modal-email input[type="tel"],
#qcb-modal-email input[type="url"],
#qcb-modal-email select,
.qcb-modal input[type="text"],
.qcb-modal input[type="email"],
.qcb-modal input[type="tel"],
.qcb-modal select {
  height: 48px !important;
  line-height: 1.45 !important;
  border-radius: 10px;
}

#qcb-modal-email select,
.qcb-modal select {
  padding-right: 38px;
  cursor: pointer;
}

#qcb-modal-email textarea,
.qcb-modal textarea {
  line-height: 1.5;
  border-radius: 10px;
}

/* ==========================================================================
   9C. DONG BO THUONG HIEU THANH CONG (v6.1.1)
   - Nhan hover: chu mau theo dung mau nut tuong ung
   - Popup: dai gradient do-cam (mau chu dao website) tren dinh hop
   - The lien he: icon + diem nhan theo mau tung loai (Zalo xanh duong,
     Goi xanh la), so dien thoai noi bat, mui ten dan duong
   ========================================================================== */
/* Mau chu nhan hover theo mau nut */
.qcb-zalo .qcb-label {
  color: #0068ff;
}

.qcb-call .qcb-label {
  color: #25d366;
}

.qcb-email .qcb-label {
  color: #f5a623;
}

.qcb-topbtn .qcb-label {
  color: #334155;
}

/* Dai gradient do-cam tren dinh popup */
.qcb-modal-dialog::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #ef4444 0%, #f97316 55%, #f59e0b 100%);
  z-index: 1;
}

/* The lien he: vien mong hon, bo goc mem hon */
.qcb-card-item {
  border-width: 1.5px;
  border-color: #e8edf3;
  border-radius: 14px;
}

/* Icon the theo mau loai */
#qcb-modal-zalo .qcb-card-icon {
  background: #0068ff;
  box-shadow: 0 6px 14px rgba(0, 104, 255, 0.28);
}

#qcb-modal-call .qcb-card-icon {
  background: #25d366;
  box-shadow: 0 6px 14px rgba(37, 211, 102, 0.3);
}

/* Hover the: sang theo tong mau loai */
#qcb-modal-zalo .qcb-card-item:hover {
  background: linear-gradient(135deg, #ffffff 0%, #f2f7ff 100%);
  border-color: rgba(0, 104, 255, 0.45);
  box-shadow: 0 10px 24px -8px rgba(0, 104, 255, 0.25);
}

#qcb-modal-call .qcb-card-item:hover {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border-color: rgba(37, 211, 102, 0.5);
  box-shadow: 0 10px 24px -8px rgba(37, 211, 102, 0.28);
}

/* So dien thoai noi bat hon; hover doi mau theo loai */
.qcb-card-number {
  font-size: 18px;
  letter-spacing: 0.2px;
}

#qcb-modal-zalo .qcb-card-item:hover .qcb-card-number {
  color: #0068ff;
}

#qcb-modal-call .qcb-card-item:hover .qcb-card-number {
  color: #16a34a;
}

#qcb-modal-zalo .qcb-card-item:hover .qcb-card-arrow {
  color: #0068ff;
}

#qcb-modal-call .qcb-card-item:hover .qcb-card-arrow {
  color: #16a34a;
}

/* ==========================================================================
   10. MOBILE (max-width: 767px)
   ========================================================================== */
@media (max-width: 767px) {
  #qcb-floating-bar {
    gap: 10px;
  }

  #qcb-floating-bar.qcb-bottom-right {
    bottom: 14px;
    right: 12px;
  }

  #qcb-floating-bar.qcb-bottom-left {
    bottom: 14px;
    left: 12px;
  }

  .qcb-btn {
    width: 46px !important;
    height: 46px !important;
  }

  .qcb-btn svg {
    max-width: 24px;
    max-height: 24px;
  }

  .qcb-modal {
    padding: 12px;
  }

  .qcb-modal-header {
    padding: 16px 18px;
  }

  .qcb-modal-body {
    padding: 18px;
  }

  .qcb-card-item {
    padding: 12px 14px;
    margin-bottom: 10px;
  }

  .qcb-card-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    margin-right: 12px;
  }

  .qcb-card-icon svg {
    width: 18px;
    height: 18px;
  }

  .qcb-card-title {
    font-size: 13px;
  }

  .qcb-card-number {
    font-size: 15px;
  }
}

/* ==========================================================================
   11. ACCESSIBILITY & PREFERS-REDUCED-MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .qcb-btn {
    animation: none !important;
  }
}
