/* ============================================================
   HotelRadar — animations.css  v3.0 (PERFORMANCE EDITION)
   Goal: Silky 60fps scroll + beautiful UI fixes
   Strategy: GPU-only animations, kill backdrop-blur lag,
   fix auth modal, fix stay-type double display,
   remove direct call, keep scroll butter-smooth.
   ============================================================ */

/* ══════════════════════════════════════════════════════════════
   SECTION 1 — KILL SCROLL LAG (most important)
   backdrop-blur is the #1 cause of scroll lag on mobile.
   We replace it with a solid semi-transparent bg instead.
   ══════════════════════════════════════════════════════════════ */

/* Kill ALL backdrop-blur — replace with solid bg for performance */
.backdrop-blur-xs,
.backdrop-blur-sm,
.backdrop-blur-md,
[class*="backdrop-blur"] {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* Compensate — give overlays a solid semi-transparent bg instead */
.backdrop-blur-xs { background-color: rgba(0,0,0,0.55) !important; }
.backdrop-blur-sm { background-color: rgba(0,0,0,0.62) !important; }
.backdrop-blur-md { background-color: rgba(0,0,0,0.68) !important; }

/* For nav pills / card buttons that used backdrop-blur-md */
[class*="backdrop-blur-md"][class*="bg-black"] {
  background-color: rgba(0,0,0,0.72) !important;
}
[class*="backdrop-blur-xs"][class*="bg-black"] {
  background-color: rgba(0,0,0,0.58) !important;
}

/* GPU-accelerate the main scroll container */
html {
  scroll-behavior: smooth;
}
body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
  /* Prevent layout recalculation on scroll */
  isolation: isolate;
}

/* GPU promote key layers so scroll doesn't cause repaints */
header,
[class*="sticky top-0"] {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Contain hotel card grid to prevent full-page repaints */
[class*="grid-cols-1"][class*="gap-6"],
[class*="grid-cols-1"][class*="gap-4"] {
  contain: layout;
}

/* Each card: promote to its own compositor layer */
[class*="group relative flex flex-col overflow-hidden"] {
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* Virtual scrolling hint */
  content-visibility: auto;
  contain-intrinsic-size: 0 360px;
}

/* Scrollable row containers */
[class*="overflow-x-auto"],
[class*="no-scrollbar"] {
  -webkit-overflow-scrolling: touch;
  will-change: scroll-position;
}

/* ══════════════════════════════════════════════════════════════
   SECTION 2 — LOAD FLASH FIX
   Make animate-fade-in nearly instant so no blank flash
   ══════════════════════════════════════════════════════════════ */
.animate-fade-in {
  animation-duration: 0.12s !important;
  animation-delay: 0s !important;
}

/* ══════════════════════════════════════════════════════════════
   SECTION 3 — AUTH MODAL (Login / Signup) REDESIGN
   Target: .fixed.inset-0.z-[60] and its child panel
   ══════════════════════════════════════════════════════════════ */

/* Overlay */
.fixed.inset-0.z-\[60\] {
  background: rgba(15,14,20,0.75) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Modal panel */
.fixed.inset-0.z-\[60\] > .relative.w-full.max-w-sm {
  background: var(--card) !important;
  border-radius: 24px !important;
  border: 1px solid var(--line) !important;
  box-shadow:
    0 0 0 1px rgba(232,99,28,0.08),
    0 24px 64px rgba(0,0,0,0.22),
    0 8px 24px rgba(0,0,0,0.12) !important;
  animation: hr-modalIn 0.28s cubic-bezier(0.16,1,0.3,1) forwards !important;
  overflow: hidden;
  max-height: 92vh;
  overflow-y: auto;
}

@keyframes hr-modalIn {
  from {
    opacity: 0;
    transform: scale(0.93) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Auth header section */
.fixed.inset-0.z-\[60\] [class*="px-5 pt-5 pb-4 border-b"] {
  background: linear-gradient(to bottom, var(--accent-dim), var(--card)) !important;
  padding: 24px 24px 18px !important;
}

/* Auth title */
.fixed.inset-0.z-\[60\] h2[class*="font-serif"] {
  font-size: 1.25rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.01em !important;
  color: var(--ink) !important;
}

/* Auth subtitle */
.fixed.inset-0.z-\[60\] p[class*="text-\\[11px\\]"] {
  color: var(--ink-soft) !important;
  margin-top: 3px !important;
}

/* Google button — prominent */
.fixed.inset-0.z-\[60\] [class*="py-2.5"][class*="bg-\\[var\\(--card\\)\\]"][class*="border"] {
  border: 1.5px solid var(--line) !important;
  border-radius: 12px !important;
  padding: 12px !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
}
.fixed.inset-0.z-\[60\] [class*="py-2.5"][class*="bg-\\[var\\(--card\\)\\]"][class*="border"]:hover {
  background: var(--paper-dim) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1) !important;
  transform: translateY(-1px) !important;
}

/* Tab switcher (Login / Register) */
.fixed.inset-0.z-\[60\] [class*="flex bg-\\[var\\(--paper-dim\\)\\] rounded"] {
  border-radius: 12px !important;
  padding: 4px !important;
  background: var(--paper-dim) !important;
  border: 1px solid var(--line) !important;
}
.fixed.inset-0.z-\[60\] [class*="flex-1 py-1.5 text-xs font-bold rounded"] {
  border-radius: 8px !important;
  padding: 8px 12px !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s !important;
}
/* Active tab */
.fixed.inset-0.z-\[60\] .bg-\[var\(--card\)\].text-\[var\(--ink\)\].shadow-\[var\(--sh-1\)\] {
  background: var(--accent) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(232,99,28,0.35) !important;
}

/* Input fields — NO padding override! Icons use pl-9/pl-10 Tailwind classes.
   Overriding padding breaks icon alignment (icon overlaps text). */
.fixed.inset-0.z-\[60\] input[type="email"],
.fixed.inset-0.z-\[60\] input[type="password"],
.fixed.inset-0.z-\[60\] input[type="text"] {
  border-radius: 10px !important;
  border: 1.5px solid var(--line) !important;
  background: var(--paper-dim) !important;
  /* padding intentionally NOT set — Tailwind pl-9/pl-10 handles icon spacing */
  font-size: 14px !important;
  transition: border-color 0.15s, box-shadow 0.15s !important;
}
.fixed.inset-0.z-\[60\] input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(232,99,28,0.12) !important;
  outline: none !important;
}

/* Submit / Login / Register button */
.fixed.inset-0.z-\[60\] [class*="py-2.5 bg-\\[var\\(--accent\\)\\]"] {
  padding: 13px !important;
  border-radius: 12px !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 85%, #f97316)) !important;
  box-shadow: 0 4px 14px rgba(232,99,28,0.4) !important;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.1s !important;
}
.fixed.inset-0.z-\[60\] [class*="py-2.5 bg-\\[var\\(--accent\\)\\]"]:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 22px rgba(232,99,28,0.5) !important;
}

/* Error box */
.fixed.inset-0.z-\[60\] [class*="bg-red-50 border border-red-200"] {
  border-radius: 10px !important;
  padding: 10px 12px !important;
}

/* Close button */
.fixed.inset-0.z-\[60\] [class*="w-8 h-8"][class*="rounded-full"][class*="bg-\\[var\\(--paper-dim\\)\\]"] {
  transition: background 0.15s, transform 0.15s !important;
}
.fixed.inset-0.z-\[60\] [class*="w-8 h-8"][class*="rounded-full"][class*="bg-\\[var\\(--paper-dim\\)\\]"]:hover {
  background: var(--line) !important;
  transform: scale(1.08) !important;
}

/* ══════════════════════════════════════════════════════════════
   SECTION 4 — HIDE DIRECT CALL BUTTON
   In compare modal — target the last row "Contact Desk Now"
   ══════════════════════════════════════════════════════════════ */
/* Hide "Call Direct" buttons everywhere */
a[href^="tel:"] { display: none !important; }

/* In compare table — hide the entire "Contact Desk Now" row */
table tr:last-child td button[class*="bg-\\[var\\(--accent\\)\\]"] {
  display: none !important;
}
table tr:last-child td {
  padding: 8px !important;
}

/* ══════════════════════════════════════════════════════════════
   SECTION 5 — HIDE DOUBLE "STAY NICHE" BADGE IN CARD
   ══════════════════════════════════════════════════════════════ */
/* Target the flex row containing "Stay Niche:" text in card body */
[class*="mb-2.5"][class*="flex"][class*="items-center"][class*="gap-1"] {
  display: none !important;
}

/* ══════════════════════════════════════════════════════════════
   SECTION 6 — CARD HOVER (CSS only, no JS tilt = no lag)
   ══════════════════════════════════════════════════════════════ */
[class*="group relative flex flex-col overflow-hidden"] {
  transition:
    box-shadow 0.22s ease,
    transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}
@media (hover: hover) {
  [class*="group relative flex flex-col overflow-hidden"]:hover {
    transform: translateY(-4px) translateZ(0) !important;
    box-shadow:
      0 14px 32px rgba(0,0,0,0.13),
      0 0 0 1px rgba(232,99,28,0.18) !important;
  }
}

/* Image zoom on hover — CSS only */
[class*="group relative flex flex-col"]:hover [class*="aspect-16\\/10"] {
  transform: scale(1.04);
  transition: transform 0.5s cubic-bezier(0.2,0.8,0.2,1);
}

/* ══════════════════════════════════════════════════════════════
   SECTION 7 — BUTTON ENHANCEMENTS
   ══════════════════════════════════════════════════════════════ */
/* All accent buttons */
[class*="bg-\\[var\\(--accent\\)\\]"]:not([disabled]):not(.fixed *) {
  transition: opacity 0.12s, transform 0.18s cubic-bezier(0.2,0.8,0.2,1), box-shadow 0.18s !important;
  box-shadow: 0 3px 10px rgba(232,99,28,0.28) !important;
}
@media (hover: hover) {
  [class*="bg-\\[var\\(--accent\\)\\]"]:not([disabled]):not(.fixed *):hover {
    box-shadow: 0 6px 18px rgba(232,99,28,0.42) !important;
    transform: translateY(-1px) translateZ(0) !important;
  }
}
[class*="bg-\\[var\\(--accent\\)\\]"]:not([disabled]):active {
  transform: scale(0.97) translateZ(0) !important;
}

/* ══════════════════════════════════════════════════════════════
   SECTION 8 — HERO SCAN LINE
   ══════════════════════════════════════════════════════════════ */
[class*="relative px-4 py-8"] {
  position: relative;
  overflow: hidden;
}
[class*="relative px-4 py-8"]::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: -2px;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
  box-shadow: 0 0 14px rgba(232,99,28,0.5);
  animation: hr-scan 9s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
  will-change: top;
}
@keyframes hr-scan {
  0%   { top: -2px; opacity: 0; }
  4%   { opacity: 0.8; }
  96%  { opacity: 0.8; }
  100% { top: 100%; opacity: 0; }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 9 — STAT ITEMS HOVER
   ══════════════════════════════════════════════════════════════ */
.stat-item-polish {
  transition: background 0.18s, transform 0.22s cubic-bezier(0.2,0.8,0.2,1) !important;
  cursor: default;
}
@media (hover: hover) {
  .stat-item-polish:hover {
    background: var(--accent-dim) !important;
    transform: translateY(-3px) scale(1.03) translateZ(0) !important;
  }
  .stat-item-polish:hover .stat-val-polish {
    transform: scale(1.1) !important;
  }
}
.stat-val-polish {
  transition: transform 0.22s ease !important;
}

/* ══════════════════════════════════════════════════════════════
   SECTION 10 — CHIP PILLS
   ══════════════════════════════════════════════════════════════ */
.chip-polish {
  transition: border-color 0.12s, background 0.12s, color 0.12s,
              transform 0.18s cubic-bezier(0.2,0.8,0.2,1) !important;
}
@media (hover: hover) {
  .chip-polish:hover { transform: translateY(-2px) translateZ(0) !important; }
}
.chip-polish:active { transform: scale(0.95) translateZ(0) !important; }

/* ══════════════════════════════════════════════════════════════
   SECTION 11 — CATEGORY ICONS
   ══════════════════════════════════════════════════════════════ */
.cat-icon-polish {
  transition: border-color 0.12s, background 0.12s,
              transform 0.22s cubic-bezier(0.2,0.8,0.2,1),
              box-shadow 0.18s !important;
}
@media (hover: hover) {
  .cat-icon-polish:hover {
    transform: translateY(-4px) scale(1.08) translateZ(0) !important;
    box-shadow: 0 8px 18px rgba(232,99,28,0.2) !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 12 — EYEBROW SHIMMER
   ══════════════════════════════════════════════════════════════ */
.eyebrow {
  position: relative;
  overflow: hidden;
}
.eyebrow::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
    transparent 30%, rgba(255,255,255,0.45) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: hr-shine 4.5s ease-in-out infinite 2s;
  pointer-events: none;
}
@keyframes hr-shine {
  0%,100% { background-position: -200% center; opacity: 0; }
  15%      { opacity: 1; }
  85%      { opacity: 0; }
  50%      { background-position: 200% center; }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 13 — SEARCH BOX FOCUS GLOW
   ══════════════════════════════════════════════════════════════ */
.search-box-polish {
  transition: box-shadow 0.18s, border-color 0.18s, transform 0.18s !important;
}
.search-box-polish:focus-within {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(232,99,28,0.14), var(--sh-3) !important;
  transform: translateY(-1px) !important;
}

/* ══════════════════════════════════════════════════════════════
   SECTION 14 — BOTTOM SHEET SHADOW
   ══════════════════════════════════════════════════════════════ */
.bottom-sheet {
  box-shadow: 0 -6px 32px rgba(0,0,0,0.16) !important;
}

/* ══════════════════════════════════════════════════════════════
   SECTION 15 — NAVBAR SCROLL SHADOW (via JS class toggle)
   ══════════════════════════════════════════════════════════════ */
header.hr-scrolled {
  box-shadow: 0 2px 20px rgba(232,99,28,0.1), 0 1px 0 var(--line) !important;
}

/* ══════════════════════════════════════════════════════════════
   SECTION 16 — NIGHT / EMERALD / INDIGO THEME ADJUSTMENTS
   ══════════════════════════════════════════════════════════════ */
html[data-theme="night"] .fixed.inset-0.z-\[60\] > .relative.w-full.max-w-sm {
  box-shadow:
    0 0 0 1px rgba(255,122,61,0.12),
    0 24px 64px rgba(0,0,0,0.5) !important;
}
html[data-theme="night"] [class*="bg-\\[var\\(--accent\\)\\]"]:not([disabled]) {
  box-shadow: 0 3px 10px rgba(255,122,61,0.32) !important;
}
html[data-theme="emerald"] [class*="bg-\\[var\\(--accent\\)\\]"]:not([disabled]) {
  box-shadow: 0 3px 10px rgba(13,122,74,0.32) !important;
}
html[data-theme="indigo"] [class*="bg-\\[var\\(--accent\\)\\]"]:not([disabled]) {
  box-shadow: 0 3px 10px rgba(79,70,229,0.32) !important;
}

/* ══════════════════════════════════════════════════════════════
   SECTION 17 — REDUCED MOTION RESPECT
   ══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 18 — HOME PAGE STICKY SEARCH BAR
   When home page search bar scrolls off screen,
   show a compact search bar in the nav area.
   ══════════════════════════════════════════════════════════════ */

/* Floating sticky search pill — hidden by default */
#hr-sticky-search {
  position: fixed;
  top: 60px; /* just below the 56px header */
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 45;
  width: calc(100% - 32px);
  max-width: 480px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Visible state — added by JS */
#hr-sticky-search.hr-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* The pill button inside */
#hr-sticky-search-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.12),
    0 1px 4px rgba(0,0,0,0.06);
  cursor: pointer;
  text-align: left;
  transition: box-shadow 0.18s, border-color 0.18s, transform 0.15s;
}

#hr-sticky-search-btn:hover {
  border-color: var(--accent);
  box-shadow:
    0 6px 22px rgba(0,0,0,0.15),
    0 0 0 2px rgba(232,99,28,0.12);
  transform: scale(1.01);
}

#hr-sticky-search-btn:active {
  transform: scale(0.98);
}

.hr-sticky-icon {
  color: var(--ink-faint);
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.hr-sticky-text {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hr-sticky-kbd {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 8px;
  flex-shrink: 0;
}

/* Night theme */
html[data-theme="night"] #hr-sticky-search-btn {
  box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.2);
}
