/* Google Theme Variables */
:root {
  --bg-color: #ffffff;
  --text-color: #202124;
  --text-secondary: #70757a;
  --border-color: #dfe1e5;
  --btn-bg: #f8f9fa;
  --btn-border: #f8f9fa;
  --btn-text: #3c4043;
  --footer-bg: #f2f2f2;
  --footer-border: #dadce0;
  
  /* Google Logo Brand Colors */
  --g-blue: #1E40AF;
  --g-red: #EA4335;
  --g-yellow: #FBBC05;
  --g-green: #34A853;
}

/* Global Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
  margin: 0;
  padding: 0;
  width: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', 'Sarabun', Arial, sans-serif;
  background-color: #ffffff;
  color: var(--text-color);
  display: flex;
  flex-direction: column;
}

.google-layout-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch; /* iOS momentum scroll */
  overscroll-behavior-y: none; /* Prevent pull-to-refresh bounce */
  position: relative;
  width: 100%;
}

/* Top Header Navigation Row */
.top-nav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 1rem 1.5rem;
  height: 60px;
  animation: apple-entrance 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  animation-delay: 0s;
}

/* Navigation Controls (Country & Language selectors) */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  z-index: 100;
}

/* Grid card selection of countries (flexible, supports many countries) */
.country-selection-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  width: 100%;
  max-width: 520px;
  box-sizing: border-box;
}

.country-select-btn {
  flex: 1 1 calc(33.33% - 0.5rem);
  min-width: 105px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.1s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.country-select-btn:hover {
  border-color: #cbd5e1;
  background-color: #f8fafc;
}

.country-select-btn.active {
  background-color: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.country-select-btn:active {
  transform: scale(0.98);
}

.country-select-btn .flag-icon {
  font-size: 1.1rem;
}


.lang-switcher {
  position: relative;
}

.lang-select {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 22px 5px 8px;
  color: #334155;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: all 0.2s ease;
}

.lang-select:hover {
  border-color: #cbd5e1;
}

.lang-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Custom courier tag branding borders */
.tag-thpost { border-left: 3px solid #ef4444; }
.tag-flash { border-left: 3px solid #eab308; }
.tag-kerry { border-left: 3px solid #f97316; }
.tag-jt { border-left: 3px solid #dc2626; }
.tag-shopee { border-left: 3px solid #ff5722; }
.tag-best { border-left: 3px solid #2563eb; }

.tag-kopost { border-left: 3px solid #dc2626; }
.tag-cj { border-left: 3px solid #2563eb; }
.tag-hanjin { border-left: 3px solid #1e3a8a; }
.tag-lotte { border-left: 3px solid #ea580c; }

.tag-jppost { border-left: 3px solid #ef4444; }
.tag-yamato { border-left: 3px solid #facc15; }
.tag-sagawa { border-left: 3px solid #2563eb; }

.tag-poslaju { border-left: 3px solid #facc15; }
.tag-jtmy { border-left: 3px solid #dc2626; }
.tag-ninjamy { border-left: 3px solid #ef4444; }

.tag-singpost { border-left: 3px solid #2563eb; }
.tag-ninjasg { border-left: 3px solid #ef4444; }
.tag-speedpost { border-left: 3px solid #1e3a8a; }

.tag-cnpost { border-left: 3px solid #15803d; }
.tag-sf { border-left: 3px solid #f43f5e; }

.tag-usps { border-left: 3px solid #1e3a8a; }
.tag-ups { border-left: 3px solid #f59e0b; }
.tag-fedex { border-left: 3px solid #6366f1; }
.tag-dhl { border-left: 3px solid #facc15; }


.nav-pos-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  background: linear-gradient(135deg, #00c6ff 0%, #0072ff 60%, #1d4ed8 100%);
  color: #ffffff;
  border-radius: 6px;
  padding: 0.5rem 0.95rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 114, 255, 0.2);
}

.nav-pos-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 114, 255, 0.3);
  color: #ffffff;
}

.nav-pos-btn:hover .arrow-icon {
  transform: translateX(2px);
}

.nav-pos-btn:active {
  transform: translateY(1px) scale(0.98);
}

.arrow-icon {
  transition: transform 0.15s ease;
}

/* Center Search Area (Flat Layout) */
.search-area {
  flex: 1; /* Grow AND shrink to fit viewport perfectly */
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 480px;
  margin: 0 auto; /* Center horizontally only */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Center search contents vertically */
  position: relative;
  z-index: 2;
}

/* Logo Styling */
.logo-wrapper {
  display: flex;
  align-items: baseline;
  font-family: 'Outfit', sans-serif;
  font-size: 2.45rem;
  font-weight: 900;
  letter-spacing: -1.2px;
  margin-top: 0;
  margin-bottom: 1.25rem;
  user-select: none;
  filter: drop-shadow(0 3px 8px rgba(30, 64, 175, 0.22));
  
  /* Identity transformations to establish stacking context */
  translate: 0 0;
  scale: 1;
  rotate: 0deg;
  
  /* Apple-style entrance animation */
  animation: logo-entrance 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  animation-delay: 0.08s;
}

.logo-main {
  background: linear-gradient(135deg, #00c6ff 0%, #0072ff 60%, #1d4ed8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
  transition: filter 0.3s ease, background 0.3s ease;
  
  /* Continuous smooth shimmer animation */
  animation: logo-shimmer 6s linear infinite;
}

/* Glossy sweep shine triggered on courier detection */
.logo-main.detected-shimmer {
  background: linear-gradient(90deg, #1e40af 0%, #3b82f6 30%, #ffffff 50%, #3b82f6 70%, #1e40af 100%) !important;
  background-size: 200% auto !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  animation: logo-detect-sweep 0.75s cubic-bezier(0.25, 1, 0.5, 1) 1 !important;
}

@keyframes logo-detect-sweep {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}

/* Dynamic Logo Brand Gradients */
.logo-main.logo-thpost {
  background: linear-gradient(135deg, #ff6b6b 0%, #ef4444 60%, #b91c1c 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}
.logo-main.logo-shopee {
  background: linear-gradient(135deg, #ff8833 0%, #f97316 60%, #c2410c 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}
.logo-main.logo-flash {
  background: linear-gradient(135deg, #fef08a 0%, #facc15 50%, #eab308 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}
.logo-main.logo-kerry {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 60%, #9a3412 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}
.logo-main.logo-jt {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 60%, #991b1b 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}
.logo-main.logo-best {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 60%, #1d4ed8 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

.logo-sub {
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  color: var(--text-color);
  letter-spacing: -0.2px;
  margin-left: 0.35rem;
  
  /* Identity transformations */
  translate: 0 0;
  scale: 1;
  transition: color 0.3s ease, translate 0.3s ease, scale 0.3s ease;
  
  /* Continuous gentle breathing pulse */
  animation: logo-sub-pulse 3s ease-in-out infinite;
}

/* Logo Hover Animations */
.logo-wrapper:hover .logo-main {
  animation: logo-shimmer 1.8s linear infinite;
  filter: drop-shadow(0 0 6px rgba(0, 198, 255, 0.5));
}

.logo-wrapper:hover .logo-sub {
  animation: logo-sub-bounce 0.8s ease-in-out infinite;
  color: #0072ff;
  scale: 1.1;
}

@keyframes logo-entrance {
  0% { translate: 0 28px; scale: 0.94; opacity: 0; filter: blur(10px); }
  100% { translate: 0 0; scale: 1; opacity: 1; filter: blur(0); }
}

/* Apple-style staggered entrance for page elements */
@keyframes apple-entrance {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
    filter: blur(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes logo-shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes logo-sub-pulse {
  0%, 100% { scale: 1; opacity: 0.85; }
  50% { scale: 1.05; opacity: 1; color: var(--g-blue); }
}

@keyframes logo-sub-bounce {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -3px; }
}

/* Google Search Box Container */
.search-box-container {
  width: 100%;
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: apple-entrance 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  animation-delay: 0.16s;
}

.search-helper-text {
  font-size: 0.68rem;
  color: var(--g-blue);
  background: rgba(30, 64, 175, 0.06);
  border: 1px solid rgba(30, 64, 175, 0.12);
  padding: 4px 12px;
  border-radius: 99px;
  margin-top: 0.65rem;
  margin-bottom: 0.65rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  
  /* Identity transformations and opacity */
  scale: 1;
  translate: 0 0;
  transition: all 0.3s ease;
  
  /* Apple entrance then continuous pulse (pulse starts after entrance) */
  animation: 
    apple-entrance 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) both,
    helper-pulse 3.5s ease-in-out 1s infinite;
  animation-delay: 0.24s, 1s;
}

@keyframes helper-pulse {
  0%, 100% { opacity: 0.85; scale: 1; }
  50% { opacity: 1; scale: 1.03; color: var(--g-blue); }
}

.search-error-text {
  font-size: 0.72rem;
  color: #ef4444;
  margin-top: 0;
  margin-bottom: 0.9rem;
  text-align: center;
  font-weight: 600;
  display: none;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background: #ffffff;
  border: 2px solid #64748b; /* Thicker border for better visibility */
  border-radius: 8px;
  height: 44px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  
  /* Continuous gentle glow animation to guide user eye */
  animation: search-box-glow 4s ease-in-out infinite;
}

.search-input-wrapper:hover {
  border-color: rgba(30, 64, 175, 0.35);
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.08);
}

.search-input-wrapper:focus-within {
  animation: none; /* Pause pulse on focus */
  border-color: transparent;
  background: 
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, #00c6ff, #1e40af, #7c3aed, #ec4899, #eab308, #00c6ff) border-box;
  background-size: 100% 100%, 400% 400%;
  animation: rainbow-border-flow 6s linear infinite;
  box-shadow: 
    0 0 0 4px rgba(30, 64, 175, 0.08),
    0 0 25px rgba(0, 198, 255, 0.12),
    0 0 50px rgba(124, 58, 237, 0.06),
    0 8px 30px rgba(30, 64, 175, 0.18);
}

@keyframes rainbow-border-flow {
  0% { background-position: 100% 100%, 0% 50%; }
  50% { background-position: 100% 100%, 100% 50%; }
  100% { background-position: 100% 100%, 0% 50%; }
}

.search-input-wrapper:focus-within .search-icon {
  color: var(--g-blue);
  animation: search-icon-bounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes search-box-glow {
  0%, 100% {
    border-color: rgba(226, 232, 240, 0.8);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  }
  50% {
    border-color: rgba(30, 64, 175, 0.35);
    box-shadow: 0 4px 14px rgba(30, 64, 175, 0.08);
  }
}

@keyframes search-icon-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

.search-icon {
  position: absolute;
  left: 12px;
  color: #9aa0a6;
  width: 16px;
  height: 16px;
}

#tracking-input {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px; /* Lock to 16px to prevent iOS Safari auto-zoom viewport jump */
  color: #111827;
  padding: 0 2.5rem;
  font-family: inherit;
}

#tracking-input::placeholder {
  color: #9ca3af !important;
  font-weight: 400;
  font-size: 0.92rem;
  opacity: 0.85;
}

.btn-clear {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: #70757a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  
  /* Smooth opacity & scale fade */
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.btn-clear.show {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.btn-clear:hover {
  color: var(--text-color);
}

/* Detection Box */
.detection-box {
  width: 100%;
  background: #f8fafc;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  box-sizing: border-box;
  
  /* Collapsed State */
  max-height: 0;
  opacity: 0;
  padding: 0 1rem;
  margin-bottom: 0;
  overflow: hidden;
  border: 1px solid transparent;
  pointer-events: none;
  
  /* Fluid Transitions */
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.35s ease,
              padding 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              margin 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.35s ease;
}

.detection-box.show {
  max-height: 120px;
  opacity: 1;
  padding: 0.65rem 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(203, 213, 225, 0.6);
  pointer-events: auto;
  background: rgba(248, 250, 252, 0.75);
  backdrop-filter: blur(16px) saturate(1.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.8);
}

.detection-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.btn-share-result {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  opacity: 0.65;
}

.btn-share-result:hover {
  background-color: rgba(15, 23, 42, 0.05);
  color: var(--text-color);
  opacity: 1;
}

.btn-share-result:active {
  transform: scale(0.92);
}

/* Hide share button when typing is active (input is focused) */
.search-box-container:focus-within ~ #detection-box .btn-share-result {
  display: none !important;
}

.detect-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.detect-badge.thpost {
  background-color: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.detect-badge.flash {
  background-color: rgba(245, 158, 11, 0.08);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.detect-badge.kerry {
  background-color: rgba(249, 115, 22, 0.08);
  color: #ea580c;
  border: 1px solid rgba(249, 115, 22, 0.15);
}

.detect-badge.jt {
  background-color: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.15);
}

.detect-badge.shopee {
  background-color: rgba(249, 115, 22, 0.08);
  color: #ea580c;
  border: 1px solid rgba(249, 115, 22, 0.15);
}

.detect-badge.unknown {
  background-color: rgba(14, 74, 158, 0.06);
  color: #0e4a9e;
  border: 1px solid rgba(14, 74, 158, 0.15);
}

.detect-number {
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-color);
}

/* Buttons Row */
.buttons-row {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  animation: apple-entrance 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  animation-delay: 0.3s;
}

.google-btn {
  background: linear-gradient(135deg, #00c6ff 0%, #1e40af 60%, #1d4ed8 100%);
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.88rem; /* Confident font size */
  font-weight: 700;
  padding: 0.65rem 1.75rem; /* Plumper padding */
  cursor: pointer;
  min-width: 140px; /* Wider button */
  text-align: center;
  background-size: 200% auto;
  box-shadow: 0 4px 14px rgba(30, 64, 175, 0.25);
  
  /* Identity transformations */
  translate: 0 0;
  scale: 1;
  rotate: 0deg;
  
  transition: translate 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              scale 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              box-shadow 0.25s ease, 
              background 0.3s ease,
              background-position 0.25s ease;
              
  /* Apple entrance then continuous pulse (pulse starts after entrance) */
  animation: 
    apple-entrance 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) both,
    button-pulse 3s ease-in-out 1s infinite;
  animation-delay: 0.32s, 1s;
}

.google-btn:hover {
  scale: 1.06;
  translate: 0 -3px;
  box-shadow: 0 8px 28px rgba(30, 64, 175, 0.45);
  background-position: right center;
  color: #ffffff;
}

.google-btn:active {
  scale: 0.96;
  translate: 0 -1px;
  box-shadow: 0 2px 8px rgba(30, 64, 175, 0.2);
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.google-btn .carrier-icon-svg {
  width: 14px !important;
  height: 14px !important;
  stroke-width: 3px !important;
}

/* Exciting wiggle/bounce loop for search button when a courier is detected */
.google-btn.btn-thpost,
.google-btn.btn-shopee,
.google-btn.btn-flash,
.google-btn.btn-kerry,
.google-btn.btn-jt,
.google-btn.btn-best {
  animation: button-detected-wiggle 2.2s ease-in-out infinite !important;
}

/* Dynamic Brand Gradients for Search Button */
.google-btn.btn-thpost {
  background: linear-gradient(135deg, #ff6b6b 0%, #ef4444 60%, #b91c1c 100%) !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25) !important;
}
.google-btn.btn-shopee {
  background: linear-gradient(135deg, #ff8833 0%, #f97316 60%, #c2410c 100%) !important;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25) !important;
}
.google-btn.btn-flash {
  background: linear-gradient(135deg, #fef08a 0%, #facc15 50%, #eab308 100%) !important;
  color: #1e293b !important;
  box-shadow: 0 8px 20px rgba(234, 179, 8, 0.35), 0 2px 8px rgba(234, 179, 8, 0.15) !important;
}
.google-btn.btn-kerry {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 60%, #9a3412 100%) !important;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25) !important;
}
.google-btn.btn-jt {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 60%, #991b1b 100%) !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25) !important;
}
.google-btn.btn-best {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 60%, #1d4ed8 100%) !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25) !important;
}

@keyframes button-detected-wiggle {
  0%, 70%, 100% {
    transform: rotate(0deg) scale(1);
  }
  75%, 85%, 95% {
    transform: rotate(-3deg) scale(1.04);
  }
  80%, 90% {
    transform: rotate(3deg) scale(1.04);
  }
}

@keyframes button-pulse {
  0%, 100% {
    scale: 1;
    box-shadow: 0 4px 12px rgba(0, 114, 255, 0.25);
  }
  50% {
    scale: 1.03;
    box-shadow: 0 6px 18px rgba(0, 114, 255, 0.38);
  }
}

.carrier-tags-helper {
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  line-height: 1.6;
  width: 100%;
  animation: apple-entrance 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  animation-delay: 0.38s;
}

.carrier-tags-helper span {
  font-weight: 600; /* Bolder label text */
  letter-spacing: 0.5px; /* Clean spacing for official look */
  color: var(--text-color); /* Darker gray/black */
}

#carrier-tags-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 340px;
  margin: 0.5rem auto 0;
}

@media (min-width: 480px) {
  #carrier-tags-list {
    grid-template-columns: repeat(3, 1fr);
    max-width: 460px;
    gap: 16px;
  }
}

.courier-tag {
  background: #f1f3f4;
  color: #3c4043;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  border: 1px solid transparent;
  cursor: pointer;
  
  /* Identity transformations for modern individual properties */
  translate: 0 0;
  scale: 1;
  rotate: 0deg;
  
  transition: translate 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              scale 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              box-shadow 0.25s ease, 
              background-color 0.25s ease, 
              color 0.25s ease,
              border-color 0.25s ease;
}

.courier-tag svg {
  /* Identity transformations for SVG icons */
  translate: 0 0;
  scale: 1;
  rotate: 0deg;
  transform-origin: center;
  transition: translate 0.25s ease, scale 0.25s ease, rotate 0.25s ease, filter 0.25s ease;
}

/* Default unselected states: Brand specific border-left accent */
.courier-tag.tag-thpost { border-left: 4px solid #ef4444 !important; }
.courier-tag.tag-shopee { border-left: 4px solid #f97316 !important; }
.courier-tag.tag-flash { border-left: 4px solid #eab308 !important; }
.courier-tag.tag-kerry { border-left: 4px solid #ea580c !important; }
.courier-tag.tag-jt { border-left: 4px solid #dc2626 !important; }
.courier-tag.tag-best { border-left: 4px solid #2563eb !important; }

.courier-tag:hover {
  translate: 0 -4px;
  scale: 1.04;
  background-color: #ffffff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.courier-tag:active {
  scale: 0.96;
  translate: 0 -1px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.courier-tag.selected-active {
  background-color: #ffffff !important;
  scale: 1.04 !important;
  translate: 0 -3px !important;
  box-sizing: border-box;
}

/* Individual Active Selections with Brand Specific Colors */
.courier-tag.tag-thpost.selected-active {
  border-color: #ef4444 !important;
  color: #ef4444 !important;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.22), 0 2px 8px rgba(239, 68, 68, 0.12) !important;
}
.courier-tag.tag-thpost.selected-active svg {
  animation: envelope-bounce 0.6s ease-in-out infinite;
  filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.35));
}

.courier-tag.tag-shopee.selected-active {
  border-color: #f97316 !important;
  color: #f97316 !important;
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.22), 0 2px 8px rgba(249, 115, 22, 0.12) !important;
}
.courier-tag.tag-shopee.selected-active svg {
  animation: bag-sway 0.8s ease-in-out infinite;
  filter: drop-shadow(0 0 2px rgba(249, 115, 22, 0.35));
}

.courier-tag.tag-flash.selected-active {
  border-color: #eab308 !important;
  color: #a16207 !important; /* Dark gold-yellow for perfect contrast on white background */
  box-shadow: 0 8px 20px rgba(234, 179, 8, 0.25), 0 2px 8px rgba(234, 179, 8, 0.12) !important;
}
.courier-tag.tag-flash.selected-active svg {
  animation: lightning-pulse 0.6s ease-in-out infinite;
  filter: drop-shadow(0 0 4px #eab308);
}

.courier-tag.tag-kerry.selected-active {
  border-color: #ea580c !important;
  color: #ea580c !important;
  box-shadow: 0 8px 20px rgba(234, 88, 12, 0.22), 0 2px 8px rgba(234, 88, 12, 0.12) !important;
}
.courier-tag.tag-kerry.selected-active svg {
  animation: truck-drive 0.6s ease-in-out infinite;
  filter: drop-shadow(0 0 2px rgba(234, 88, 12, 0.35));
}

.courier-tag.tag-jt.selected-active {
  border-color: #dc2626 !important;
  color: #dc2626 !important;
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.22), 0 2px 8px rgba(220, 38, 38, 0.12) !important;
}
.courier-tag.tag-jt.selected-active svg {
  animation: box-bounce 0.6s ease-in-out infinite;
  filter: drop-shadow(0 0 2px rgba(220, 38, 38, 0.35));
}

.courier-tag.tag-best.selected-active {
  border-color: #2563eb !important;
  color: #2563eb !important;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.22), 0 2px 8px rgba(37, 99, 235, 0.12) !important;
}
.courier-tag.tag-best.selected-active svg {
  animation: star-spin 1.2s linear infinite;
  filter: drop-shadow(0 0 3px rgba(37, 99, 235, 0.45));
}

/* Individual Courier Branding Hover Accents and Micro-Animations */

/* Thailand Post (Envelope Bounce) */
.courier-tag.tag-thpost svg {
  animation: envelope-bounce 1.2s ease-in-out infinite;
}
.courier-tag.tag-thpost:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.25);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.12);
}
.courier-tag.tag-thpost:hover svg {
  animation: envelope-bounce 0.4s ease-in-out infinite;
  filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.35));
}
@keyframes envelope-bounce {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -3px; }
}

/* Shopee Xpress (Shopping Bag Sway) */
.courier-tag.tag-shopee svg {
  animation: bag-sway 1.4s ease-in-out infinite;
}
.courier-tag.tag-shopee:hover {
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.25);
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.12);
}
.courier-tag.tag-shopee:hover svg {
  animation: bag-sway 0.5s ease-in-out infinite;
  filter: drop-shadow(0 0 2px rgba(249, 115, 22, 0.35));
}
@keyframes bag-sway {
  0%, 100% { rotate: 0deg; }
  25% { rotate: -8deg; }
  75% { rotate: 8deg; }
}

/* Flash Express (Lightning Pulse) */
.courier-tag.tag-flash svg {
  animation: lightning-pulse 1s ease-in-out infinite;
}
.courier-tag.tag-flash:hover {
  color: #d97706;
  border-color: rgba(234, 179, 8, 0.3);
  box-shadow: 0 6px 16px rgba(234, 179, 8, 0.12);
}
.courier-tag.tag-flash:hover svg {
  animation: lightning-pulse 0.4s ease-in-out infinite;
  filter: drop-shadow(0 0 4px #eab308);
}
@keyframes lightning-pulse {
  0%, 100% { scale: 1; }
  50% { scale: 1.25; }
}

/* Kerry Express (Truck Drive/Speed) */
.courier-tag.tag-kerry svg {
  animation: truck-drive 1.2s ease-in-out infinite;
}
.courier-tag.tag-kerry:hover {
  color: #ea580c;
  border-color: rgba(234, 88, 12, 0.25);
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.12);
}
.courier-tag.tag-kerry:hover svg {
  animation: truck-drive 0.4s ease-in-out infinite;
  filter: drop-shadow(0 0 2px rgba(234, 88, 12, 0.35));
}
@keyframes truck-drive {
  0%, 100% { translate: 0 0; }
  50% { translate: 3px 0; }
}

/* J&T Express (Box Bounce) */
.courier-tag.tag-jt svg {
  animation: box-bounce 1.2s ease-in-out infinite;
}
.courier-tag.tag-jt:hover {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.25);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.12);
}
.courier-tag.tag-jt:hover svg {
  animation: box-bounce 0.4s ease-in-out infinite;
  filter: drop-shadow(0 0 2px rgba(220, 38, 38, 0.35));
}
@keyframes box-bounce {
  0%, 100% { scale: 1; }
  50% { scale: 1.15; }
}

/* Best Express (Star Spin) */
.courier-tag.tag-best svg {
  animation: star-spin 3s linear infinite;
}
.courier-tag.tag-best:hover {
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.25);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
}
.courier-tag.tag-best:hover svg {
  animation: star-spin 0.8s linear infinite;
  filter: drop-shadow(0 0 3px rgba(37, 99, 235, 0.45));
}
@keyframes star-spin {
  0% { rotate: 0deg; }
  100% { rotate: 360deg; }
}

/* Google-Style Footer */
.footer {
  background-color: var(--footer-bg);
  border-top: 1px solid var(--footer-border);
  width: 100%;
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-shrink: 0; /* Never shrink footer */
  animation: apple-entrance 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  animation-delay: 0.45s;
}

.footer-row {
  display: flex;
  padding: 0.75rem 1.5rem;
}

.footer-top {
  border-bottom: 1px solid var(--footer-border);
  font-weight: 500;
}

.footer-bottom {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links-left, .footer-links-right {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-link {
  text-decoration: none;
  color: var(--text-secondary);
  transition: color 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}

.footer-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: linear-gradient(90deg, var(--g-blue), #00c6ff);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.footer-link:hover::after {
  transform: scaleX(1);
}

.footer-link:hover {
  color: var(--text-color);
  text-decoration: none;
}

#footer-promo-link {
  font-weight: 700;
  color: var(--g-blue);
}

.footer-disclaimer {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(226, 232, 240, 0.5);
  font-size: 0.65rem;
  color: #94a3b8 !important; /* Muted gray (e.g. Tailwind gray-400) for disclaimer */
  line-height: 1.8;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Toast Messages */
.toast-msg {
  position: fixed;
  bottom: 6rem;
  left: 50%;
  transform: translateX(-50%);
  background: #202124;
  color: white;
  font-size: 0.78rem;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  animation: fadeIn 0.15s ease forwards;
}

/* Responsive Styles */
@media (max-width: 576px) {
  .top-nav {
    padding: 1.75rem 1.25rem 0.5rem !important; /* Added Safe Area notch spacing on mobile! */
  }
  .logo-wrapper {
    margin-bottom: 1rem !important;
  }
  .search-area {
    justify-content: flex-start !important;
    padding-top: 3.5rem !important; /* Position search box in the upper part of viewport, similar to Google's homepage layout */
  }
  .search-box-container {
    margin-bottom: 0.25rem !important;
  }
  .search-helper-text {
    margin-bottom: 0.4rem !important;
  }
  .buttons-row {
    margin-bottom: 0.6rem !important;
  }
  .footer-row {
    padding: 0.5rem 1rem !important;
  }
  .footer-bottom {
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.4rem !important;
    padding-bottom: 0.8rem !important;
  }
  .footer-links-left, .footer-links-right {
    justify-content: center !important;
    gap: 0.75rem !important;
    font-size: 0.7rem !important;
  }
  .footer-disclaimer {
    margin-top: 0.5rem !important;
    padding-top: 0.5rem !important;
    font-size: 0.6rem !important;
    line-height: 1.7 !important;
  }
  .history-list-dropdown {
    max-height: 130px !important; /* Shorter list to prevent screen pushes when virtual keyboard is up */
  }
}

/* Redirect Transition Overlay */
.redirect-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  
  /* Smooth CSS transition instead of instant display toggle */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.redirect-overlay.show {
  opacity: 1;
  visibility: visible;
}

.redirect-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  padding: 1.75rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  
  /* Apple scale-up transition triggered when .show is active */
  transform: scale(0.9) translateY(24px);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.redirect-overlay.show .redirect-card {
  transform: scale(1) translateY(0);
}

/* Spinner Animation */
.spinner-ring {
  width: 32px;
  height: 32px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--g-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 0.25rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.redirect-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-color);
}

.carrier-target-box {
  background: #f8f9fa;
  border: 1px solid #dadce0;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}

.redirect-sub {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.redirect-promo-box {
  margin-top: 0.5rem;
  border-top: 1px dashed var(--border-color);
  padding-top: 0.8rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.redirect-promo-box h4 {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0F172A;
}

.redirect-promo-box p {
  font-size: 0.65rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.btn-promo-inline {
  text-decoration: none;
  background: var(--g-blue);
  color: white;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  transition: background-color 0.15s ease;
  width: 100%;
  margin-top: 0.2rem;
}

.btn-promo-inline:hover {
  background-color: #357ae8;
}

/* PWA Install Banner Pop-up */
.pwa-install-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 480px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 1rem;
  z-index: 10000;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
  0% { transform: translate(-50%, 100px); opacity: 0; }
  100% { transform: translate(-50%, 0); opacity: 1; }
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pwa-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pwa-text {
  flex: 1;
}

.pwa-text h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 0.15rem;
}

.pwa-text p {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.pwa-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-pwa-sec {
  background: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pwa-sec:hover {
  background: #e8eaed;
  color: var(--text-color);
}

.btn-pwa-pri {
  background: var(--g-blue);
  border: 1px solid var(--g-blue);
  border-radius: 6px;
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pwa-pri:hover {
  background: #357ae8;
  border-color: #357ae8;
}

/* For mobile devices, stack content vertically if needed, but flex row is clean */
@media (max-width: 480px) {
  .search-area {
    padding: 1.25rem 1.25rem 1.75rem !important;
    margin: 0.5rem auto !important;
    width: 94%;
    justify-content: flex-start !important;
  }
  .pwa-install-banner {
    width: 94%;
    bottom: 12px;
    padding: 0.8rem;
  }
  .pwa-logo {
    width: 36px;
    height: 36px;
  }
  .pwa-text h4 {
    font-size: 0.78rem;
  }
  .pwa-text p {
    font-size: 0.64rem;
  }
  .btn-pwa-pri, .btn-pwa-sec {
    padding: 0.35rem 0.65rem;
    font-size: 0.68rem;
  }
}

/* Search History Widget Styles */
.btn-toggle-history {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: 9999px;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-toggle-history:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: #cbd5e1;
}

.btn-toggle-history .arrow {
  font-size: 0.65rem;
  transition: transform 0.2s ease;
}

.btn-toggle-history.active .arrow {
  transform: rotate(180deg);
}

.history-container {
  width: 100%;
  margin-top: 1.75rem;
  border-top: 1px solid rgba(226, 232, 240, 0.6);
  padding-top: 1.25rem;
  text-align: left;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.history-header span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.btn-clear-history {
  background: none;
  border: none;
  font-size: 0.68rem;
  font-weight: 600;
  color: #ef4444;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.btn-clear-history:hover {
  background-color: rgba(239, 68, 68, 0.08);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-item:hover {
  border-color: rgba(0, 114, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0, 114, 255, 0.05);
  transform: translateY(-1px);
}

.history-item-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}

.history-item-icon {
  color: var(--text-secondary);
  opacity: 0.5;
  display: flex;
  align-items: center;
}

.history-item-query {
  font-family: monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-color);
}

.history-item-carrier {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: -0.01em;
}

.history-item-delete {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.history-item-delete:hover {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.08);
}

/* Hide footer when keyboard slides up on mobile (short screen height) */
@media (max-height: 520px) {
  .footer {
    display: none !important;
  }
  .search-area {
    padding-top: 1rem !important;
    margin: 1rem auto !important;
    justify-content: flex-start !important;
  }
}

/* Modern Info Modal Style */
.info-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease-out;
  padding: 1.5rem;
}

.info-modal-card {
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  transform: scale(0.95);
  animation: scaleUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.info-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.info-modal-header h3 {
  margin: 0;
  font-family: 'Sarabun', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e293b;
}

.btn-info-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.2s ease;
}

.btn-info-modal-close:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: #1e293b;
}

.info-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  font-family: 'Sarabun', sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #475569;
}

.info-modal-body h4 {
  color: #0f172a;
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.info-modal-body p {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.info-modal-body ul {
  margin-top: 0;
  margin-bottom: 1.25rem;
  padding-left: 1.25rem;
}

.info-modal-body li {
  margin-bottom: 0.5rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  to { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%, 45%, 75% { transform: translateX(-5px); }
  30%, 60%, 90% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.35s cubic-bezier(.36,.07,.19,.97) both;
}

/* Modal overlay with glassmorphism backdrop */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.25s ease-out;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
}

/* Modal Content Card matching Apple/Premium design */
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 480px;
  border-radius: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  pointer-events: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.btn-close-modal {
  background: var(--bg-hover);
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.btn-close-modal:hover {
  background: var(--border-color);
  color: var(--text-main);
}

.modal-body {
  padding: 1rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  background: var(--bg-hover);
}

/* Slide up animation for desktop modal */
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Mobile responsive bottom-sheet for extra premium feel */
@media (max-width: 640px) {
  .modal-overlay {
    align-items: flex-end;
  }
  .modal-content {
    width: 100%;
    max-width: 100%;
    border-radius: 30px 30px 0 0;
    max-height: 70vh;
    animation: slideUpMobile 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-bottom: none;
  }
}

@keyframes slideUpMobile {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.history-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  margin-top: -1px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  
  /* Smooth CSS transition instead of one-way animation */
  opacity: 0;
  visibility: hidden;
  transform: scaleY(0.9) translateY(-10px);
  transform-origin: top center;
  transition: opacity 0.32s cubic-bezier(0.25, 0.8, 0.25, 1), 
              transform 0.32s cubic-bezier(0.25, 0.8, 0.25, 1), 
              visibility 0.32s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.history-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: scaleY(1) translateY(0);
}

/* Adjust parent border radius when dropdown is open */
.search-input-wrapper.dropdown-open {
  border-radius: 8px 8px 0 0;
  border-color: #64748b;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.history-list-dropdown {
  max-height: 240px;
  overflow-y: auto;
}

/* Google-style autocomplete rows */
.history-dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
  text-align: left;
}

.history-dropdown-item:hover {
  background-color: #f8fafc;
}

.history-dropdown-item-left {
  display: grid;
  grid-template-columns: 18px 130px 1fr;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  flex: 1;
}

.history-dropdown-item-icon {
  color: #94a3b8;
  display: flex;
  align-items: center;
  opacity: 0.8;
}

.history-dropdown-item-query {
  font-family: monospace;
  font-size: 0.85rem;
  color: #0f172a;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
}

.history-dropdown-item-carrier {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 0.25rem;
}

.history-dropdown-item-delete {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  font-size: 0.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.history-dropdown-item-delete:hover {
  background-color: #fee2e2;
  color: #ef4444;
}

.history-dropdown-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
  background-color: #f8fafc;
}

.btn-clear-history-dropdown {
  background: none;
  border: none;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease;
}

.btn-clear-history-dropdown:hover {
  color: #0f172a;
  text-decoration: underline;
}

/* ============================================================
   PREMIUM EFFECTS: Apple-Level Visual Polish & Colors
   ============================================================ */

/* 1. Living Gradient Background Blobs — Slowly drifting colored orbs */
.google-layout-container::before,
.google-layout-container::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(90px);
  opacity: 0.5;
}

.google-layout-container::before {
  top: -15%;
  left: -8%;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(0, 198, 255, 0.18) 0%, rgba(30, 64, 175, 0.1) 40%, transparent 70%);
  animation: blob-drift-1 22s ease-in-out infinite;
}

.google-layout-container::after {
  bottom: -18%;
  right: -8%;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(251, 188, 5, 0.14) 0%, rgba(234, 88, 12, 0.08) 40%, transparent 70%);
  animation: blob-drift-2 28s ease-in-out infinite;
}

@keyframes blob-drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(6%, 10%) scale(1.12); }
  50% { transform: translate(-4%, 6%) scale(0.94); }
  75% { transform: translate(10%, -4%) scale(1.06); }
}

@keyframes blob-drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-10%, -6%) scale(1.1); }
  66% { transform: translate(6%, -10%) scale(0.9); }
}

/* 2. Individual Courier Tag Stagger Entrance */
.courier-tag {
  animation: apple-entrance 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
#carrier-tags-list .courier-tag:nth-child(1) { animation-delay: 0.42s; }
#carrier-tags-list .courier-tag:nth-child(2) { animation-delay: 0.49s; }
#carrier-tags-list .courier-tag:nth-child(3) { animation-delay: 0.56s; }
#carrier-tags-list .courier-tag:nth-child(4) { animation-delay: 0.63s; }
#carrier-tags-list .courier-tag:nth-child(5) { animation-delay: 0.70s; }
#carrier-tags-list .courier-tag:nth-child(6) { animation-delay: 0.77s; }
#carrier-tags-list .courier-tag:nth-child(7) { animation-delay: 0.84s; }
#carrier-tags-list .courier-tag:nth-child(8) { animation-delay: 0.91s; }

/* 3. Colorful Courier Tag Hover Glow */
.courier-tag:hover {
  translate: 0 -4px;
  scale: 1.06;
  background-color: #ffffff;
  box-shadow: 
    0 8px 20px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(30, 64, 175, 0.08);
}

/* 4. Enhanced Search Helper Text — Subtle gradient accent */
.search-helper-text::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00c6ff, #1e40af);
  flex-shrink: 0;
  animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}

/* 5. Button Press Haptic-Feel Spring */
.google-btn:active {
  scale: 0.93 !important;
  translate: 0 1px !important;
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.15) !important;
  transition: all 0.08s ease !important;
}

/* 6. Lang Select Hover Glow */
.lang-select:hover {
  border-color: rgba(0, 198, 255, 0.4);
  box-shadow: 0 2px 8px rgba(0, 198, 255, 0.1);
}

.lang-select:focus {
  border-color: var(--g-blue);
  box-shadow: 
    0 0 0 3px rgba(30, 64, 175, 0.08),
    0 4px 12px rgba(30, 64, 175, 0.1);
}

/* 7. Accessibility: Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
