/* i18n — bilingual EN / AR with dir + font switching and {var} interpolation.
   t(key, vars) → looks up lang then English then the raw key, then interpolates. */
const LangContext = React.createContext();

const STRINGS = {
  en: {
    /* nav + brand */
    "nav.flights": "Flights", "nav.hotels": "Hotels", "nav.corporate": "Corporate Travel",
    "nav.about": "About", "nav.support": "Support", "nav.admin": "Admin",
    "nav.book": "Book a trip", "nav.cta": "Speak to an advisor",
    "nav.packages": "Tour Packages", "nav.home": "Home", "nav.trips": "My Trips",
    "brand.tag": "Corporate Travel, Elevated",
    "iata": "IATA Certified · Numeric Code 71240116 · Est. 2021",
    /* hero */
    "hero.eyebrow": "Riyadh · Jeddah · AlUla · Worldwide",
    "hero.title.1": "Travel that treats", "hero.title.2": "every trip like it matters.",
    "hero.sub": "Premium flight & hotel booking for Saudi Arabia's ministries, hospitals and enterprises — coordinated end to end, and watched over by Mr. Wing, your autonomous travel agent.",
    "hero.scroll": "Discover the journey",
    "hero.chip.iata": "IATA Certified", "hero.chip.support": "24/7 Concierge", "hero.chip.vision": "Vision 2030 Partner",
    "hero.card.tag": "Live fare · held in seconds", "hero.card.route": "Riyadh → Jeddah", "hero.card.cabin": "Business · non-stop",
    "err.title": "Something went wrong", "err.body": "We hit an unexpected error. Reload to continue — your trips and cards are saved.", "err.reload": "Reload Thirdwing",
    "a11y.skip": "Skip to content",
    "footer.address": "Al Narjis District, Riyadh",
    "img.hero": "Aerial view of Saudi Arabia's Red Sea coast", "img.corp": "Riyadh business district at dusk", "img.about": "The Thirdwing team at the Riyadh headquarters",
    /* search */
    "search.flights": "Flights", "search.hotels": "Hotels", "search.packages": "Tour Packages",
    "search.from": "From", "search.to": "To", "search.depart": "Depart", "search.return": "Return",
    "search.travelers": "Travelers", "search.checkin": "Check-in", "search.checkout": "Check-out",
    "search.destination": "Destination", "search.guests": "Guests & Rooms",
    "search.cta": "Search Destinations", "search.oneway": "One way", "search.round": "Round trip",
    "search.adults": "Adults", "search.from.ph": "City or airport", "search.to.ph": "City or airport",
    "search.cityHotelPh": "City or hotel", "search.cabin": "Cabin",
    "search.guests1": "1 Guest · 1 Room", "search.guests2": "2 Guests · 1 Room", "search.guests4": "4 Guests · 2 Rooms",
    "search.travelersN": "{n} Travelers", "search.selectCity": "Select city",
    /* cabins */
    "cabin.any": "Any cabin", "cabin.economy": "Economy", "cabin.business": "Business",
    /* vision */
    "vision.eyebrow": "Experience Saudi · Vision 2030",
    "vision.title": "The Kingdom, opened to the world.",
    "vision.sub": "Curated domestic journeys aligned with Vision 2030 — from sandstone monoliths to mountain mist and old-city coral stone.",
    "vision.alula": "Elephant Rock, AlUla", "vision.alula.d": "A 52-metre arch carved by wind from red sandstone.",
    "vision.jeddah": "Historic Jeddah", "vision.jeddah.d": "Coral-stone facades and rawasheen of Al-Balad, a UNESCO site.",
    "vision.asir": "The Asir Mountains", "vision.asir.d": "Terraced peaks and cool mist above the southern highlands.",
    "vision.explore": "Explore tours",
    /* metrics */
    "m.revenue": "Annual Revenue", "m.sat": "Client Satisfaction", "m.projects": "Successful Projects",
    "m.eyebrow": "Operational strength",
    /* promise / hrcf */
    "promise.eyebrow": "Our Promise",
    "promise.title": "Treat every trip like it matters, because it does.",
    "hrcf.h": "Honesty", "hrcf.h.d": "Clear advice and transparent options — never an upsell you didn't ask for.",
    "hrcf.r": "Responsibility", "hrcf.r.d": "End-to-end ownership of the journey, from booking to safe return.",
    "hrcf.c": "Commitment", "hrcf.c.d": "Punctual delivery and consistent quality on every itinerary.",
    "hrcf.f": "Follow-up", "hrcf.f.d": "Proactive updates before, during and after travel.",
    /* mr wing */
    "wing.name": "Mr. Wing", "wing.role": "Autonomous Travel Agent",
    "wing.greeting": "Welcome to Thirdwing. I'm Mr. Wing. I can search flights and hotels, book with your saved card, or change a trip — all in a few words. How can I help you travel today?",
    "wing.placeholder": "Ask Mr. Wing… e.g. \"Find a Saudia flight to Jeddah tomorrow morning\"",
    "wing.confirm": "Confirm", "wing.cancel": "Cancel", "wing.thinking": "Mr. Wing is arranging…",
    "wing.escalate": "Escalate to Egypt Support Hub", "wing.online": "Online · replies instantly",
    "wing.confirmBooking": "Confirm booking", "wing.confirmCancel": "Confirm cancellation",
    "wing.confirmModify": "Confirm change", "wing.escalated": "Escalated to Egypt Support Hub",
    "wing.netError": "I'm having trouble reaching the booking network right now. Our Egypt hub can help on +966 55 240 8555.",
    "wing.bookedMsg": "All set. Your itinerary is {id} and a receipt is on its way. Ahlan wa sahlan — safe travels.",
    "wing.cancelledMsg": "Done — your booking is cancelled and the refund is on its way per supplier policy. Anything else I can arrange?",
    "wing.modifiedMsg": "Updated — your booking has been rescheduled and a fresh confirmation is on its way.",
    "wing.declinedMsg": "No problem, I won't proceed. Would you like me to look at other options?",
    "wing.refundToCard": "Refund to card", "wing.savedCard": "Saved card",
    "wing.escTitle": "Escalated to Egypt Support Hub", "wing.escBody": "A human agent will take over this VVIP request shortly.",
    "wing.localBadge": "Offline assistant", "wing.title": "{name}, the autonomous travel agent who never sleeps.",
    "wing.teaser.eyebrow": "Meet your agent",
    "wing.teaser.body": "Ask in plain language. Mr. Wing searches live flight and hotel inventory, books with your saved Tap profile in one click, and changes or cancels trips — always confirming with a visual summary first.",
    "wing.teaser.cta": "Chat with Mr. Wing",
    /* generic */
    "book.now": "Book Now", "view": "View", "select": "Select", "from.price": "from",
    "footer.rights": "All rights reserved.", "lang.toggle": "العربية",
    "common.modify": "Modify", "common.save": "Save", "common.show": "Show", "common.hide": "Hide",
    "common.back": "Back", "common.cancel": "Cancel", "common.continue": "Continue", "common.close": "Close",
    "common.perNight": "/ night", "common.nights": "nights", "common.night": "night", "common.total": "Total",
    "footer.col.book": "Book", "footer.col.company": "Company", "footer.col.legal": "Legal",
    "footer.cancelRefunds": "Cancellation & Refunds", "footer.privacy": "Privacy Policy", "footer.terms": "Terms of Service",
    /* flights results */
    "flights.refine": "Refine", "flights.sortBy": "Sort by",
    "flights.sort.price": "Lowest fare", "flights.sort.dep": "Earliest departure", "flights.sort.dur": "Shortest duration",
    "flights.nonstopOnly": "Non-stop only", "flights.cabin": "Cabin", "flights.airlines": "Airlines",
    "flights.nonstop": "Non-stop", "flights.stop": "{n} stop", "flights.corpRates": "Corporate rates applied",
    "flights.empty": "No flights match these filters.", "flights.modify": "Modify search",
    "flights.sub": "{depart} · {travelers} · {count} flights from global networks",
    "flights.perPerson": "per person", "flights.totalFor": "Total for {n}", "flights.onTime": "On-time {n}%",
    "flights.refundable": "Refundable per airline policy", "flights.priceRange": "Max fare",
    "flights.depTime": "Departure", "flights.anytime": "Any time", "flights.results": "{from} → {to}",
    "flights.aircraft": "Aircraft", "flights.baggage": "Baggage", "flights.fareType": "Fare",
    "flights.baggage.business": "2 × 32kg + cabin", "flights.baggage.economy": "1 × 23kg + cabin",
    "flights.fare.flex": "Flex · refundable", "flights.fare.saver": "Saver · part-refundable",
    "pkg.inc.transfers": "Flights + transfers", "pkg.inc.stays": "Boutique stays", "pkg.inc.support": "24/7 Mr. Wing support",
    /* hotels */
    "hotels.title": "Hotels in {city}", "hotels.sub": "{dates} · {count} properties with exclusive corporate rates",
    "hotels.corpRate": "Corporate rate", "hotels.reviews": "{count} reviews", "hotels.perNight": "/ night",
    "hotels.sort.rec": "Recommended", "hotels.sort.price": "Lowest rate", "hotels.sort.rating": "Top rated",
    "hotels.modify": "Modify", "hotels.empty": "No hotels match these filters.", "hotels.filters": "Refine",
    "hotels.minRating": "Minimum rating", "hotels.maxRate": "Max nightly rate", "hotels.nightsAt": "{nights} nights from",
    /* packages */
    "pkg.includes": "{nights} nights · flights + hotel + curated guide", "pkg.highlights": "Trip highlights",
    "pkg.detailCta": "View itinerary", "pkg.book": "Book this package",
    /* booking */
    "booking.secured": "Secured by Tap Payments · PCI-DSS tokenized",
    "booking.empty": "No booking in progress.", "booking.searchFlights": "Search flights",
    "booking.back": "Back to results",
    "booking.step.details": "Traveler details", "booking.step.pay": "Payment", "booking.step.done": "Confirmed",
    "booking.details.sub": "Booked under your corporate account · policy compliant.",
    "booking.f.name": "Full name", "booking.f.org": "Organization", "booking.f.email": "Email", "booking.f.phone": "Phone",
    "booking.ph.name": "As on passport / ID", "booking.ph.org": "Ministry / company", "booking.ph.email": "name@org.gov.sa", "booking.ph.phone": "+966 5X XXX XXXX",
    "booking.policyOk": "Corporate policy check passed.", "booking.policyDetail": "This fare is within your travel policy. Approver: auto-cleared.",
    "booking.continue": "Continue to payment",
    "booking.pay.sub": "Tailored for the Saudi & GCC market.",
    "booking.pay.saved": "Saved cards", "booking.pay.new": "New card", "booking.pay.apple": "Apple Pay",
    "booking.primary": "Primary", "booking.oneClick": "1-click — token re-used by Mr. Wing",
    "booking.f.cardNo": "Card number", "booking.f.exp": "Expiry", "booking.f.cvv": "CVV", "booking.f.cardName": "Name on card",
    "booking.ph.cardName": "Cardholder name", "booking.saveCard": "Save card securely (tokenized) for 1-click re-booking by Mr. Wing",
    "booking.apple.desc": "Confirm with Face ID on your device to complete via Apple Pay.",
    "booking.processing": "Processing securely…", "booking.pay": "Pay",
    "booking.confirmed": "Booking confirmed",
    "booking.confirmed.sub": "Itinerary {id} · a receipt is on its way to your email.",
    "booking.toDashboard": "View in dashboard", "booking.toTrips": "View my trips", "booking.toHome": "Back to home",
    "booking.summary": "Trip summary", "booking.baseFare": "Base fare", "booking.serviceFee": "Service fee",
    "booking.vat": "VAT (15%)", "booking.total": "Total", "booking.travelersN": "{n} travelers",
    "booking.paidWith": "Paid with", "booking.ref": "Payment reference", "booking.receipt": "Download receipt",
    /* payment errors */
    "pay.err.number": "Enter a valid card number.", "pay.err.exp": "Enter a valid, unexpired expiry date.",
    "pay.err.cvv": "Enter a valid security code.", "pay.err.name": "Enter the name on the card.",
    "pay.err.email": "Enter a valid email address.", "pay.err.requiredName": "Enter the traveler's name.",
    "pay.err.noCard": "Select a saved card or add a new one.",
    "pay.apple.unavailable": "Apple Pay isn't available in this browser. Use a saved or new card.",
    /* corporate */
    "corp.eyebrow": "Corporate Travel Management", "corp.title": "Travel programs for the Kingdom's institutions.",
    "corp.sub": "For ministries, hospitals and corporate accounts that demand control, savings and reliability — managed end to end by Thirdwing.",
    "corp.cta": "Set up a corporate account",
    "corp.seg.gov": "Government Ministries", "corp.seg.gov.d": "Protocol-grade coordination, policy enforcement and audit-ready reporting for public sector travel.",
    "corp.seg.health": "Hospitals & Health", "corp.seg.health.d": "Priority medical travel, conference logistics and 24/7 rebooking for clinical teams.",
    "corp.seg.ent": "Enterprise Accounts", "corp.seg.ent.d": "Negotiated corporate rates, spend dashboards and dedicated account management.",
    "corp.why": "Why Thirdwing", "corp.whyTitle": "Control, savings and reliability — by design.",
    "corp.f.policy": "Strict policy implementation", "corp.f.policy.d": "Cabin classes, fare caps and approval chains enforced automatically at booking.",
    "corp.f.rates": "Exclusive negotiated rates", "corp.f.rates.d": "Corporate flight and hotel rates unlocked across global and domestic suppliers.",
    "corp.f.report": "Reliable reporting", "corp.f.report.d": "Real-time spend, savings and compliance reporting exported to finance.",
    "corp.f.wing": "Mr. Wing for teams", "corp.f.wing.d": "Your travelers self-serve in chat — within the policy you define.",
    "corp.form.title": "Set up a dedicated account", "corp.form.sub": "Tell us about your organization and an account director will respond within one business day.",
    "corp.form.b1": "Dedicated account director", "corp.form.b2": "Custom policy & approval flows", "corp.form.b3": "Consolidated invoicing & VAT", "corp.form.b4": "24/7 support via Egypt hub",
    "corp.f.organization": "Organization", "corp.f.contact": "Contact name", "corp.f.sector": "Sector",
    "corp.f.workEmail": "Work email", "corp.f.trips": "Annual trips", "corp.f.notes": "Notes",
    "corp.sector.gov": "Government", "corp.sector.health": "Healthcare", "corp.sector.ent": "Enterprise",
    "corp.ph.org": "Ministry / hospital / company", "corp.ph.notes": "Tell us about your travel needs…",
    "corp.form.submit": "Submit inquiry", "corp.form.received": "Request received",
    "corp.form.thanks": "Our team will reach out shortly.",
    /* about */
    "about.heroSub": "An IATA-certified Saudi travel agency established in 2021, Thirdwing pairs the warmth of native hospitality with the precision of a modern booking engine.",
    "about.fw": "The HRC-F Framework", "about.fwTitle": "Four promises on every itinerary.",
    "about.fwSub": "Not a slogan — an operating standard that governs how we plan, book and follow through.",
    "about.est": "Est. 2021 · Riyadh", "about.storyTitle": "Native warmth, global reach.",
    "about.story": "From our Riyadh headquarters we coordinate travel for the Kingdom's most demanding institutions, backed around the clock by our Egypt support hub.",
    /* support */
    "support.eyebrow": "24/7 Support & Contact", "support.title": "One network. Always awake.",
    "support.sub": "Our Riyadh headquarters lead coordination while our Egypt hub delivers round-the-clock ticketing and supplier follow-up.",
    "support.egyptTeam": "Egypt Support Team", "support.egyptDesc": "24/7 ticketing · vendor follow-up",
    "support.riyadhHQ": "Riyadh Headquarters", "support.riyadhDesc": "Primary coordination",
    "support.hq": "Riyadh HQ", "support.hqAddr": "Abu Bakr Al-Siddiq Street, Al Narjis District, Riyadh.",
    "support.call": "Call us", "support.email": "Email",
    "support.sendTitle": "Send us a message", "support.sendSub": "For VVIP and government enquiries, our team responds within the hour.",
    "support.f.name": "Name", "support.f.phone": "Phone", "support.f.email": "Email", "support.f.help": "How can we help?",
    "support.send": "Send message", "support.sent": "Message sent — a representative will reply shortly.",
    "support.instant": "Prefer instant help?", "support.instantSub": "Mr. Wing answers in seconds and escalates VVIP requests straight to our Egypt hub.",
    "support.chatWing": "Chat with Mr. Wing",
    /* legal */
    "legal.eyebrow": "Legal & Policies", "legal.title": "Clear terms, fairly applied.",
    "legal.tab.cancellation": "Cancellation & Refunds", "legal.tab.privacy": "Privacy Policy", "legal.tab.terms": "Terms of Service",
    "legal.updated": "Updated June 2026",
    /* admin */
    "admin.center": "Admin Control Center", "admin.overview": "Operations Overview",
    "admin.ok": "All systems operational",
    "admin.tab.dashboard": "Dashboard", "admin.tab.bookings": "Bookings", "admin.tab.transcripts": "Mr. Wing Chats",
    "admin.tab.api": "API Management", "admin.tab.leads": "Leads & Inquiries",
    "admin.stat.active": "Active bookings", "admin.stat.revenue": "Revenue (30d)", "admin.stat.wing": "Mr. Wing bookings", "admin.stat.sat": "Client satisfaction",
    "admin.week": "Bookings this week", "admin.flightsHotels": "Flights + Hotels",
    "admin.channelMix": "Channel mix", "admin.ch.wing": "Mr. Wing (AI)", "admin.ch.web": "Web direct", "admin.ch.egypt": "Egypt hub",
    "admin.aiDrives": "AI now drives the majority of bookings.",
    "admin.recent": "Recent bookings", "admin.all": "All bookings", "admin.totalN": "{n} total",
    "admin.col.itinerary": "Itinerary", "admin.col.trip": "Trip", "admin.col.client": "Client", "admin.col.channel": "Channel", "admin.col.amount": "Amount", "admin.col.status": "Status", "admin.col.date": "Date", "admin.col.contact": "Contact", "admin.col.type": "Type",
    "admin.transcripts.empty": "No Mr. Wing conversations yet.", "admin.leads.empty": "No leads yet. Submitted inquiries and messages will appear here.",
    "admin.leads.inquiry": "Corporate inquiry", "admin.leads.message": "Support message", "admin.outcome": "Outcome",
    "admin.viewConvo": "View conversation",
    /* api management */
    "api.connected": "Connected", "api.notConnected": "Not connected", "api.rotate": "Rotate key", "api.add": "Add key",
    "api.model": "Model", "api.modelSaved": "Model saved", "api.plug": "Plug-and-play, no code",
    "api.plugDesc": "Paste keys for your payment gateway, flight GDS, hotel suppliers and AI model. Changes take effect instantly — the website code is never touched.",
    "api.security": "Security",
    "api.sec1": "Keys stored locally in your browser, masked after saving", "api.sec2": "Scoped per environment (Live / Test)",
    "api.sec3": "Mr. Wing model & key configurable here", "api.sec4": "Full audit log of rotations",
    "api.liveBadge": "Mr. Wing is live on your key", "api.localBadge": "Mr. Wing runs on the built-in assistant",
    /* status pills */
    "status.Confirmed": "Confirmed", "status.Cancelled": "Cancelled", "status.Escalated": "Escalated",
    "status.New": "New", "status.Contacted": "Contacted", "status.Closed": "Closed", "status.Modified": "Rescheduled",
    /* trips */
    "trips.title": "My Trips", "trips.sub": "Manage your itineraries — view, reschedule or cancel.",
    "trips.empty": "No trips yet. Search flights or hotels to get started.", "trips.browse": "Search flights",
    "trips.cancel": "Cancel trip", "trips.modify": "Reschedule", "trips.details": "Details",
    "trips.detail.id": "Itinerary number", "trips.detail.type": "Booking type",
    "trips.detail.date": "Travel date", "trips.detail.amount": "Amount",
    "trips.detail.status": "Status", "trips.detail.channel": "Channel",
    "trips.detail.note": "Note", "trips.detail.refunded": "Refunded",
    "trips.refunded": "Refunded {amount}", "trips.confirmCancel": "Cancel this trip?",
    "trips.confirmCancelBody": "You'll be refunded about {amount} per supplier policy. This can't be undone.",
    "trips.keepIt": "Keep trip", "trips.newDate": "New date", "trips.save": "Save change",
    "trips.upcoming": "Upcoming", "trips.past": "Past & cancelled", "trips.booked": "Booked {when}",
    "detail.continue": "Continue to booking",
    /* leads */
    "leads.ref": "Reference", "leads.required": "This field is required", "leads.email": "Enter a valid email address",
    "filters.show": "Show {n} results",
    /* AI provider (Mr. Wing) */
    "api.ai.provider": "Provider", "api.ai.baseUrl": "API base URL", "api.ai.key": "API key",
    "api.ai.connect": "Connect & fetch models", "api.ai.connecting": "Connecting…",
    "api.ai.model": "Model", "api.ai.selectModel": "No model selected yet", "api.ai.modelsFound": "{n} models available",
    "api.ai.save": "Save provider", "api.ai.change": "Change model", "api.ai.reconfigure": "Change key / provider",
    "api.ai.filter": "Filter models…", "api.ai.envManaged": "Configured via environment variable.",
    "api.ai.hint": "Works with OpenAI, OpenRouter, Groq, Together, Mistral, DeepSeek, Anthropic, or any OpenAI-compatible endpoint.",
    "api.ai.localHint": "Static mode: the browser tries the provider directly (CORS permitting); deploy the backend for a secure server-side proxy.",
    "api.ai.err.needKey": "Enter your API key first.", "api.ai.err.needToken": "Enter the admin token on the right first.",
    "api.ai.err.adminNeeded": "Set ADMIN_TOKEN in Vercel to manage the provider from the panel (or use env vars).",
    "api.ai.err.unauthorized": "Admin token is incorrect.", "api.ai.err.unsafeUrl": "Base URL must be a public https endpoint.",
    "api.ai.err.kv": "Add a Supabase database or Vercel KV store to save from the panel (or use env vars).",
    "api.ai.err.connect": "Couldn't reach the provider — check the base URL and key.",
    "api.ai.err.noModels": "Connected, but no models were returned. Check the key's permissions or the base URL.",
    "api.ai.err.save": "Couldn't save the provider. Try again.",
    /* toasts */
    "notice.paid": "Payment confirmed — your itinerary is booked.",
    "notice.payFailed": "We couldn't confirm your payment, so nothing was charged. Please try again or contact our 24/7 team.",
    "notice.cancelled": "Trip cancelled — about {amount} will be refunded per supplier policy.",
    /* 404 */
    "nf.title": "Page not found", "nf.sub": "The page you're looking for doesn't exist or may have moved.", "nf.home": "Back to home",
    /* flights plural + payment */
    "flights.stops": "{n} stops", "pay.err.declined": "Payment declined. Please check your card details or try another method.",
    /* trips */
    "trips.err.pastDate": "Choose a future date.",
    /* legal extras */
    "legal.tab.cookies": "Cookie & Storage Policy", "legal.tab.accessibility": "Accessibility",
    "footer.cookies": "Cookie & Storage Policy", "footer.accessibility": "Accessibility",
    "nav.signin": "Sign in", "nav.signup": "Create account", "nav.profile": "Profile", "nav.account": "My account", "nav.signout": "Sign out",
    "auth.welcome": "Welcome back", "auth.signinSub": "Sign in to manage your trips, cards and travel preferences.",
    "auth.createTitle": "Create your account", "auth.createSub": "Save travelers, cards and trips for faster, policy-compliant booking.",
    "auth.name": "Full name", "auth.email": "Work email", "auth.password": "Password", "auth.confirm": "Confirm password",
    "auth.signinBtn": "Sign in", "auth.signupBtn": "Create account",
    "auth.toSignup": "New to Thirdwing? Create an account", "auth.toSignin": "Already have an account? Sign in",
    "auth.pwHint": "At least 6 characters",
    "auth.err.email_invalid": "Enter a valid email address.", "auth.err.name_required": "Enter your full name.",
    "auth.err.password_weak": "Password must be at least 6 characters.", "auth.err.email_taken": "An account with this email already exists.",
    "auth.err.no_account": "No account found for this email.", "auth.err.wrong_password": "Incorrect password.", "auth.err.password_mismatch": "Passwords don't match.",
    "auth.b1": "1-click booking with saved cards", "auth.b2": "All your trips in one place", "auth.b3": "Policy-compliant corporate travel", "auth.b4": "Mr. Wing remembers your preferences",
    "profile.greeting": "Hello, {name}", "profile.member": "Member since {date}",
    "profile.personal": "Personal information", "profile.travel": "Travel preferences", "profile.cards": "Saved payment cards", "profile.security": "Security",
    "profile.f.org": "Organization", "profile.f.phone": "Phone", "profile.f.country": "Country", "profile.f.homeAirport": "Home airport", "profile.f.prefCabin": "Preferred cabin", "profile.f.newsletter": "Email me travel offers & updates",
    "profile.save": "Save changes", "profile.saved": "Saved",
    "profile.changePw": "Change password", "profile.currentPw": "Current password", "profile.newPw": "New password", "profile.pwChanged": "Password updated",
    "profile.signout": "Sign out", "profile.delete": "Delete account", "profile.deleteConfirm": "Delete your account? Your saved profile and cards on this device will be removed.",
    "profile.addCard": "Add a card", "profile.makePrimary": "Make primary", "profile.remove": "Remove", "profile.noCards": "No saved cards yet.", "profile.viewTrips": "View my trips",
    "country.SA": "Saudi Arabia", "country.AE": "United Arab Emirates", "country.EG": "Egypt", "country.QA": "Qatar", "country.KW": "Kuwait", "country.BH": "Bahrain", "country.OM": "Oman", "country.other": "Other",
  },
  ar: {
    "nav.flights": "الطيران", "nav.hotels": "الفنادق", "nav.corporate": "سفر الشركات",
    "nav.about": "من نحن", "nav.support": "الدعم", "nav.admin": "الإدارة",
    "nav.book": "احجز رحلة", "nav.cta": "تحدث مع مستشار",
    "nav.packages": "الباقات السياحية", "nav.home": "الرئيسية", "nav.trips": "رحلاتي",
    "brand.tag": "سفر الشركات، بمستوى أرقى",
    "iata": "وكالة معتمدة من الإياتا · الرمز 71240116 · تأسست 2021",
    "hero.eyebrow": "الرياض · جدة · العُلا · حول العالم",
    "hero.title.1": "سفرٌ يعامل", "hero.title.2": "كل رحلة كأنها تهمّ.",
    "hero.sub": "حجز رحلات وفنادق فاخر لوزارات المملكة ومستشفياتها ومؤسساتها — منسّق من البداية إلى النهاية، تحت رعاية «مستر وينغ»، وكيل السفر الذكي.",
    "hero.scroll": "اكتشف الرحلة",
    "hero.chip.iata": "معتمدة من الإياتا", "hero.chip.support": "خدمة على مدار الساعة", "hero.chip.vision": "شريك رؤية 2030",
    "hero.card.tag": "سعر مباشر · يُحجز خلال ثوانٍ", "hero.card.route": "الرياض ← جدة", "hero.card.cabin": "رجال الأعمال · مباشرة",
    "err.title": "حدث خطأ ما", "err.body": "واجهنا خطأً غير متوقع. أعد التحميل للمتابعة — رحلاتك وبطاقاتك محفوظة.", "err.reload": "إعادة تحميل ثيردوينغ",
    "a11y.skip": "تخطَّ إلى المحتوى",
    "footer.address": "حي النرجس، الرياض",
    "img.hero": "منظر جوي لساحل البحر الأحمر السعودي", "img.corp": "حي الأعمال في الرياض عند الغروب", "img.about": "فريق ثيردوينغ في المقر الرئيسي بالرياض",
    "search.flights": "الطيران", "search.hotels": "الفنادق", "search.packages": "الباقات السياحية",
    "search.from": "من", "search.to": "إلى", "search.depart": "المغادرة", "search.return": "العودة",
    "search.travelers": "المسافرون", "search.checkin": "الوصول", "search.checkout": "المغادرة",
    "search.destination": "الوجهة", "search.guests": "الضيوف والغرف",
    "search.cta": "ابحث عن الوجهات", "search.oneway": "ذهاب فقط", "search.round": "ذهاب وعودة",
    "search.adults": "بالغون", "search.from.ph": "مدينة أو مطار", "search.to.ph": "مدينة أو مطار",
    "search.cityHotelPh": "مدينة أو فندق", "search.cabin": "درجة المقصورة",
    "search.guests1": "ضيف واحد · غرفة واحدة", "search.guests2": "ضيفان · غرفة واحدة", "search.guests4": "4 ضيوف · غرفتان",
    "search.travelersN": "{n} مسافرين", "search.selectCity": "اختر المدينة",
    "cabin.any": "أي درجة", "cabin.economy": "الاقتصادية", "cabin.business": "رجال الأعمال",
    "vision.eyebrow": "اكتشف السعودية · رؤية 2030",
    "vision.title": "المملكة، مفتوحة للعالم.",
    "vision.sub": "رحلات داخلية منسّقة تتماشى مع رؤية 2030 — من الصخور الرملية إلى ضباب الجبال وحجر المدينة القديمة.",
    "vision.alula": "صخرة الفيل، العُلا", "vision.alula.d": "قوس بارتفاع 52 مترًا نحتته الرياح من الحجر الرملي الأحمر.",
    "vision.jeddah": "جدة التاريخية", "vision.jeddah.d": "واجهات حجر مرجاني ورواشين البلد، موقع تراث عالمي.",
    "vision.asir": "جبال عسير", "vision.asir.d": "قمم مدرّجة وضباب بارد فوق المرتفعات الجنوبية.",
    "vision.explore": "استكشف الجولات",
    "m.revenue": "الإيرادات السنوية", "m.sat": "رضا العملاء", "m.projects": "مشاريع ناجحة",
    "m.eyebrow": "قوّتنا التشغيلية",
    "promise.eyebrow": "وعدنا",
    "promise.title": "نعامل كل رحلة كأنها تهمّ، لأنها كذلك.",
    "hrcf.h": "الصدق", "hrcf.h.d": "نصيحة واضحة وخيارات شفافة — دون أي عروض لم تطلبها.",
    "hrcf.r": "المسؤولية", "hrcf.r.d": "ملكية كاملة للرحلة، من الحجز إلى العودة الآمنة.",
    "hrcf.c": "الالتزام", "hrcf.c.d": "تسليم دقيق وجودة ثابتة في كل برنامج سفر.",
    "hrcf.f": "المتابعة", "hrcf.f.d": "تحديثات استباقية قبل السفر وأثناءه وبعده.",
    "wing.name": "مستر وينغ", "wing.role": "وكيل السفر الذكي",
    "wing.greeting": "مرحبًا بك في ثيردوينغ. أنا مستر وينغ. أستطيع البحث عن رحلات وفنادق، والحجز ببطاقتك المحفوظة، أو تعديل رحلة — بكلمات قليلة. كيف يمكنني خدمتك اليوم؟",
    "wing.placeholder": "اسأل مستر وينغ… مثل: «ابحث عن رحلة السعودية إلى جدة غدًا صباحًا»",
    "wing.confirm": "تأكيد", "wing.cancel": "إلغاء", "wing.thinking": "مستر وينغ يرتّب…",
    "wing.escalate": "تحويل إلى مركز دعم مصر", "wing.online": "متصل · يرد فورًا",
    "wing.confirmBooking": "تأكيد الحجز", "wing.confirmCancel": "تأكيد الإلغاء", "wing.confirmModify": "تأكيد التغيير",
    "wing.escalated": "تم التحويل إلى مركز الدعم في مصر",
    "wing.netError": "أواجه صعوبة في الوصول إلى شبكة الحجز حاليًا. يمكن لمركزنا في مصر مساعدتك على 8555 240 55 966+.",
    "wing.bookedMsg": "تم كل شيء. رقم رحلتك {id} وسيصلك الإيصال قريبًا. أهلًا وسهلًا — رحلة موفقة.",
    "wing.cancelledMsg": "تم — أُلغي حجزك والمبلغ في طريقه إليك وفق سياسة المورّد. هل من خدمة أخرى؟",
    "wing.modifiedMsg": "تم التحديث — أُعيدت جدولة حجزك وسيصلك تأكيد جديد قريبًا.",
    "wing.declinedMsg": "لا مشكلة، لن أتابع. هل ترغب أن أبحث عن خيارات أخرى؟",
    "wing.refundToCard": "استرداد إلى البطاقة", "wing.savedCard": "بطاقة محفوظة",
    "wing.escTitle": "تم التحويل إلى مركز الدعم في مصر", "wing.escBody": "سيتولّى أحد موظفينا هذا الطلب الخاص بكبار الشخصيات قريبًا.",
    "wing.localBadge": "المساعد دون اتصال", "wing.title": "{name}، وكيل السفر الذكي الذي لا ينام.",
    "wing.teaser.eyebrow": "تعرّف على وكيلك",
    "wing.teaser.body": "اطلب بلغة بسيطة. يبحث مستر وينغ في رحلات الطيران والفنادق المتاحة، ويحجز ببطاقتك المحفوظة في نقرة واحدة، ويغيّر أو يلغي الرحلات — مع تأكيد مرئي دائمًا أولًا.",
    "wing.teaser.cta": "تحدث مع مستر وينغ",
    "book.now": "احجز الآن", "view": "عرض", "select": "اختر", "from.price": "ابتداءً من",
    "footer.rights": "جميع الحقوق محفوظة.", "lang.toggle": "English",
    "common.modify": "تعديل", "common.save": "حفظ", "common.show": "إظهار", "common.hide": "إخفاء",
    "common.back": "رجوع", "common.cancel": "إلغاء", "common.continue": "متابعة", "common.close": "إغلاق",
    "common.perNight": "/ الليلة", "common.nights": "ليالٍ", "common.night": "ليلة", "common.total": "الإجمالي",
    "footer.col.book": "احجز", "footer.col.company": "الشركة", "footer.col.legal": "القانونية",
    "footer.cancelRefunds": "الإلغاء والاسترداد", "footer.privacy": "سياسة الخصوصية", "footer.terms": "شروط الخدمة",
    "flights.refine": "تصفية", "flights.sortBy": "ترتيب حسب",
    "flights.sort.price": "أقل سعر", "flights.sort.dep": "الأبكر مغادرة", "flights.sort.dur": "الأقصر مدة",
    "flights.nonstopOnly": "مباشر فقط", "flights.cabin": "درجة المقصورة", "flights.airlines": "شركات الطيران",
    "flights.nonstop": "رحلة مباشرة", "flights.stop": "{n} توقف", "flights.corpRates": "تم تطبيق أسعار الشركات",
    "flights.empty": "لا توجد رحلات مطابقة لعوامل التصفية.", "flights.modify": "تعديل البحث",
    "flights.sub": "{depart} · {travelers} · {count} رحلة من الشبكات العالمية",
    "flights.perPerson": "للفرد", "flights.totalFor": "الإجمالي لـ{n}", "flights.onTime": "الالتزام بالمواعيد {n}%",
    "flights.refundable": "قابلة للاسترداد وفق سياسة الناقل", "flights.priceRange": "أقصى سعر",
    "flights.depTime": "وقت المغادرة", "flights.anytime": "أي وقت", "flights.results": "{from} ← {to}",
    "flights.aircraft": "الطائرة", "flights.baggage": "الأمتعة", "flights.fareType": "نوع السعر",
    "flights.baggage.business": "قطعتان × 32كجم + حقيبة يد", "flights.baggage.economy": "قطعة × 23كجم + حقيبة يد",
    "flights.fare.flex": "مرن · قابل للاسترداد", "flights.fare.saver": "موفّر · استرداد جزئي",
    "pkg.inc.transfers": "طيران + تنقلات", "pkg.inc.stays": "إقامات بوتيكية", "pkg.inc.support": "دعم مستر وينغ 24/7",
    "hotels.title": "فنادق في {city}", "hotels.sub": "{dates} · {count} فندقًا بأسعار شركات حصرية",
    "hotels.corpRate": "سعر الشركات", "hotels.reviews": "{count} تقييم", "hotels.perNight": "/ الليلة",
    "hotels.sort.rec": "موصى به", "hotels.sort.price": "أقل سعر", "hotels.sort.rating": "الأعلى تقييمًا",
    "hotels.modify": "تعديل", "hotels.empty": "لا توجد فنادق مطابقة.", "hotels.filters": "تصفية",
    "hotels.minRating": "أدنى تقييم", "hotels.maxRate": "أقصى سعر لليلة", "hotels.nightsAt": "{nights} ليالٍ ابتداءً من",
    "pkg.includes": "{nights} ليالٍ · طيران + فندق + مرشد مختار", "pkg.highlights": "أبرز ما في الرحلة",
    "pkg.detailCta": "عرض البرنامج", "pkg.book": "احجز هذه الباقة",
    "booking.secured": "مؤمّن عبر Tap Payments · مرمّز وفق PCI-DSS",
    "booking.empty": "لا يوجد حجز قيد التنفيذ.", "booking.searchFlights": "ابحث عن رحلات",
    "booking.back": "العودة إلى النتائج",
    "booking.step.details": "بيانات المسافر", "booking.step.pay": "الدفع", "booking.step.done": "تم التأكيد",
    "booking.details.sub": "محجوز ضمن حساب شركتك · متوافق مع السياسة.",
    "booking.f.name": "الاسم الكامل", "booking.f.org": "الجهة", "booking.f.email": "البريد الإلكتروني", "booking.f.phone": "الهاتف",
    "booking.ph.name": "كما في الجواز / الهوية", "booking.ph.org": "وزارة / شركة", "booking.ph.email": "name@org.gov.sa", "booking.ph.phone": "+966 5X XXX XXXX",
    "booking.policyOk": "اجتاز فحص سياسة الشركة.", "booking.policyDetail": "هذا السعر ضمن سياسة سفرك. المعتمِد: مُجاز تلقائيًا.",
    "booking.continue": "المتابعة إلى الدفع",
    "booking.pay.sub": "مصمّم للسوق السعودي والخليجي.",
    "booking.pay.saved": "البطاقات المحفوظة", "booking.pay.new": "بطاقة جديدة", "booking.pay.apple": "Apple Pay",
    "booking.primary": "الرئيسية", "booking.oneClick": "نقرة واحدة — يعيد مستر وينغ استخدام الرمز",
    "booking.f.cardNo": "رقم البطاقة", "booking.f.exp": "تاريخ الانتهاء", "booking.f.cvv": "رمز التحقق", "booking.f.cardName": "الاسم على البطاقة",
    "booking.ph.cardName": "اسم حامل البطاقة", "booking.saveCard": "احفظ البطاقة بأمان (مرمّزة) لإعادة الحجز بنقرة واحدة عبر مستر وينغ",
    "booking.apple.desc": "أكّد ببصمة الوجه على جهازك لإتمام الدفع عبر Apple Pay.",
    "booking.processing": "جارٍ المعالجة بأمان…", "booking.pay": "ادفع",
    "booking.confirmed": "تم تأكيد الحجز",
    "booking.confirmed.sub": "رقم الرحلة {id} · سيصلك الإيصال على بريدك الإلكتروني.",
    "booking.toDashboard": "عرض في لوحة التحكم", "booking.toTrips": "عرض رحلاتي", "booking.toHome": "العودة إلى الرئيسية",
    "booking.summary": "ملخص الرحلة", "booking.baseFare": "السعر الأساسي", "booking.serviceFee": "رسوم الخدمة",
    "booking.vat": "ضريبة القيمة المضافة (15%)", "booking.total": "الإجمالي", "booking.travelersN": "{n} مسافرين",
    "booking.paidWith": "مدفوع بواسطة", "booking.ref": "مرجع الدفع", "booking.receipt": "تنزيل الإيصال",
    "pay.err.number": "أدخل رقم بطاقة صالحًا.", "pay.err.exp": "أدخل تاريخ انتهاء صالحًا وغير منتهٍ.",
    "pay.err.cvv": "أدخل رمز الأمان الصحيح.", "pay.err.name": "أدخل الاسم الموجود على البطاقة.",
    "pay.err.email": "أدخل عنوان بريد إلكتروني صالحًا.", "pay.err.requiredName": "أدخل اسم المسافر.",
    "pay.err.noCard": "اختر بطاقة محفوظة أو أضف بطاقة جديدة.",
    "pay.apple.unavailable": "خدمة Apple Pay غير متوفرة في هذا المتصفح. استخدم بطاقة محفوظة أو جديدة.",
    "corp.eyebrow": "إدارة سفر الشركات", "corp.title": "برامج سفر لمؤسسات المملكة.",
    "corp.sub": "للوزارات والمستشفيات وحسابات الشركات التي تتطلب التحكم والتوفير والموثوقية — تُدار بالكامل من ثيردوينغ.",
    "corp.cta": "افتح حساب شركة",
    "corp.seg.gov": "الوزارات الحكومية", "corp.seg.gov.d": "تنسيق بمستوى البروتوكول، وتطبيق للسياسات، وتقارير جاهزة للتدقيق لسفر القطاع العام.",
    "corp.seg.health": "المستشفيات والقطاع الصحي", "corp.seg.health.d": "سفر طبي ذو أولوية، ولوجستيات المؤتمرات، وإعادة حجز على مدار الساعة للفرق الطبية.",
    "corp.seg.ent": "حسابات المؤسسات", "corp.seg.ent.d": "أسعار شركات تفاوضية، ولوحات إنفاق، وإدارة حساب مخصصة.",
    "corp.why": "لماذا ثيردوينغ", "corp.whyTitle": "تحكّم وتوفير وموثوقية — بالتصميم.",
    "corp.f.policy": "تطبيق صارم للسياسات", "corp.f.policy.d": "درجات المقصورة وحدود الأسعار وسلاسل الاعتماد تُطبَّق تلقائيًا عند الحجز.",
    "corp.f.rates": "أسعار تفاوضية حصرية", "corp.f.rates.d": "أسعار طيران وفنادق للشركات عبر الموردين العالميين والمحليين.",
    "corp.f.report": "تقارير موثوقة", "corp.f.report.d": "تقارير فورية عن الإنفاق والتوفير والامتثال تُصدَّر إلى المالية.",
    "corp.f.wing": "مستر وينغ للفرق", "corp.f.wing.d": "يخدم مسافروك أنفسهم عبر المحادثة — ضمن السياسة التي تحددها.",
    "corp.form.title": "افتح حسابًا مخصصًا", "corp.form.sub": "أخبرنا عن مؤسستك وسيتواصل معك مدير حساب خلال يوم عمل واحد.",
    "corp.form.b1": "مدير حساب مخصص", "corp.form.b2": "سياسات وسلاسل اعتماد مخصصة", "corp.form.b3": "فوترة موحّدة وضريبة القيمة المضافة", "corp.form.b4": "دعم 24/7 عبر مركز مصر",
    "corp.f.organization": "الجهة", "corp.f.contact": "اسم جهة الاتصال", "corp.f.sector": "القطاع",
    "corp.f.workEmail": "البريد الإلكتروني للعمل", "corp.f.trips": "عدد الرحلات السنوية", "corp.f.notes": "ملاحظات",
    "corp.sector.gov": "حكومي", "corp.sector.health": "صحي", "corp.sector.ent": "مؤسسات",
    "corp.ph.org": "وزارة / مستشفى / شركة", "corp.ph.notes": "أخبرنا عن احتياجات سفرك…",
    "corp.form.submit": "إرسال الطلب", "corp.form.received": "تم استلام الطلب",
    "corp.form.thanks": "سيتواصل فريقنا معك قريبًا.",
    "about.heroSub": "وكالة سفر سعودية معتمدة من الإياتا تأسست عام 2021، تجمع ثيردوينغ بين دفء الضيافة الأصيلة ودقة محرك حجز حديث.",
    "about.fw": "إطار HRC-F", "about.fwTitle": "أربعة وعود في كل برنامج سفر.",
    "about.fwSub": "ليس شعارًا — بل معيار تشغيلي يحكم كيف نخطّط ونحجز ونتابع.",
    "about.est": "تأسست 2021 · الرياض", "about.storyTitle": "دفءٌ أصيل، وانتشارٌ عالمي.",
    "about.story": "من مقرنا في الرياض ننسّق سفر أكثر مؤسسات المملكة تطلّبًا، بدعم على مدار الساعة من مركزنا في مصر.",
    "support.eyebrow": "دعم وتواصل 24/7", "support.title": "شبكة واحدة. لا تنام أبدًا.",
    "support.sub": "يقود مقرنا في الرياض التنسيق بينما يقدّم مركزنا في مصر خدمة التذاكر ومتابعة الموردين على مدار الساعة.",
    "support.egyptTeam": "فريق الدعم في مصر", "support.egyptDesc": "تذاكر 24/7 · متابعة الموردين",
    "support.riyadhHQ": "المقر الرئيسي بالرياض", "support.riyadhDesc": "التنسيق الرئيسي",
    "support.hq": "مقر الرياض", "support.hqAddr": "شارع أبو بكر الصديق، حي النرجس، الرياض.",
    "support.call": "اتصل بنا", "support.email": "البريد الإلكتروني",
    "support.sendTitle": "أرسل لنا رسالة", "support.sendSub": "لطلبات كبار الشخصيات والجهات الحكومية، يرد فريقنا خلال ساعة.",
    "support.f.name": "الاسم", "support.f.phone": "الهاتف", "support.f.email": "البريد الإلكتروني", "support.f.help": "كيف يمكننا المساعدة؟",
    "support.send": "إرسال الرسالة", "support.sent": "تم إرسال الرسالة — سيرد عليك أحد ممثلينا قريبًا.",
    "support.instant": "تفضّل مساعدة فورية؟", "support.instantSub": "يجيب مستر وينغ خلال ثوانٍ ويحوّل طلبات كبار الشخصيات مباشرة إلى مركزنا في مصر.",
    "support.chatWing": "تحدث مع مستر وينغ",
    "legal.eyebrow": "القانونية والسياسات", "legal.title": "شروط واضحة، تُطبَّق بإنصاف.",
    "legal.tab.cancellation": "الإلغاء والاسترداد", "legal.tab.privacy": "سياسة الخصوصية", "legal.tab.terms": "شروط الخدمة",
    "legal.updated": "آخر تحديث يونيو 2026",
    "admin.center": "مركز تحكم الإدارة", "admin.overview": "نظرة عامة على العمليات",
    "admin.ok": "كل الأنظمة تعمل",
    "admin.tab.dashboard": "لوحة التحكم", "admin.tab.bookings": "الحجوزات", "admin.tab.transcripts": "محادثات مستر وينغ",
    "admin.tab.api": "إدارة الواجهات البرمجية", "admin.tab.leads": "العملاء المحتملون",
    "admin.stat.active": "الحجوزات النشطة", "admin.stat.revenue": "الإيرادات (30 يومًا)", "admin.stat.wing": "حجوزات مستر وينغ", "admin.stat.sat": "رضا العملاء",
    "admin.week": "الحجوزات هذا الأسبوع", "admin.flightsHotels": "طيران + فنادق",
    "admin.channelMix": "توزيع القنوات", "admin.ch.wing": "مستر وينغ (ذكاء اصطناعي)", "admin.ch.web": "الموقع مباشرة", "admin.ch.egypt": "مركز مصر",
    "admin.aiDrives": "الذكاء الاصطناعي يقود غالبية الحجوزات الآن.",
    "admin.recent": "أحدث الحجوزات", "admin.all": "كل الحجوزات", "admin.totalN": "{n} إجمالًا",
    "admin.col.itinerary": "رقم الرحلة", "admin.col.trip": "الرحلة", "admin.col.client": "العميل", "admin.col.channel": "القناة", "admin.col.amount": "المبلغ", "admin.col.status": "الحالة", "admin.col.date": "التاريخ", "admin.col.contact": "التواصل", "admin.col.type": "النوع",
    "admin.transcripts.empty": "لا توجد محادثات مع مستر وينغ بعد.", "admin.leads.empty": "لا يوجد عملاء محتملون بعد. ستظهر هنا الاستفسارات والرسائل المُرسَلة.",
    "admin.leads.inquiry": "استفسار شركة", "admin.leads.message": "رسالة دعم", "admin.outcome": "النتيجة",
    "admin.viewConvo": "عرض المحادثة",
    "api.connected": "متصل", "api.notConnected": "غير متصل", "api.rotate": "تدوير المفتاح", "api.add": "إضافة مفتاح",
    "api.model": "النموذج", "api.modelSaved": "تم حفظ النموذج", "api.plug": "جاهز للاستخدام، بلا برمجة",
    "api.plugDesc": "الصق مفاتيح بوابة الدفع وأنظمة الطيران وموردي الفنادق ونموذج الذكاء الاصطناعي. تسري التغييرات فورًا — دون المساس بكود الموقع.",
    "api.security": "الأمان",
    "api.sec1": "تُحفظ المفاتيح محليًا في متصفحك وتُخفى بعد الحفظ", "api.sec2": "محدّدة لكل بيئة (مباشر / اختبار)",
    "api.sec3": "نموذج ومفتاح مستر وينغ قابلان للضبط هنا", "api.sec4": "سجل تدقيق كامل لعمليات التدوير",
    "api.liveBadge": "مستر وينغ يعمل بمفتاحك", "api.localBadge": "مستر وينغ يعمل بالمساعد المدمج",
    "status.Confirmed": "مؤكد", "status.Cancelled": "ملغى", "status.Escalated": "محوّل",
    "status.New": "جديد", "status.Contacted": "تم التواصل", "status.Closed": "مغلق", "status.Modified": "أُعيدت جدولته",
    "trips.title": "رحلاتي", "trips.sub": "أدر برامج سفرك — اعرض أو أعد الجدولة أو ألغِ.",
    "trips.empty": "لا توجد رحلات بعد. ابحث عن رحلات أو فنادق للبدء.", "trips.browse": "ابحث عن رحلات",
    "trips.cancel": "إلغاء الرحلة", "trips.modify": "إعادة جدولة", "trips.details": "التفاصيل",
    "trips.detail.id": "رقم الرحلة", "trips.detail.type": "نوع الحجز",
    "trips.detail.date": "تاريخ السفر", "trips.detail.amount": "المبلغ",
    "trips.detail.status": "الحالة", "trips.detail.channel": "القناة",
    "trips.detail.note": "ملاحظة", "trips.detail.refunded": "المبلغ المسترد",
    "trips.refunded": "تم استرداد {amount}", "trips.confirmCancel": "إلغاء هذه الرحلة؟",
    "trips.confirmCancelBody": "سيُسترد لك نحو {amount} وفق سياسة المورّد. لا يمكن التراجع عن هذا.",
    "trips.keepIt": "الاحتفاظ بالرحلة", "trips.newDate": "التاريخ الجديد", "trips.save": "حفظ التغيير",
    "trips.upcoming": "القادمة", "trips.past": "السابقة والملغاة", "trips.booked": "حُجزت {when}",
    "detail.continue": "المتابعة إلى الحجز",
    "leads.ref": "الرقم المرجعي", "leads.required": "هذا الحقل مطلوب", "leads.email": "أدخل بريدًا إلكترونيًا صحيحًا",
    "filters.show": "عرض {n} نتيجة",
    /* مزوّد الذكاء الاصطناعي (مستر وينغ) */
    "api.ai.provider": "المزوّد", "api.ai.baseUrl": "عنوان واجهة API", "api.ai.key": "مفتاح API",
    "api.ai.connect": "اتصال وجلب النماذج", "api.ai.connecting": "جارٍ الاتصال…",
    "api.ai.model": "النموذج", "api.ai.selectModel": "لم يُختَر نموذج بعد", "api.ai.modelsFound": "{n} نموذجًا متاحًا",
    "api.ai.save": "حفظ المزوّد", "api.ai.change": "تغيير النموذج", "api.ai.reconfigure": "تغيير المفتاح / المزوّد",
    "api.ai.filter": "تصفية النماذج…", "api.ai.envManaged": "مُهيّأ عبر متغيّر بيئة.",
    "api.ai.hint": "يعمل مع OpenAI وOpenRouter وGroq وTogether وMistral وDeepSeek وAnthropic أو أي نقطة نهاية متوافقة مع OpenAI.",
    "api.ai.localHint": "الوضع الثابت: يحاول المتصفح الاتصال بالمزوّد مباشرةً (إن سمح CORS)؛ انشر الخادم لوسيط آمن من جهته.",
    "api.ai.err.needKey": "أدخل مفتاح API أولًا.", "api.ai.err.needToken": "أدخل رمز الإدارة على اليمين أولًا.",
    "api.ai.err.adminNeeded": "اضبط ADMIN_TOKEN في Vercel لإدارة المزوّد من اللوحة (أو استخدم متغيّرات البيئة).",
    "api.ai.err.unauthorized": "رمز الإدارة غير صحيح.", "api.ai.err.unsafeUrl": "يجب أن يكون عنوان الـAPI نقطة https عامة.",
    "api.ai.err.kv": "أضف قاعدة بيانات Supabase أو مخزن Vercel KV للحفظ من اللوحة (أو استخدم متغيّرات البيئة).",
    "api.ai.err.connect": "تعذّر الوصول إلى المزوّد — تحقّق من عنوان الـAPI والمفتاح.",
    "api.ai.err.noModels": "تم الاتصال، لكن لم تُعَد أي نماذج. تحقّق من صلاحيات المفتاح أو عنوان الـAPI.",
    "api.ai.err.save": "تعذّر حفظ المزوّد. حاول مرة أخرى.",
    /* الإشعارات */
    "notice.paid": "تم تأكيد الدفع — حجزك مؤكَّد.",
    "notice.payFailed": "تعذّر تأكيد دفعتك، لذا لم يُخصم أي مبلغ. حاول مجددًا أو تواصل مع فريقنا على مدار الساعة.",
    "notice.cancelled": "أُلغيت الرحلة — سيُسترد نحو {amount} وفق سياسة المورّد.",
    /* 404 */
    "nf.title": "الصفحة غير موجودة", "nf.sub": "الصفحة التي تبحث عنها غير موجودة أو ربما نُقلت.", "nf.home": "العودة إلى الرئيسية",
    /* جمع التوقفات + الدفع */
    "flights.stops": "{n} توقفات", "pay.err.declined": "تم رفض الدفع. يرجى التحقق من بيانات بطاقتك أو تجربة وسيلة أخرى.",
    /* الرحلات */
    "trips.err.pastDate": "اختر تاريخًا مستقبليًا.",
    /* إضافات قانونية */
    "legal.tab.cookies": "سياسة ملفات التعريف والتخزين", "legal.tab.accessibility": "إمكانية الوصول",
    "footer.cookies": "سياسة ملفات التعريف والتخزين", "footer.accessibility": "إمكانية الوصول",
    "nav.signin": "تسجيل الدخول", "nav.signup": "إنشاء حساب", "nav.profile": "الملف الشخصي", "nav.account": "حسابي", "nav.signout": "تسجيل الخروج",
    "auth.welcome": "مرحبًا بعودتك", "auth.signinSub": "سجّل الدخول لإدارة رحلاتك وبطاقاتك وتفضيلات سفرك.",
    "auth.createTitle": "أنشئ حسابك", "auth.createSub": "احفظ المسافرين والبطاقات والرحلات لحجز أسرع ومتوافق مع السياسة.",
    "auth.name": "الاسم الكامل", "auth.email": "البريد الإلكتروني للعمل", "auth.password": "كلمة المرور", "auth.confirm": "تأكيد كلمة المرور",
    "auth.signinBtn": "تسجيل الدخول", "auth.signupBtn": "إنشاء حساب",
    "auth.toSignup": "جديد في ثيردوينغ؟ أنشئ حسابًا", "auth.toSignin": "لديك حساب بالفعل؟ سجّل الدخول",
    "auth.pwHint": "6 أحرف على الأقل",
    "auth.err.email_invalid": "أدخل عنوان بريد إلكتروني صالحًا.", "auth.err.name_required": "أدخل اسمك الكامل.",
    "auth.err.password_weak": "يجب أن تكون كلمة المرور 6 أحرف على الأقل.", "auth.err.email_taken": "يوجد حساب بهذا البريد الإلكتروني بالفعل.",
    "auth.err.no_account": "لا يوجد حساب بهذا البريد الإلكتروني.", "auth.err.wrong_password": "كلمة المرور غير صحيحة.", "auth.err.password_mismatch": "كلمتا المرور غير متطابقتين.",
    "auth.b1": "حجز بنقرة واحدة بالبطاقات المحفوظة", "auth.b2": "كل رحلاتك في مكان واحد", "auth.b3": "سفر شركات متوافق مع السياسة", "auth.b4": "مستر وينغ يتذكّر تفضيلاتك",
    "profile.greeting": "مرحبًا، {name}", "profile.member": "عضو منذ {date}",
    "profile.personal": "المعلومات الشخصية", "profile.travel": "تفضيلات السفر", "profile.cards": "بطاقات الدفع المحفوظة", "profile.security": "الأمان",
    "profile.f.org": "الجهة", "profile.f.phone": "الهاتف", "profile.f.country": "الدولة", "profile.f.homeAirport": "مطار الانطلاق", "profile.f.prefCabin": "الدرجة المفضّلة", "profile.f.newsletter": "أرسل لي عروض وتحديثات السفر",
    "profile.save": "حفظ التغييرات", "profile.saved": "تم الحفظ",
    "profile.changePw": "تغيير كلمة المرور", "profile.currentPw": "كلمة المرور الحالية", "profile.newPw": "كلمة المرور الجديدة", "profile.pwChanged": "تم تحديث كلمة المرور",
    "profile.signout": "تسجيل الخروج", "profile.delete": "حذف الحساب", "profile.deleteConfirm": "حذف حسابك؟ سيُزال ملفك الشخصي وبطاقاتك المحفوظة على هذا الجهاز.",
    "profile.addCard": "إضافة بطاقة", "profile.makePrimary": "تعيين كرئيسية", "profile.remove": "إزالة", "profile.noCards": "لا توجد بطاقات محفوظة بعد.", "profile.viewTrips": "عرض رحلاتي",
    "country.SA": "السعودية", "country.AE": "الإمارات", "country.EG": "مصر", "country.QA": "قطر", "country.KW": "الكويت", "country.BH": "البحرين", "country.OM": "عُمان", "country.other": "أخرى",
  },
};

function interp(str, vars) {
  if (!vars) return str;
  return String(str).replace(/\{(\w+)\}/g, (m, k) => (vars[k] != null ? vars[k] : m));
}

/* Non-hook translation for code that runs outside the React tree / LangProvider
   (e.g. the top-level ErrorBoundary class). Resolves the active language from
   localStorage, falls back to English, then to the raw key. */
function tr(k, vars) {
  let lang = "en";
  try { lang = localStorage.getItem("tw_lang") || "en"; } catch (e) {}
  return interp((STRINGS[lang] && STRINGS[lang][k]) || STRINGS.en[k] || k, vars);
}

function LangProvider({ children }) {
  const [lang, setLang] = React.useState(() => localStorage.getItem("tw_lang") || "en");
  React.useEffect(() => {
    localStorage.setItem("tw_lang", lang);
    document.documentElement.lang = lang;
    document.documentElement.dir = lang === "ar" ? "rtl" : "ltr";
  }, [lang]);
  const t = React.useCallback((k, vars) => interp((STRINGS[lang] && STRINGS[lang][k]) || STRINGS.en[k] || k, vars), [lang]);
  const toggle = () => setLang(l => (l === "en" ? "ar" : "en"));
  return <LangContext.Provider value={{ lang, setLang, toggle, t, rtl: lang === "ar" }}>{children}</LangContext.Provider>;
}

function useLang() { return React.useContext(LangContext); }

Object.assign(window, { LangContext, LangProvider, useLang, STRINGS, interp, tr });
