import type { Metadata } from 'next'
import InternalPageTemplate from '@/components/InternalPageTemplate'
import BreadcrumbJsonLd from '@/components/BreadcrumbJsonLd'
import Link from 'next/link'
import { getTranslations } from 'next-intl/server'
import { buildAlternates } from '@/lib/seo'

export async function generateMetadata({
  params,
}: {
  params: Promise<{ locale: string }>
}): Promise<Metadata> {
  const { locale } = await params
  const t = await getTranslations('seo')
  const { canonical, languages } = buildAlternates(locale, '/guides/why-do-hotel-prices-change-by-location')
  return {
    title: t('guideWhyPricesChange'),
    description:
      "Hotel prices change depending on where you search from. Here's the full explanation of location-based pricing, how it works, and how to beat it.",
    openGraph: {
      title: 'Why Do Hotel Prices Change by Location?',
      description:
        "The same hotel room can cost 10–40% more depending on where in the world you search from. Here's a complete explanation.",
      type: 'article',
    },
    alternates: { canonical, languages },
  }
}

const articleSchema = {
  '@context': 'https://schema.org',
  '@type': 'Article',
  headline: 'Why Do Hotel Prices Change by Location? The Complete Explanation',
  description:
    "Hotel prices change depending on where you search from. Here's the full explanation of location-based pricing, how it works, and how to beat it.",
  author: { '@type': 'Organization', name: 'CahooTravel' },
  publisher: {
    '@type': 'Organization',
    name: 'CahooTravel',
    logo: { '@type': 'ImageObject', url: 'https://www.cahootravel.com/cahootravel-logo.svg' },
  },
  datePublished: '2025-01-20',
  dateModified: '2025-01-20',
  mainEntityOfPage: 'https://www.cahootravel.com/guides/why-do-hotel-prices-change-by-location',
}

export default function WhyHotelPricesChangeByLocation() {
  return (
    <InternalPageTemplate>
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{ __html: JSON.stringify(articleSchema) }}
      />

      <article className="max-w-3xl">
        {/* Header */}
        <div className="mb-10">
          <div className="flex items-center gap-3 mb-4">
            <span className="text-xs font-medium text-brand-purple bg-brand-purple-light px-2.5 py-1 rounded-full">
              Fundamentals
            </span>
            <span className="text-xs text-gray-400">6 min read</span>
          </div>
          <h1 className="text-4xl font-bold text-gray-900 mb-4 leading-tight">
            Why Do Hotel Prices Change by Location? The Complete Explanation
          </h1>
          <p className="text-gray-500 text-lg leading-relaxed">
            Open Booking.com on your phone while travelling abroad and you may notice prices that
            look different from what you saw at home. That&apos;s not a coincidence — hotel booking
            platforms deliberately show different prices to users depending on where they are
            searching from. Here&apos;s why.
          </p>
        </div>

        {/* Featured image */}
        <div className="mb-10 rounded-2xl overflow-hidden aspect-[16/7]">
          <img
            src="/guides/why-hotel-prices-change-by-location.jpg"
            alt="World map showing hotel price differences by country"
            className="w-full h-full object-cover"
          />
        </div>

        <div className="prose prose-gray max-w-none text-sm leading-relaxed space-y-8">

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">Location-based hotel pricing: the short answer</h2>
            <p className="text-gray-600">
              Booking platforms use your IP address, browser language, device locale, and payment
              method to determine which country you are in. They then show you a price that has been
              optimised for your market — which is almost always higher than the price shown to users
              in countries with lower purchasing power.
            </p>
            <p className="text-gray-600 mt-3">
              This practice is called geo-pricing or geographic price discrimination. It is legal,
              intentional, and extremely widespread. On major platforms like Booking.com, Airbnb, and
              Expedia, the same room on the same night routinely shows price differences of 15–40%
              between the cheapest and most expensive country markets.
            </p>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">
              The five reasons hotel prices change by location
            </h2>

            <h3 className="text-lg font-semibold text-gray-800 mb-2 mt-5">1. Purchasing power parity</h3>
            <p className="text-gray-600">
              The most significant driver. Booking platforms know that a traveller from Switzerland or
              Norway has, on average, a higher household income than one from Indonesia or Vietnam.
              Their algorithms price accordingly: charge what each market will bear.
            </p>
            <p className="text-gray-600 mt-2">
              This is the same logic airlines have used for decades with regional fares. A flight
              searched from London costs more than the same flight searched from Kuala Lumpur, even
              if both are long-haul international routes.
            </p>

            <h3 className="text-lg font-semibold text-gray-800 mb-2 mt-5">2. Local market competition</h3>
            <p className="text-gray-600">
              In markets where strong local alternatives exist — Ctrip in China, Jalan in Japan,
              MakeMyTrip in India — international platforms lower their prices to remain competitive.
              In markets where Booking.com or Expedia face little competition, prices are higher
              because users have fewer alternatives.
            </p>

            <h3 className="text-lg font-semibold text-gray-800 mb-2 mt-5">3. Country-specific promotions</h3>
            <p className="text-gray-600">
              Platforms run localised marketing campaigns that create real price differences. A 15%
              discount available only to users searching from South Korea is invisible to everyone
              else. These promotions cycle constantly, meaning the cheapest country can change week
              to week for a given hotel.
            </p>

            <h3 className="text-lg font-semibold text-gray-800 mb-2 mt-5">4. Currency and payment processing costs</h3>
            <p className="text-gray-600">
              Processing payments in certain markets costs more. Cards in some regions have higher
              interchange fees, fraud rates, or chargeback rates. Some of that cost gets factored
              into the displayed price.
            </p>

            <h3 className="text-lg font-semibold text-gray-800 mb-2 mt-5">5. Historical booking behaviour</h3>
            <p className="text-gray-600">
              Machine-learning systems track which user segments book at which price points without
              abandoning the process. If users from a particular country consistently complete
              bookings at higher prices, the algorithm learns to start higher for that segment.
            </p>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">
              How platforms detect your location
            </h2>
            <p className="text-gray-600">
              Geo-pricing works because platforms can identify your location with high reliability.
              They combine multiple signals:
            </p>
            <ul className="list-disc pl-5 space-y-2 text-gray-600 mt-3">
              <li>
                <strong>IP address</strong> — the primary signal. Identifies your country with
                near-perfect accuracy under normal conditions.
              </li>
              <li>
                <strong>Browser language and device locale</strong> — if your browser sends{' '}
                <code>Accept-Language: de-DE</code>, platforms treat you as a German user even
                when abroad.
              </li>
              <li>
                <strong>Account registration country</strong> — your Booking.com or Airbnb account
                history carries persistent location data.
              </li>
              <li>
                <strong>Payment card country</strong> — issuing bank country is visible at checkout
                and used as a fraud and segmentation signal.
              </li>
            </ul>
            <p className="text-gray-600 mt-3">
              Platforms combine these signals. A user with a German IP, German browser language, a
              German account, and a German Visa card will reliably see German-market prices — which
              are typically among the higher-priced markets in Europe.
            </p>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">
              How large are the price differences?
            </h2>
            <p className="text-gray-600">
              In practice, price gaps of 15–30% are common. Gaps above 40% occur for high-demand
              destination hotels, particularly in Southeast Asia and Japan, where platforms compete
              for local travellers with aggressive pricing that is invisible to visitors from
              high-purchasing-power countries.
            </p>
            <div className="bg-gray-50 rounded-xl border border-gray-100 overflow-hidden mt-4">
              <table className="w-full text-sm">
                <thead>
                  <tr className="bg-gray-100 text-left">
                    <th className="px-4 py-3 font-semibold text-gray-700">Destination</th>
                    <th className="px-4 py-3 font-semibold text-gray-700">Typical gap</th>
                    <th className="px-4 py-3 font-semibold text-gray-700">Cheapest market</th>
                  </tr>
                </thead>
                <tbody className="divide-y divide-gray-100">
                  <tr>
                    <td className="px-4 py-3 text-gray-600">Bangkok, Thailand</td>
                    <td className="px-4 py-3 text-gray-700">25–42%</td>
                    <td className="px-4 py-3 text-gray-500">Thailand / India</td>
                  </tr>
                  <tr>
                    <td className="px-4 py-3 text-gray-600">Tokyo, Japan</td>
                    <td className="px-4 py-3 text-gray-700">20–35%</td>
                    <td className="px-4 py-3 text-gray-500">Japan / South Korea</td>
                  </tr>
                  <tr>
                    <td className="px-4 py-3 text-gray-600">Barcelona, Spain</td>
                    <td className="px-4 py-3 text-gray-700">10–20%</td>
                    <td className="px-4 py-3 text-gray-500">Spain / Portugal</td>
                  </tr>
                  <tr>
                    <td className="px-4 py-3 text-gray-600">New York, USA</td>
                    <td className="px-4 py-3 text-gray-700">8–18%</td>
                    <td className="px-4 py-3 text-gray-500">Mexico / Brazil</td>
                  </tr>
                </tbody>
              </table>
            </div>
            <p className="text-gray-500 text-xs mt-2">
              Illustrative ranges based on typical observed gaps. Actual differences vary by hotel,
              platform, and booking date.
            </p>
          </section>

          <section>
            <h2 className="text-2xl font-bold text-gray-900 mb-3">
              What you can do about it
            </h2>
            <p className="text-gray-600">
              The straightforward solution is to compare the same hotel URL across multiple country
              contexts before booking. This is what CahooTravel does: it fetches the hotel page as
              it would appear to users in 100+ countries simultaneously, shows you the full price
              comparison, and lets you book directly at the cheapest rate.
            </p>
            <p className="text-gray-600 mt-3">
              Unlike VPN-based workarounds — which platforms actively detect and block — CahooTravel
              uses real browser sessions from actual country-based infrastructure. There are no
              mismatch signals, no fraud triggers, and no need to change your payment method or
              create foreign accounts.
            </p>
          </section>

          {/* CTA */}
          <div className="rounded-2xl bg-brand-purple text-white p-8 flex flex-col md:flex-row items-center justify-between gap-6 mt-4">
            <div>
              <h3 className="text-lg font-bold mb-1">See what your hotel actually costs</h3>
              <p className="text-purple-200 text-sm">
                Paste any hotel URL and compare prices across 100+ countries. Find the cheapest
                market in seconds — for free.
              </p>
            </div>
            <Link
              href="/"
              className="flex-shrink-0 bg-brand-yellow hover:bg-brand-yellow-dark text-gray-900 font-medium text-sm px-6 py-2.5 rounded-md transition-colors whitespace-nowrap"
            >
              Compare prices now →
            </Link>
          </div>
        </div>
      </article>

      <BreadcrumbJsonLd
        items={[
          { name: 'Guides', path: '/guides' },
          { name: 'Why Do Hotel Prices Change by Location?' },
        ]}
      />
    </InternalPageTemplate>
  )
}
