@import "tailwindcss";

@tailwind base;
@tailwind components;
@tailwind utilities;
@import "./animations.css";

@custom-variant dark (&:is(.dark *));

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-geist-sans);
  --font-mono: var(--font-geist-mono);
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);
  --color-chart-5: var(--chart-5);
  --color-chart-4: var(--chart-4);
  --color-chart-3: var(--chart-3);
  --color-chart-2: var(--chart-2);
  --color-chart-1: var(--chart-1);
  --color-ring: var(--ring);
  --color-input: var(--input);
  --color-border: var(--border);
  --color-destructive: var(--destructive);
  --color-accent-foreground: var(--accent-foreground);
  --color-accent: var(--accent);
  --color-muted-foreground: var(--muted-foreground);
  --color-muted: var(--muted);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary: var(--primary);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-card: var(--card);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
}

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 221.2 83.2% 53.3%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 221.2 83.2% 53.3%;
    --radius: 0.5rem;
  }

  .dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;
    --primary: 217.2 91.2% 59.8%;
    --primary-foreground: 222.2 47.4% 11.2%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 224.3 76.5% 48%;
  }
}

:root {
  --radius: 0.625rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.141 0.005 285.823);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.141 0.005 285.823);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.141 0.005 285.823);
  --primary: oklch(0.21 0.006 285.885);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.967 0.001 286.375);
  --secondary-foreground: oklch(0.21 0.006 285.885);
  --muted: oklch(0.967 0.001 286.375);
  --muted-foreground: oklch(0.552 0.016 285.938);
  --accent: oklch(0.967 0.001 286.375);
  --accent-foreground: oklch(0.21 0.006 285.885);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.92 0.004 286.32);
  --input: oklch(0.92 0.004 286.32);
  --ring: oklch(0.705 0.015 286.067);
  --chart-1: oklch(0.646 0.222 41.116);
  --chart-2: oklch(0.6 0.118 184.704);
  --chart-3: oklch(0.398 0.07 227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.141 0.005 285.823);
  --sidebar-primary: oklch(0.21 0.006 285.885);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.967 0.001 286.375);
  --sidebar-accent-foreground: oklch(0.21 0.006 285.885);
  --sidebar-border: oklch(0.92 0.004 286.32);
  --sidebar-ring: oklch(0.705 0.015 286.067);
}

.dark {
  --background: oklch(0.141 0.005 285.823);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.21 0.006 285.885);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.21 0.006 285.885);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.92 0.004 286.32);
  --primary-foreground: oklch(0.21 0.006 285.885);
  --secondary: oklch(0.274 0.006 286.033);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.274 0.006 286.033);
  --muted-foreground: oklch(0.705 0.015 286.067);
  --accent: oklch(0.274 0.006 286.033);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.552 0.016 285.938);
  --chart-1: oklch(0.488 0.243 264.376);
  --chart-2: oklch(0.696 0.17 162.48);
  --chart-3: oklch(0.769 0.188 70.08);
  --chart-4: oklch(0.627 0.265 303.9);
  --chart-5: oklch(0.645 0.246 16.439);
  --sidebar: oklch(0.21 0.006 285.885);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: oklch(0.488 0.243 264.376);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.274 0.006 286.033);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);
  --sidebar-ring: oklch(0.552 0.016 285.938);
}

@layer base {
  * {
    @apply border-border;
  }
  body {
    @apply bg-background text-foreground;
  }
}

/* Custom animation classes */
.scroll-top-button {
  animation: pulse 2s infinite;
}

.mobile-menu-item {
  animation: fadeIn 0.3s ease forwards;
}

.mobile-menu-item:nth-child(1) {
  animation-delay: 0.05s;
}
.mobile-menu-item:nth-child(2) {
  animation-delay: 0.1s;
}
.mobile-menu-item:nth-child(3) {
  animation-delay: 0.15s;
}
.mobile-menu-item:nth-child(4) {
  animation-delay: 0.2s;
}
@keyframes slide {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.animate-slide {
  animation: slide 40s linear infinite;
  display: flex;
  width: max-content;
}

/* Optional: Pause animation on hover */
.animate-slide:hover {
  animation-play-state: paused;
}

/* For smoother performance */
.animate-slide * {
  will-change: transform;
}
/* Add smooth transitions */
* {
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Custom animation for progress bar */
@keyframes slideProgress {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.animate-slide-progress {
  animation: slideProgress 5s linear infinite;
}

/* Pause animation on hover */
.pause-animation {
  animation-play-state: paused;
}

/* ---- Homepage dynamic features ---- */

.filter-pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 0.5rem 1.125rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid #d1d5db;
  color: #374151;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill:hover {
  border-color: #16a34a;
  color: #16a34a;
}

.filter-pill.is-active {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.trending-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  line-height: 1;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, #f97316, #ef4444);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.social-toast {
  position: fixed;
  left: 1.5rem;
  bottom: 6rem;
  z-index: 40;
  width: min(320px, calc(100vw - 3rem));
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(140%);
  opacity: 0;
  transition: transform 0.5s ease, opacity 0.5s ease;
  pointer-events: none;
}

.social-toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.social-toast-dot {
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
}

.plan-trip-fab {
  position: fixed;
  right: 1.5rem;
  bottom: 6rem;
  z-index: 45;
}

/* Keep shared page primitives inside the viewport on narrow screens. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

img,
svg,
video,
iframe,
embed,
object {
  max-width: 100%;
}

input,
select,
textarea,
button {
  max-width: 100%;
}

pre,
code {
  overflow-wrap: anywhere;
}

.admin-shell,
.admin-main,
.admin-content {
  min-width: 0;
}

.admin-sidebar {
  flex: 0 0 16rem;
}

.admin-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.375rem;
  color: #374151;
  font-size: 1.25rem;
  line-height: 1;
}

.admin-menu-toggle:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 2px;
}

.admin-content table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
}

.admin-content form,
.admin-content section,
.admin-content article {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 767px) {
  .admin-shell {
    position: relative;
  }

  .admin-menu-toggle {
    display: inline-flex;
  }

  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    width: min(16rem, calc(100vw - 2.5rem));
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 0.75rem 0 2rem rgba(0, 0, 0, 0.2);
  }

  .admin-menu-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-main {
    width: 100%;
  }

  .admin-topbar {
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }

  .admin-topbar h2 {
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
    font-size: 0.875rem;
    line-height: 1.25;
  }

  .admin-topbar form {
    flex: 0 0 auto;
  }

  .admin-content {
    padding: 1rem;
  }

  .admin-content .grid {
    min-width: 0;
  }

  .social-toast {
    left: 1rem;
    bottom: 5.5rem;
  }

  .plan-trip-fab {
    right: 1rem;
    bottom: 5.5rem;
  }
}

/* ---- Tour detail: display typography ---- */

.font-display {
  font-family: 'Fraunces', ui-serif, Georgia, serif;
  font-optical-sizing: auto;
}
