@import "tailwindcss";
@import "tom-select/dist/css/tom-select.css";
@import "intl-tel-input/build/css/intlTelInput.css";

:root {
  --iti-path-flags-1x: url("/vendor/intl-tel-input/flags.webp");
  --iti-path-flags-2x: url("/vendor/intl-tel-input/flags@2x.webp");
}

/* Global button cursor styling */
button {
  cursor: pointer !important;
}

/* RTL: mirror directional chevrons (wizard forward/back CTAs); applies only under dir="rtl" */
[dir="rtl"] svg:has(> path[d="M9 5l7 7-7 7"]),
[dir="rtl"] svg:has(> path[d="M15 19l-7-7 7-7"]) {
  transform: scaleX(-1);
}

/* ==============================================
   A/B Test Component Enhancements
   ============================================== */

/* Payment Prompt Animation - Optimized for 60fps */
@keyframes slide-up-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply subtle backdrop blur with fallback for older browsers */
@supports (backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px)) {
  .backdrop-blur-sm {
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }
}

/* Ensure smooth transitions on all interactive elements */
.transition-colors {
  transition-property: color, background-color, border-color;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Button active states - improved touch feedback */
button:active:not(:disabled),
a.block:active {
  transform: scale(0.98);
  transition: transform 0.1s ease-out;
}

/* Focus visible for keyboard navigation (WCAG 2.1) */
button:focus-visible,
a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Prevent layout shift from focus rings */
*:focus {
  outline-offset: 2px;
}

/* Prevent iOS Safari auto-zoom on input focus (requires font-size >= 16px) */
@media screen and (max-width: 767px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="url"],
  input[type="search"],
  input[type="date"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  /* Fix for gradient rendering on iOS */
  .bg-gradient-to-br {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  /* Improve tap highlight */
  button, a {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }

  /* Disable momentum scrolling conflicts */
  #payment-prompt {
    -webkit-overflow-scrolling: touch;
  }
}

/* High contrast mode support (Windows High Contrast Mode) */
@media (prefers-contrast: high) {
  button {
    border: 2px solid currentColor;
  }

  .bg-gradient-to-br {
    background: black;
  }
}

/* Reduced motion support (WCAG 2.1) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  #payment-prompt {
    transition: none !important;
  }

  .step-hidden, .step-visible { transition: none !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}

/* Print styles - hide interactive prompts */
@media print {
  #payment-prompt {
    display: none !important;
  }
}

/* Links styled as buttons should also have pointer cursor */
a.inline-flex {
  cursor: pointer !important;
}

/* Custom styles for locale picker */
.locale-switcher select {
  display: none !important;
}

.locale-switcher .ts-wrapper {
  width: auto;
  min-width: 80px;
}

.locale-switcher .ts-control {
  background-color: rgb(17 24 39) !important; /* gray-900 */
  color: white !important;
  border: none !important;
  border-radius: 0.375rem !important; /* rounded-md */
  padding: 0.25rem 0.75rem !important; /* py-1 px-3 */
  font-size: 0.875rem !important; /* text-sm */
  font-weight: 500 !important; /* font-medium */
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05) !important; /* shadow-sm */
  min-height: auto !important;
  line-height: 1.5 !important;
  cursor: pointer !important;
  position: relative !important;
  padding-right: 2rem !important; /* Space for arrow */
}

.locale-switcher .ts-control:focus {
  outline: 2px solid transparent !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 2px rgb(55 65 81) !important; /* ring-gray-700 */
}

.locale-switcher .ts-control::after {
  content: "▼" !important;
  color: rgba(255, 255, 255, 0.75) !important;
  font-size: 10px !important;
  line-height: 1 !important;
  position: absolute !important;
  right: 8px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  pointer-events: none !important;
}

.locale-switcher .ts-control .item {
  font-size: 0.875rem !important; /* text-sm */
  font-weight: 500 !important; /* font-medium */
  color: white !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.locale-switcher .ts-dropdown {
  background-color: white !important;
  border: 1px solid rgb(229 231 235) !important; /* border-gray-200 */
  border-radius: 0.375rem !important; /* rounded-md */
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1) !important; /* shadow-lg */
  margin-top: 0.25rem !important; /* mt-1 */
  z-index: 99999 !important; /* Much higher than navbar to ensure it appears on top */
  position: fixed !important; /* Ensure it breaks out of stacking context */
}

.locale-switcher .ts-dropdown .option {
  padding: 0.5rem 0.75rem !important; /* py-2 px-3 */
  font-size: 0.875rem !important; /* text-sm */
  color: rgb(55 65 81) !important; /* text-gray-700 */
  cursor: pointer !important;
}

.locale-switcher .ts-dropdown .option:hover,
.locale-switcher .ts-dropdown .option.active {
  background-color: rgb(243 244 246) !important; /* bg-gray-100 */
}

.locale-switcher .ts-dropdown .option.selected {
  background-color: rgb(17 24 39) !important; /* bg-gray-900 */
  color: white !important;
}

/* Admin page spacing for fixed locale picker */
.admin-page-container {
  padding-top: 4rem !important; /* pt-16 - provides space for fixed locale picker */
}

/* Madmin-specific overrides */
body.form_templates {
  /* Fix button styles in Madmin */
  .btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.375rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    border: 1px solid transparent !important;
  }
  
  .btn-secondary {
    background-color: white !important;
    color: #374151 !important;
    border-color: #d1d5db !important;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05) !important;
  }
  
  .btn-secondary:hover {
    background-color: #f9fafb !important;
    border-color: #9ca3af !important;
  }
  
  /* Dropdown menu styles */
  .relative [data-dropdown-actions-target="menu"] {
    background: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1) !important;
  }
  
  /* Normalize dropdown menu items (both buttons and links) */
  .relative [data-dropdown-actions-target="menu"] button,
  .relative [data-dropdown-actions-target="menu"] a {
    display: flex !important;
    width: 100% !important;
    align-items: center !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem !important;
    color: #374151 !important;
    text-decoration: none !important;
    border: none !important;
    background: transparent !important;
    text-align: left !important;
    cursor: pointer !important;
  }
  
  .relative [data-dropdown-actions-target="menu"] button:hover,
  .relative [data-dropdown-actions-target="menu"] a:hover {
    background-color: #f3f4f6 !important;
    color: #111827 !important;
  }
}

/* Progressive form step reveal */
.step-hidden {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(8px);
  transition: opacity 0.3s ease-out, max-height 0.3s ease-out, transform 0.3s ease-out;
  pointer-events: none;
}

.step-visible {
  opacity: 1;
  max-height: 500px;
  overflow: visible;
  transform: translateY(0);
  transition: opacity 0.3s ease-out, max-height 0.3s ease-out, transform 0.3s ease-out;
  pointer-events: auto;
}

/* NMI 3-D Secure challenge — full-screen modal.
   The bank's ACS reports its true content height to Gateway.js, which writes it as
   an inline height on the iframe. We must NOT cap that height (a hard `height:100%`
   clips tall ACS pages like Mastercard ID Check). Instead: fill the width, keep a
   full-viewport minimum so short challenges still look centered, let the iframe grow
   to whatever the ACS asks for, and scroll the mount when it's taller than the modal. */
#threeDSMountPoint {
  height: 100%;
  overflow-y: auto;
}
#threeDSMountPoint iframe {
  width: 100% !important;
  min-height: 100%;
  border: 0;
  display: block;
}

/* View Transitions for page navigation */
::view-transition-old(root) {
  animation: 150ms ease-out both vt-fade-out;
}
::view-transition-new(root) {
  animation: 200ms ease-in both vt-fade-in;
}
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }

/* ==============================================
   UK ETA marketing landing clone (/apply/uk-eta)
   Mirrors visas-gateway-dash CountryPage / Navbar / Footer.
   ============================================== */

/* Orbitron wordmark — self-hosted (public/vendor) to avoid Google Fonts,
   which is blocked on the China deployment. One latin woff2 covers all weights. */
@font-face {
  font-family: "Orbitron";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/vendor/fonts/orbitron/orbitron-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* framer-motion-style reveals: fade in + slide up (y:20 -> 0) */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
  will-change: opacity, transform;
}
.reveal.reveal-hero {
  transition-duration: 0.6s;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Marketing navbar: transparent over the hero, solid + blurred once scrolled */
.mkt-nav .mkt-brand,
.mkt-nav .mkt-link,
.mkt-nav .mkt-lang {
  color: #fff;
}
.mkt-nav .mkt-lang:hover {
  background-color: rgba(255, 255, 255, 0.1);
}
.mkt-nav.is-scrolled {
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.mkt-nav.is-scrolled .mkt-brand,
.mkt-nav.is-scrolled .mkt-lang {
  color: oklch(0.21 0.06 256);
}
.mkt-nav.is-scrolled .mkt-link {
  color: oklch(0.21 0.06 256 / 0.8);
}
.mkt-nav.is-scrolled .mkt-link:hover,
.mkt-nav.is-scrolled .mkt-lang:hover {
  color: oklch(0.7 0.18 47);
  background-color: transparent;
}

/* Footer navy (matches marketing --navy token) */
.mkt-footer {
  background-color: oklch(0.24 0.06 258);
}
