/**
 * Floating Mobile Menu - Liquid Glass Effect
 * Aurora Hotel Plaza
 * Chỉ hiển thị trên mobile (< 768px)
 */

/* ===== Floating Menu Container ===== */
.floating-menu {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9999;
  display: none;
}

@media (max-width: 767px) {
  .floating-menu {
    display: block;
  }
}

/* ===== Main Toggle Button ===== */
.floating-menu-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 10000;

  /* Liquid Glass Effect */
  background: linear-gradient(
    135deg,
    rgba(212, 175, 55, 0.9) 0%,
    rgba(184, 148, 31, 0.85) 100%
  );
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow:
    0 8px 32px rgba(212, 175, 55, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 16px 32px -8px rgba(0, 0, 0, 0.25);

  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-transition:
    -webkit-transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition:
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.floating-menu-toggle:hover {
  -webkit-transform: scale(1.05) translateZ(0);
  transform: scale(1.05) translateZ(0);
  box-shadow:
    0 12px 40px rgba(212, 175, 55, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.15) inset,
    0 20px 40px -8px rgba(0, 0, 0, 0.3);
}

.floating-menu-toggle:active {
  -webkit-transform: scale(0.95) translateZ(0);
  transform: scale(0.95) translateZ(0);
}

/* Hamburger Icon */
.floating-menu-icon {
  width: 24px;
  height: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 0 auto;
}

.floating-menu-icon span {
  display: block;
  width: 100%;
  height: 2px;
  background: white;
  border-radius: 2px;
  -webkit-transition:
    -webkit-transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-transform-origin: center;
  transform-origin: center;
}

/* Hamburger to X animation */
.floating-menu.active .floating-menu-icon span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.floating-menu.active .floating-menu-icon span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.floating-menu.active .floating-menu-icon span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ===== Menu Overlay ===== */
.floating-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    visibility 0.3s;
  z-index: 9998;
}

.floating-menu.active .floating-menu-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ===== Sub Menu Items Container ===== */
.floating-menu-items {
  position: absolute;
  bottom: 70px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  z-index: 10000;
  pointer-events: none;
}

.floating-menu.active .floating-menu-items {
  pointer-events: auto;
}

/* ===== Individual Menu Item ===== */
.floating-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  -webkit-transform: translateY(20px) scale(0.8) translateZ(0);
  transform: translateY(20px) scale(0.8) translateZ(0);
  -webkit-transition:
    -webkit-transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.floating-menu.active .floating-menu-item {
  opacity: 1;
  -webkit-transform: translateY(0) scale(1) translateZ(0);
  transform: translateY(0) scale(1) translateZ(0);
  pointer-events: auto;
}

/* Stagger animation */
.floating-menu.active .floating-menu-item:nth-child(1) {
  transition-delay: 0.05s;
}

.floating-menu.active .floating-menu-item:nth-child(2) {
  transition-delay: 0.1s;
}

.floating-menu.active .floating-menu-item:nth-child(3) {
  transition-delay: 0.15s;
}

.floating-menu.active .floating-menu-item:nth-child(4) {
  transition-delay: 0.2s;
}

.floating-menu.active .floating-menu-item:nth-child(5) {
  transition-delay: 0.25s;
}

.floating-menu.active .floating-menu-item:nth-child(6) {
  transition-delay: 0.3s;
}

.floating-menu.active .floating-menu-item:nth-child(7) {
  transition-delay: 0.35s;
}

/* Menu Item Label */
.floating-menu-label {
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;

  /* Liquid Glass Effect - Higher contrast */
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.6) 0%,
    rgba(30, 41, 59, 0.7) 100%
  );
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);

  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-transition:
    background 0.3s ease,
    -webkit-transform 0.3s ease;
  transition:
    background 0.3s ease,
    transform 0.3s ease;
}

.floating-menu-item:hover .floating-menu-label {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  -webkit-transform: translateX(-4px) translateZ(0);
  transform: translateX(-4px) translateZ(0);
}

/* Menu Item Icon Button */
.floating-menu-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  flex-shrink: 0;
  box-sizing: border-box;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;

  /* Liquid Glass Effect - Higher contrast */
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.6) 0%,
    rgba(30, 41, 59, 0.7) 100%
  );
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  color: white;

  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-transition:
    -webkit-transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.3s ease,
    box-shadow 0.3s ease;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.3s ease,
    box-shadow 0.3s ease;
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  position: relative;
  overflow: hidden;
}

.floating-menu-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0) 100%
  );
  border-radius: 50% 50% 0 0;
  pointer-events: none;
}

.floating-menu-btn:hover {
  -webkit-transform: scale(1.1) translateZ(0);
  transform: scale(1.1) translateZ(0);
  background: linear-gradient(
    135deg,
    rgba(212, 175, 55, 0.8) 0%,
    rgba(184, 148, 31, 0.7) 100%
  );
  box-shadow:
    0 8px 24px rgba(212, 175, 55, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.floating-menu-btn:active {
  -webkit-transform: scale(0.95) translateZ(0);
  transform: scale(0.95) translateZ(0);
}

.floating-menu-btn .material-symbols-outlined {
  font-size: 22px;
}

/* ===== Submenu (Nested) ===== */
.floating-submenu-wrapper {
  position: relative;
}

/* Overlay để làm mờ các menu items khác khi submenu mở */
.floating-submenu-wrapper.submenu-open ~ .floating-menu-item,
.floating-submenu-wrapper.submenu-open ~ .floating-submenu-wrapper {
  opacity: 0.3;
  pointer-events: none;
}

/* Các items phía trước submenu đang mở cũng bị mờ */
.floating-menu-items:has(.floating-submenu-wrapper.submenu-open)
  .floating-menu-item:not(.floating-submenu-wrapper.submenu-open),
.floating-menu-items:has(.floating-submenu-wrapper.submenu-open)
  .floating-submenu-wrapper:not(.submenu-open) {
  opacity: 0.3;
  pointer-events: none;
}

.floating-submenu {
  position: absolute;
  right: 60px;
  bottom: -8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(10px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 10001;
  padding: 10px;
  background: rgba(17, 24, 39, 0.95);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* Chỉ mở submenu khi hover trên thiết bị có chuột thực (không phải touch) */
@media (hover: hover) and (pointer: fine) {
  .floating-submenu-wrapper:hover .floating-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
  }
}

/* Mở submenu khi có class submenu-open (click trên touch devices) */
.floating-submenu-wrapper.submenu-open .floating-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.floating-submenu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;

  background: rgba(255, 255, 255, 0.1);
  border: none;

  color: white;
  font-size: 0.8rem;
  font-weight: 500;

  transition: all 0.2s ease;
}

.floating-submenu-item:hover {
  background: linear-gradient(
    135deg,
    rgba(212, 175, 55, 0.6) 0%,
    rgba(184, 148, 31, 0.5) 100%
  );
  transform: translateX(-4px);
}

.floating-submenu-item .material-symbols-outlined {
  font-size: 18px;
}

/* Badge for new items */
.floating-badge-new {
  font-size: 0.6rem;
  padding: 2px 6px;
  background: linear-gradient(135deg, #d4af37, #b8941f);
  color: white;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: 4px;
}

/* ===== Shimmer Effect - DISABLED for performance ===== */
/* Uncomment if needed on high-end devices
.floating-menu-toggle::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle at 30% 20%,
        rgba(255, 255, 255, 0.15) 0%,
        transparent 50%
    );
    pointer-events: none;
    animation: floatingShimmer 8s ease-in-out infinite;
    border-radius: 50%;
}

@keyframes floatingShimmer {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(5%, 5%) rotate(2deg); }
    50% { transform: translate(0, 10%) rotate(0deg); }
    75% { transform: translate(-5%, 5%) rotate(-2deg); }
}
*/

/* ===== Dark Mode ===== */
.dark .floating-menu-label,
.dark .floating-menu-btn {
  background: linear-gradient(
    135deg,
    rgba(30, 30, 30, 0.5) 0%,
    rgba(20, 20, 20, 0.6) 100%
  );
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .floating-submenu-item {
  background: linear-gradient(
    135deg,
    rgba(30, 30, 30, 0.6) 0%,
    rgba(20, 20, 20, 0.7) 100%
  );
  border-color: rgba(255, 255, 255, 0.08);
}

/* ===== Pulse Animation for CTA - DISABLED for performance ===== */
/* Uncomment if needed on high-end devices
.floating-menu-toggle.pulse::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.4);
    animation: pulseRing 2s ease-out infinite;
    z-index: -1;
}

@keyframes pulseRing {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}
*/

/* ===== Safe Area for iPhone ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .floating-menu {
    bottom: calc(96px + env(safe-area-inset-bottom));
    right: calc(24px + env(safe-area-inset-right));
  }
}

/* ===== Accessibility ===== */
.floating-menu-toggle:focus,
.floating-menu-btn:focus {
  outline: 2px solid rgba(212, 175, 55, 0.8);
  outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Floating Booking Toggle Button ===== */
.floating-booking-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  position: fixed;
  bottom: 168px;
  right: 28px;
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;

  /* Same gold color as menu toggle button */
  background: linear-gradient(
    135deg,
    rgba(212, 175, 55, 0.9) 0%,
    rgba(184, 148, 31, 0.85) 100%
  );
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow:
    0 8px 32px rgba(212, 175, 55, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 16px 32px -8px rgba(0, 0, 0, 0.25);
  color: white;

  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-transition:
    -webkit-transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

@media (max-width: 767px) {
  .floating-booking-toggle {
    display: flex;
  }
}

.floating-booking-toggle:hover {
  -webkit-transform: scale(1.1) translateZ(0);
  transform: scale(1.1) translateZ(0);
  background: linear-gradient(
    135deg,
    rgba(212, 175, 55, 0.8) 0%,
    rgba(184, 148, 31, 0.7) 100%
  );
  box-shadow:
    0 8px 24px rgba(212, 175, 55, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.floating-booking-toggle:active {
  -webkit-transform: scale(0.95) translateZ(0);
  transform: scale(0.95) translateZ(0);
}

.floating-booking-toggle .material-symbols-outlined {
  font-size: 22px;
}

/* ===== Floating Booking Popup ===== */
.floating-booking-popup {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  pointer-events: none;
  padding: 20px;
}

.floating-booking-popup.active {
  visibility: visible;
  pointer-events: auto;
}

.floating-booking-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.floating-booking-popup.active .floating-booking-overlay {
  opacity: 1;
}

.floating-booking-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 85vh;
  overflow-y: auto;
  margin: 0;
  padding: 24px;

  /* Liquid Glass Effect */
  background: linear-gradient(
    135deg,
    rgba(30, 41, 59, 0.95) 0%,
    rgba(17, 24, 39, 0.98) 100%
  );
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;

  transform: scale(0.9);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-booking-popup.active .floating-booking-content {
  transform: scale(1);
  opacity: 1;
}

.floating-booking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.floating-booking-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  margin: 0;
}

.floating-booking-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transition: all 0.2s ease;
}

.floating-booking-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.floating-booking-form-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

.floating-booking-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.floating-booking-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
}

.floating-booking-field label .material-symbols-outlined {
  font-size: 16px;
  color: #d4af37;
}

.floating-booking-field input,
.floating-booking-field select {
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 1rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  /* Dark glass style for better contrast */
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  transition: all 0.2s ease;
}

.floating-booking-field input:focus,
.floating-booking-field select:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  border-color: #d4af37;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

/* Fix date input icon color */
.floating-booking-field input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

/* Fix select dropdown arrow */
.floating-booking-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.floating-booking-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.floating-booking-submit {
  margin-top: 8px;
  height: 52px;
  font-size: 1rem;
}

/* Safe area for iPhone */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .floating-booking-content {
    margin-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .floating-booking-toggle {
    bottom: calc(168px + env(safe-area-inset-bottom));
  }
}

/* Hide on desktop */
@media (min-width: 768px) {
  .floating-booking-popup {
    display: none;
  }
}
