/**
 * Fixed contact — CSS thuần, class tiền tố dcx-fc- (tránh trùng Tailwind/theme).
 * Markup: thuvien/partials/sticky-cta.php, floating-cta.php
 */

.dcx-fc-sticky,
.dcx-fc-float {
  --dcx-fc-gold: #cfaf6e;
  --dcx-fc-gold-hover: #b89a5f;
  --dcx-fc-text: #222222;
  --dcx-fc-border: #e5e7eb;
  --dcx-fc-surface: rgba(255, 255, 255, 0.95);
  --dcx-fc-shadow-up: 0 -6px 20px rgba(0, 0, 0, 0.08);
  --dcx-fc-shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
}

.dcx-fc-sticky *,
.dcx-fc-float *,
.dcx-fc-sticky *::before,
.dcx-fc-float *::after {
  box-sizing: border-box;
}

/* ——— Mobile bar ——— */
.dcx-fc-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.4rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  padding-left: max(0.4rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.4rem, env(safe-area-inset-right, 0px));
  background: var(--dcx-fc-surface);
  border-top: 1px solid var(--dcx-fc-border);
  box-shadow: var(--dcx-fc-shadow-up);
  font-family: inherit;
}

@media (min-width: 768px) {
  .dcx-fc-sticky {
    display: none !important;
  }
}

.dcx-fc-sticky__btn {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.5rem 0.35rem;
  border-radius: 0.75rem;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

@media (min-width: 640px) {
  .dcx-fc-sticky__btn {
    flex-direction: row;
    gap: 0.4rem;
    padding: 0.5rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 1rem;
  }
}

.dcx-fc-sticky__btn--outline {
  border: 1px solid var(--dcx-fc-gold);
  color: var(--dcx-fc-gold);
  background: transparent;
}

.dcx-fc-sticky__btn--outline:hover {
  background: rgba(207, 175, 110, 0.08);
}

.dcx-fc-sticky__btn--primary {
  border: 1px solid transparent;
  color: var(--dcx-fc-text);
  background: linear-gradient(120deg, var(--dcx-fc-gold), #e3c78a, var(--dcx-fc-gold));
  background-size: 200% 200%;
  animation: dcx-fc-gold-shift 4s ease-in-out infinite;
}

.dcx-fc-sticky__btn--primary:hover {
  filter: brightness(0.97);
}

.dcx-fc-sticky__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  border-radius: 9999px;
}

.dcx-fc-sticky__icon--muted {
  background: rgba(207, 175, 110, 0.15);
  color: var(--dcx-fc-gold);
}

.dcx-fc-sticky__icon--dark {
  background: rgba(0, 0, 0, 0.06);
  color: var(--dcx-fc-text);
}

.dcx-fc-sticky__svg {
  width: 0.875rem;
  height: 0.875rem;
  display: block;
}

.dcx-fc-sticky__label {
  max-width: 100%;
  overflow-wrap: anywhere;
  hyphens: auto;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

@media (min-width: 640px) {
  .dcx-fc-sticky__label {
    display: block;
    -webkit-line-clamp: unset;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@keyframes dcx-fc-gold-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dcx-fc-sticky__btn--primary {
    animation: none;
  }
}

/* ——— Desktop column ——— */
.dcx-fc-float {
  position: fixed;
  z-index: 30;
  right: 0.75rem;
  bottom: 1rem;
  left: auto;
  top: auto;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: min(18rem, calc(100vw - 1.25rem));
  font-family: inherit;
  pointer-events: none;
}

.dcx-fc-float > * {
  pointer-events: auto;
}

@media (min-width: 768px) {
  .dcx-fc-float {
    display: flex;
  }
  .dcx-fc-float {
    right: 1rem;
    bottom: 1.25rem;
    gap: 0.65rem;
  }
}

@media (min-width: 1024px) {
  .dcx-fc-float {
    right: 1.25rem;
    bottom: 1.5rem;
  }
}

/* Ẩn desktop dưới md (phòng trường hợp CSS khác ghi đè) */
@media (max-width: 767.98px) {
  [data-dcx-fc="desktop"] {
    display: none !important;
  }
}

@media (min-width: 768px) {
  [data-dcx-fc="desktop"] {
    display: flex !important;
    flex-direction: column;
    align-items: flex-end;
    z-index: 140;
  }
}

.dcx-fc-float__btn {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  color: var(--dcx-fc-text);
  cursor: pointer;
  border: none;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 0.2s ease, filter 0.2s ease;
  animation: dcx-fc-float-wiggle 2.9s ease-in-out infinite;
  will-change: transform;
}

@media (min-width: 768px) {
  .dcx-fc-float__btn {
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-radius: 1rem;
  }
}

.dcx-fc-float__btn:nth-child(2) {
  animation-delay: 180ms;
}
.dcx-fc-float__btn:nth-child(3) {
  animation-delay: 360ms;
}

.dcx-fc-float__btn--outline {
  background: var(--dcx-fc-surface);
  border: 1px solid var(--dcx-fc-border);
  box-shadow: var(--dcx-fc-shadow-soft);
}

.dcx-fc-float__btn--outline:hover {
  background: #fff;
}

.dcx-fc-float__btn--primary {
  background: linear-gradient(120deg, var(--dcx-fc-gold), #e3c78a, var(--dcx-fc-gold));
  background-size: 200% 200%;
  color: var(--dcx-fc-text);
  box-shadow: var(--dcx-fc-shadow-soft);
  animation: dcx-fc-float-wiggle 2.9s ease-in-out infinite, dcx-fc-gold-shift 4s ease-in-out infinite;
}

.dcx-fc-float__btn--primary:hover {
  filter: brightness(0.96);
}

.dcx-fc-float__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  border-radius: 9999px;
}

@media (min-width: 768px) {
  .dcx-fc-float__icon {
    width: 1.75rem;
    height: 1.75rem;
  }
}

.dcx-fc-float__icon--muted {
  background: rgba(207, 175, 110, 0.15);
  color: var(--dcx-fc-gold);
}

.dcx-fc-float__icon--dark {
  background: rgba(0, 0, 0, 0.06);
  color: var(--dcx-fc-text);
}

.dcx-fc-float__svg {
  width: 0.875rem;
  height: 0.875rem;
  display: block;
}

@media (min-width: 768px) {
  .dcx-fc-float__svg {
    width: 1rem;
    height: 1rem;
  }
}

.dcx-fc-float__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes dcx-fc-float-wiggle {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  35% {
    transform: translate3d(0, -3px, 0);
  }
  60% {
    transform: translate3d(0, 0, 0);
  }
  75% {
    transform: translate3d(0, -1px, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dcx-fc-float__btn {
    animation: none !important;
  }
}

/* ——— Vào trang: delay + hướng (do fixed-contact.js) ——— */
[data-dcx-fc].dcx-fc-enter {
  opacity: 0;
  pointer-events: none;
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 260ms ease;
  will-change: transform, opacity;
}

[data-dcx-fc].dcx-fc-enter[data-dcx-fc-anim="bottom"] {
  transform: translate3d(0, 20px, 0);
}
[data-dcx-fc].dcx-fc-enter[data-dcx-fc-anim="left"] {
  transform: translate3d(-24px, 0, 0);
}
[data-dcx-fc].dcx-fc-enter[data-dcx-fc-anim="right"] {
  transform: translate3d(24px, 0, 0);
}
[data-dcx-fc].dcx-fc-enter[data-dcx-fc-anim="fade"] {
  transform: none;
}

[data-dcx-fc].dcx-fc-enter.dcx-fc-enter--visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  [data-dcx-fc].dcx-fc-enter {
    transition: none !important;
    transform: none !important;
  }
}
