/* ==========================================================================
   DABACO OIL — Base / Reset layer
   Minimal, works on top of Bootstrap Reboot. No !important without a reason.
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg-white);
  color: var(--text-primary);
}

/* Images: never distort, always scale down responsively */
img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* Media that must preserve aspect ratio (e.g. logo) opt-in via .img-contain */
.img-contain {
  object-fit: contain;
}

/* Forms inherit the brand font */
input,
select,
textarea,
button {
  font-family: inherit;
  font-size: inherit;
}

/* --- Accessible focus state ---------------------------------------------
   Do NOT use `outline: none` without an equivalent. This provides a single,
   visible, brand-aware focus ring for keyboard users across interactive
   elements. Mouse users still see it only on :focus-visible.
   ------------------------------------------------------------------------ */
:focus-visible {
  outline: 3px solid var(--dabaco-blue);
  outline-offset: 2px;
  border-radius: var(--radius-default);
}

/* Selection */
::selection {
  background-color: var(--dabaco-orange);
  color: var(--text-dark);
}

/* Layout container aligned to the design token width with responsive padding */
.container-dabaco {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: clamp(1rem, 3.5vw, 2.75rem);
}

/* Skip link for keyboard/screen-reader users */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1100;
  padding: 0.75rem 1rem;
  background: var(--dabaco-orange);
  color: var(--text-dark);
  border-radius: var(--radius-default);
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  color: var(--bg-white);
  text-decoration: none;
}

/* Visually-hidden helper (accessible names) */
.visually-hidden-dabaco {
  position: absolute !important; /* reason: standard a11y clip technique requires it */
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Back-to-top (placed directly above contact widget) ------------------- */
.back-to-top {
  position: fixed;
  bottom: calc(2rem + 52px + 10px);
  right: calc(2rem + 3px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  background: linear-gradient(135deg, var(--dabaco-blue) 0%, var(--dabaco-blue-hover) 100%);
  border: none;
  border-radius: 50%;
  color: var(--bg-white);
  box-shadow: 0 6px 18px rgba(29, 117, 189, 0.38);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.25s ease,
              visibility 0.25s ease,
              transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.25s ease;
}

.back-to-top svg {
  width: 22px;
  height: 22px;
  stroke: #ffffff;
  stroke-width: 2.8;
  transition: transform 0.22s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: linear-gradient(135deg, #1864a3 0%, #0e4470 100%);
  color: #ffffff;
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 8px 24px rgba(29, 117, 189, 0.52);
}

.back-to-top:hover svg {
  transform: translateY(-2px);
}

.back-to-top:active {
  transform: scale(0.95);
}

/* Hide back-to-top smoothly when contact widget is open */
body:has(.contact-widget.is-open) .back-to-top {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(8px) !important;
}

/* ==========================================================================
   Shared Quick Contact Speed-Dial Widget (Hotline & Email actions)
   Positioned under back-to-top button.
   ========================================================================== */
.contact-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

/* Trigger Button */
.contact-widget__trigger {
  position: relative;
  z-index: 991;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--dabaco-orange) 0%, var(--dabaco-orange-hover) 100%);
  color: var(--bg-white);
  box-shadow: 0 6px 20px rgba(241, 90, 41, 0.45);
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  user-select: none;
  pointer-events: auto;
}

.contact-widget__trigger:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 26px rgba(241, 90, 41, 0.6);
}

.contact-widget__trigger:active {
  transform: scale(0.94);
}

.contact-widget__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  transition: opacity 0.22s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.contact-widget__icon--open {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.contact-widget__icon--close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

.contact-widget.is-open .contact-widget__icon--open {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

.contact-widget.is-open .contact-widget__icon--close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Pulse Animation Ring */
.contact-widget__pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(241, 90, 41, 0.65);
  animation: cw-pulse 2.4s cubic-bezier(0.24, 0, 0.38, 1) infinite;
  pointer-events: none;
}

.contact-widget.is-open .contact-widget__pulse {
  display: none;
}

@keyframes cw-pulse {
  0% { transform: scale(0.92); opacity: 0.85; }
  50% { transform: scale(1.24); opacity: 0; }
  100% { transform: scale(0.92); opacity: 0; }
}

/* Speed Dial Menu Container - Slides smoothly upwards */
.contact-widget__menu {
  position: relative;
  z-index: 991;
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* Ensures each pill aligns strictly to the right edge */
  gap: 10px;
  margin-bottom: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(22px);
  pointer-events: none;
  transition: opacity 0.26s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.contact-widget.is-open .contact-widget__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Quick Action Items (Pills) */
.contact-widget__item {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end; /* All contents push to the right so icons align */
  gap: 12px;
  padding: 6px 6px 6px 18px; /* 6px padding on right aligns 40px icon with 52px trigger center (26px) */
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.16), 0 3px 8px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.9);
  text-decoration: none;
  white-space: nowrap;
  pointer-events: auto;
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.22s ease,
              box-shadow 0.2s ease,
              border-color 0.2s ease;
}

.contact-widget.is-open .contact-widget__item {
  transform: translateY(0);
  opacity: 1;
}

.contact-widget.is-open .contact-widget__item--phone {
  transition-delay: 0.04s;
}

.contact-widget.is-open .contact-widget__item--zalo {
  transition-delay: 0.07s;
}

.contact-widget.is-open .contact-widget__item--email {
  transition-delay: 0.1s;
}

.contact-widget.is-open .contact-widget__item:hover {
  transform: translateX(-4px) scale(1.02);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.22);
  text-decoration: none;
  transition-delay: 0s;
}

.contact-widget__item-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  line-height: 1.25;
}

.contact-widget__item-title {
  font-size: var(--fs-small);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.contact-widget__item-val {
  font-size: var(--fs-body);
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.01em;
}

.contact-widget__item-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #ffffff;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.contact-widget__item:hover .contact-widget__item-icon {
  transform: scale(1.08);
}

/* Hotline specific style */
.contact-widget__item--phone .contact-widget__item-icon {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.contact-widget__item--phone:hover {
  border-color: #a7f3d0;
}

.contact-widget__item--phone:hover .contact-widget__item-val {
  color: #059669;
}

/* Email specific style */
.contact-widget__item--email .contact-widget__item-icon {
  background: linear-gradient(135deg, var(--dabaco-blue) 0%, var(--dabaco-blue-hover) 100%);
  box-shadow: 0 4px 12px rgba(29, 117, 189, 0.35);
}

.contact-widget__item--email:hover {
  border-color: #bae6fd;
}

.contact-widget__item--email:hover .contact-widget__item-val {
  color: var(--dabaco-blue);
}

/* Zalo specific style */
.contact-widget__item--zalo .contact-widget__item-icon {
  background: #0068ff;
  box-shadow: 0 4px 12px rgba(0, 104, 255, 0.35);
  overflow: hidden;
  padding: 0;
}

.contact-widget__item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.contact-widget__item--zalo:hover {
  border-color: #bfdbfe;
}

.contact-widget__item--zalo:hover .contact-widget__item-val {
  color: #0068ff;
}
