/**
 * AyaSend Compact Premium Desktop Experience
 * Version: 7.0 - User Specification Implementation
 * DESKTOP ONLY (≥1024px) - Mobile remains completely untouched
 * 
 * Design Philosophy: Compact efficiency meets premium polish
 * Inspired by: Stripe's clean layouts, Wise's functional elegance
 */

/* ========================================
   1️⃣ LAYOUT - Two Column Grid
   ======================================== */

@media (min-width: 1024px) {
  .hero-layout {
    max-width: 1140px;
    margin: 40px auto 80px;
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    column-gap: 32px;
    align-items: start;
  }
  
  /* Single column when only calculator present */
  .hero-layout:has(> section:only-of-type) {
    grid-template-columns: 1fr;
    max-width: 680px;
  }
  
  .calculator-layout__main {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
}

/* ========================================
   2️⃣ MAIN CARDS - Compact Premium Design
   ======================================== */

@media (min-width: 1024px) {
  /* Card container - side by side */
  .calculator-layout .amount-row {
    display: flex !important;
    gap: 24px !important;
    justify-content: center !important;
    align-items: flex-start !important;
    margin-bottom: 20px !important;
  }
  
  /* Base card styling - Wider for large numbers */
  .calculator-card,
  .amount-card {
    height: 160px !important;
    width: 100% !important;
    max-width: 380px !important;
    padding: 18px 22px !important;
    border-radius: 18px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    
    /* Premium polish */
    border: 2px solid rgba(226, 232, 240, 0.9) !important;
    background: linear-gradient(to bottom, #ffffff 0%, #f9fafb 100%) !important;
    box-shadow: 
      0 2px 4px rgba(15, 23, 42, 0.04),
      0 4px 12px rgba(15, 23, 42, 0.05),
      inset 0 0.5px 0 rgba(255, 255, 255, 0.95) !important;
    
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  
  /* Hover state - Subtle elevation */
  .calculator-card:hover,
  .amount-card:hover {
    border-color: rgba(203, 213, 225, 1) !important;
    box-shadow: 
      0 3px 6px rgba(15, 23, 42, 0.06),
      0 8px 20px rgba(15, 23, 42, 0.08),
      inset 0 0.5px 0 rgba(255, 255, 255, 1) !important;
    transform: translateY(-2px) !important;
  }
  
  /* Focus state - Premium glow */
  .calculator-card:focus-within,
  .amount-card:focus-within {
    border-color: rgba(0, 120, 255, 0.6) !important;
    box-shadow: 
      0 0 0 3px rgba(0, 120, 255, 0.12),
      0 4px 12px rgba(0, 120, 255, 0.15),
      inset 0 0.5px 0 rgba(255, 255, 255, 1) !important;
  }
  
  /* Remove old overlays */
  .calculator-card::before,
  .amount-card::before {
    display: none !important;
  }
  
  /* Dark mode */
  html.dark .calculator-card,
  html.dark .amount-card {
    background: linear-gradient(to bottom, #1e293b 0%, #1a2332 100%) !important;
    border-color: rgba(71, 85, 105, 0.65) !important;
    box-shadow: 
      0 2px 4px rgba(0, 0, 0, 0.2),
      0 4px 12px rgba(0, 0, 0, 0.25),
      inset 0 0.5px 0 rgba(96, 165, 250, 0.06) !important;
  }
}

/* ========================================
   3️⃣ TYPOGRAPHY - Compact & Clear
   ======================================== */

@media (min-width: 1024px) {
  /* Top label - Small & Subtle */
  .calculator-card-label,
  .amount-card__label {
    font-size: 11px !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase !important;
    font-weight: 700 !important;
    color: #64748b !important;
    opacity: 0.85 !important;
    margin-bottom: 12px !important;
    line-height: 1.2 !important;
  }
  
  /* Amount display - Clear & Bold - FIXED FOR LARGE NUMBERS */
  .amount-card__input,
  .calculator-card-input,
  input.amount-card__input,
  input#amount,
  input#receive-amount,
  .amount-card--receive .amount-card__input,
  .calculator-card--receive input {
    font-size: 28px !important;
    line-height: 1.2 !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    letter-spacing: -0.02em !important;
    text-align: left !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    padding: 0 50px 0 0 !important;
    width: 100% !important;
    min-width: 220px !important;
    max-width: none !important;
    
    /* CRITICAL: Allow long numbers (6-10 digits) without clipping */
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    
    /* Ensure proper cursor */
    cursor: text !important;
  }
  
  /* Container for input - centered */
  .amount-card__value {
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Recipient gets - Emphasized with blue */
  .calculator-card--receive .amount-card__input,
  .amount-card--receive .amount-card__input,
  .amount-card--receive .calculator-card-input {
    font-size: 32px !important;
    font-weight: 700 !important;
    color: #0078ff !important;
  }
  
  html.dark .amount-card__input,
  html.dark .calculator-card-input {
    color: #f8fafc !important;
  }
  
  html.dark .calculator-card--receive .amount-card__input,
  html.dark .amount-card--receive .amount-card__input {
    color: #60a5fa !important;
  }
  
  /* Currency pill - Compact & Refined & Centered */
  .amount-card__currency-pill,
  .calculator-card-currency,
  button.amount-card__currency-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 6px 14px !important;
    margin-left: 10px !important;
    height: 32px !important;
    border-radius: 999px !important;
    border: 1.5px solid rgba(148, 163, 184, 0.3) !important;
    background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%) !important;
    color: #475569 !important;
    flex-shrink: 0 !important;
    box-shadow: 
      0 1px 3px rgba(15, 23, 42, 0.08),
      inset 0 0.5px 0 rgba(255, 255, 255, 0.9) !important;
    transition: all 0.15s ease !important;
  }
  
  .amount-card__currency-pill:hover,
  button.amount-card__currency-pill:hover {
    border-color: rgba(148, 163, 184, 0.4) !important;
    background: linear-gradient(to bottom, #eef2f6 0%, #e2e8f0 100%) !important;
  }
  
  html.dark .amount-card__currency-pill,
  html.dark .calculator-card-currency {
    background: linear-gradient(to bottom, #0f172a 0%, #0c1220 100%) !important;
    border-color: rgba(100, 116, 139, 0.45) !important;
    color: #94a3b8 !important;
  }
  
  /* Bottom helper text - Subtle */
  .amount-card__helper,
  .calculator-card-helper {
    font-size: 11px !important;
    color: #94a3b8 !important;
    margin-top: 8px !important;
    line-height: 1.3 !important;
  }
  
  /* ========================================
     CURRENCY PILL CONSISTENCY FIX
     All currency codes identical size - COMPREHENSIVE
     ======================================== */
  
  /* Target ALL possible currency code classes across entire UI */
  .currency-pill,
  .tw-currency,
  .rate-currency,
  .pc-pill,
  .corridor-currency,
  .currency-code,
  .select__value,
  .dropdown-currency,
  .transfer-currency,
  span[class*="currency"],
  div[class*="currency"],
  button[class*="currency"],
  .route-select .currency-code,
  #country-selector-trigger .currency-code {
    /* FORCE identical typography for ALL currency codes */
    font-size: 14px !important;
    font-weight: 600 !important;
    letter-spacing: 0.25px !important;
    line-height: 1 !important;
    
    /* Consistent display */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    
    /* EXACT same dimensions */
    padding: 4px 10px !important;
    height: 26px !important;
    min-width: 45px !important;
    
    /* Consistent styling */
    background: #f1f5f9 !important;
    border-radius: 8px !important;
    
    /* Prevent size variations */
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
  }
  
  /* Specific fix for dropdown/select currency values */
  .route-select .currency-code,
  button.route-select .currency-code,
  #country-selector-trigger .currency-code {
    font-size: 14px !important;
    font-weight: 600 !important;
  }
  
  /* Dark mode: Currency code visibility fix for desktop */
  html.dark .currency-code,
  html.dark .route-select .currency-code,
  html.dark #country-selector-trigger .currency-code,
  .dark .currency-code {
    background: #334155 !important;
    color: #f1f5f9 !important;
  }
  
  /* ========================================
     ROUTE LINE CENTERING FIX
     Perfect centering under amount cards
     ======================================== */
  
  /* Route meta line - "From United States • To Mexico" */
  .route-sub,
  .route-meta {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    
    gap: 6px !important;
    width: 100% !important;
    
    font-size: 14px !important;
    font-weight: 500 !important;
    opacity: 0.85 !important;
    margin: 10px 0 16px !important;
    
    /* Remove any max-width constraints */
    max-width: none !important;
  }
  
  /* Ensure icon stays inline */
  .route-meta-icon {
    flex-shrink: 0 !important;
  }
  
  /* Premium styling for strong text */
  .route-sub-text strong {
    font-weight: 600 !important;
    color: #1e293b !important;
  }
  
  html.dark .route-sub-text strong {
    color: #f1f5f9 !important;
  }
  
  /* ========================================
     RESULTS TABLE LAYOUT FIX
     No overlapping text on desktop
     ======================================== */
  
  /* Rate results container - ensure clean layout */
  #rates .divide-y > div {
    display: grid !important;
    grid-template-columns: 3fr 1.5fr 1.5fr 2.5fr 1.5fr !important;
    column-gap: 20px !important;
    row-gap: 12px !important;
    align-items: start !important;
    padding: 18px 20px !important;
  }
  
  /* Provider column - all content visible */
  #rates .md\:col-span-3 {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    min-width: 0 !important;
    overflow: visible !important;
  }
  
  /* Fee column - clean spacing */
  #rates .md\:col-span-2 {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    min-width: 0 !important;
    overflow: visible !important;
  }
  
  /* You Receive column - proper spacing */
  #rates .md\:col-span-3:has(.text-lg) {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    min-width: 0 !important;
  }
  
  /* Allow text wrapping instead of overflow */
  #rates * {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
  
  /* Badge groups - clean inline layout */
  #rates .flex.items-center.gap-2,
  #rates .flex.items-center.gap-1 {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  
  /* Sub-text lines - proper spacing */
  #rates .text-xs,
  #rates .text-\[10px\] {
    line-height: 1.5 !important;
    margin-top: 4px !important;
  }
  
  /* Fee tier info - compact and clear */
  #rates .mt-1.text-\[10px\] {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
  }
  
  /* Payout clarity text - clear spacing */
  #rates .italic.opacity-90 {
    margin-top: 6px !important;
    line-height: 1.4 !important;
  }
  
  /* Best/Fastest/Instant badges - inline with gap */
  #rates .tag,
  #rates .px-2.py-1 {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }
}

/* ========================================
   4️⃣ POPULAR CORRIDORS - Compact Cards
   ======================================== */

@media (min-width: 1024px) {
  /* Corridor cards - Compact & Clean */
  .popular-corridor-card,
  .corridor-card {
    min-height: 100px !important;
    padding: 16px 18px !important;
    border-radius: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    
    background: #ffffff !important;
    border: 2px solid rgba(226, 232, 240, 0.8) !important;
    box-shadow: 
      0 2px 4px rgba(15, 23, 42, 0.04),
      0 4px 10px rgba(15, 23, 42, 0.05) !important;
    
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  
  .popular-corridor-card:hover,
  .corridor-card:hover {
    border-color: rgba(59, 130, 246, 0.35) !important;
    transform: translateY(-2px) !important;
    box-shadow: 
      0 4px 8px rgba(59, 130, 246, 0.08),
      0 8px 20px rgba(59, 130, 246, 0.1) !important;
  }
  
  html.dark .popular-corridor-card,
  html.dark .corridor-card {
    background: #1e293b !important;
    border-color: rgba(71, 85, 105, 0.55) !important;
  }
  
  /* Horizontal flag layout */
  .pc-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
  }
  
  /* Flags - Visible & Clear */
  .pc-flags {
    flex-shrink: 0 !important;
    font-size: 20px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
  }
  
  /* Route names - Compact & Bold */
  .pc-names {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    line-height: 1.3 !important;
  }
  
  html.dark .pc-names {
    color: #f1f5f9 !important;
  }
  
  /* Currency pill */
  .pc-pill {
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 5px 12px !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
    color: #1e40af !important;
    border: 1px solid rgba(59, 130, 246, 0.2) !important;
    margin-top: 10px !important;
    display: inline-block !important;
  }
  
  html.dark .pc-pill {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%) !important;
    color: #93c5fd !important;
  }
  
  /* Grid layout for corridors */
  .corridor-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 14px !important;
  }
}

/* ========================================
   5️⃣ ROUTE SELECTORS & BUTTONS
   ======================================== */

@media (min-width: 1024px) {
  /* Route line - Clean spacing */
  .route-line,
  .corridor-line {
    margin: 16px 0 !important;
    font-size: 14px !important;
    color: #64748b !important;
  }
  
  /* Preset buttons - Compact & Interactive */
  .preset-amount-btn,
  button.preset-amount-btn {
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
    transition: all 0.15s ease !important;
  }
  
  .preset-amount-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.12) !important;
  }
  
  /* Show rates button - Premium CTA */
  .show-rates-btn,
  button.show-rates-btn {
    padding: 14px 28px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    box-shadow: 
      0 3px 8px rgba(0, 120, 255, 0.14),
      0 8px 20px rgba(0, 120, 255, 0.12) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  
  .show-rates-btn:hover,
  button.show-rates-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 
      0 5px 12px rgba(0, 120, 255, 0.18),
      0 12px 28px rgba(0, 120, 255, 0.16) !important;
  }
}

/* ========================================
   6️⃣ INPUT FUNCTIONALITY - Smooth & Responsive
   ======================================== */

@media (min-width: 1024px) {
  /* CRITICAL: Ensure inputs are fully interactive and clickable */
  .amount-card__input,
  .calculator-card-input,
  input.amount-card__input,
  input#amount,
  input#receive-amount {
    pointer-events: auto !important;
    -webkit-user-select: text !important;
    user-select: text !important;
    cursor: text !important;
    position: relative !important;
    z-index: 100 !important;
    touch-action: manipulation !important;
  }
  
  /* Focus styles */
  .amount-card__input:focus,
  .calculator-card-input:focus,
  input.amount-card__input:focus {
    outline: none !important;
    caret-color: #0078ff !important;
  }
  
  /* Amount row - Centered vertically & horizontally */
  .amount-card__body,
  .calculator-card__body {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    flex: 1 !important;
  }
  
  /* Input wrapper - Proper alignment */
  .amount-card__value-row,
  .calculator-card__value-row {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
  }
  
  /* Ensure no text overlap */
  .amount-card__input-container {
    flex: 1 !important;
    min-width: 0 !important;
  }
}

/* ========================================
   7️⃣ POPULAR CORRIDORS - Premium Desktop Polish
   ======================================== */

@media (min-width: 1024px) {
  /* Popular Corridors container - centered & polished */
  .popular-corridors {
    text-align: center !important;
  }
  
  /* Header - centered with balanced spacing */
  .popular-corridors__header {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    margin-bottom: 16px !important;
  }
  
  /* Title row - icon + text inline */
  .popular-corridors__title {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
  }
  
  /* Subtitle - subtle & centered */
  .popular-corridors__subtitle {
    font-size: 12px !important;
    opacity: 0.75 !important;
    margin: 0 !important;
  }
  
  /* Icon - balanced size */
  .popular-corridors__icon {
    font-size: 18px !important;
  }
  
  /* Corridor cards - premium & clean */
  .popular-corridor-card {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    padding: 12px 14px !important;
    min-height: 100px !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    border: 2px solid rgba(226, 232, 240, 0.9) !important;
    box-shadow: 
      0 2px 4px rgba(15, 23, 42, 0.04),
      0 4px 12px rgba(15, 23, 42, 0.05),
      inset 0 0.5px 0 rgba(255, 255, 255, 0.95) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  
  .popular-corridor-card:hover {
    border-color: rgba(203, 213, 225, 1) !important;
    box-shadow: 
      0 3px 6px rgba(15, 23, 42, 0.06),
      0 8px 20px rgba(15, 23, 42, 0.08),
      inset 0 0.5px 0 rgba(255, 255, 255, 1) !important;
    transform: translateY(-2px) !important;
  }
  
  /* Card header - flags + text */
  .pc-header {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    text-align: left !important;
  }
  
  /* Flags - clean & visible SVG images */
  .pc-flags {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    line-height: 1 !important;
  }
  
  .pc-flag-img {
    width: 20px !important;
    height: 15px !important;
    border-radius: 2px !important;
    object-fit: cover !important;
    display: inline-block !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
  }
  
  .pc-arrow-text {
    font-size: 14px !important;
    color: #94a3b8 !important;
    font-weight: 400 !important;
  }
  
  /* Route names - clear typography */
  .pc-names {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    line-height: 1.3 !important;
  }
  
  /* Card meta - currency pills */
  .pc-meta {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-top: 8px !important;
  }
  
  /* Currency pill - refined */
  .pc-pill {
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 4px 10px !important;
    border-radius: 999px !important;
    background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%) !important;
    color: #475569 !important;
    border: 1.5px solid rgba(148, 163, 184, 0.3) !important;
  }
  
  /* Arrow indicator */
  .pc-arrow {
    font-size: 18px !important;
    color: #94a3b8 !important;
    opacity: 0.6 !important;
  }
  
  .popular-corridor-card:hover .pc-arrow {
    opacity: 1 !important;
    color: #0078ff !important;
  }
  
  /* Dark mode support */
  html.dark .popular-corridor-card {
    background: linear-gradient(to bottom, #1e293b 0%, #1a2332 100%) !important;
    border-color: rgba(71, 85, 105, 0.65) !important;
  }
  
  html.dark .pc-names {
    color: #f1f5f9 !important;
  }
  
  html.dark .pc-pill {
    background: linear-gradient(to bottom, #0f172a 0%, #0c1220 100%) !important;
    border-color: rgba(100, 116, 139, 0.45) !important;
    color: #94a3b8 !important;
  }
}

/* ========================================
   8️⃣ MOBILE PROTECTION - Ensure Untouched
   ======================================== */

@media (max-width: 1023px) {
  /* Explicitly reset to mobile defaults */
  .calculator-layout {
    display: block !important;
  }
  
  .calculator-layout__main,
  .calculator-layout__insights {
    display: block !important;
  }
  
  .calculator-layout .amount-row {
    display: block !important;
  }
}

/* ========================================
   9️⃣ ACCESSIBILITY - Reduced Motion
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  @media (min-width: 1024px) {
    .calculator-card,
    .amount-card,
    .popular-corridor-card,
    .corridor-card,
    .preset-amount-btn,
    .show-rates-btn {
      transition: none !important;
      transform: none !important;
    }
  }
}
