/* ===================================================================
   AYASEND PREMIUM ENHANCEMENTS
   All visual polish, micro-interactions, and fintech-grade UX
   =================================================================== */

/* ===========================
   GLOBAL IMPROVEMENTS
   =========================== */

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

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

/* Dark mode transition */
html, body, * {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ===========================
   TYPOGRAPHY IMPROVEMENTS
   =========================== */

/* Better line heights for readability */
p, .text-body {
  line-height: 1.6;
}

/* Strategic font weights */
h1, .heading-1 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2, .heading-2 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

h3, .heading-3 {
  font-weight: 600;
}

/* Gradient text on hero heading */
.hero-heading-gradient {
  background: linear-gradient(135deg, #00E5FF 0%, #0066FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===========================
   RATE CARD HOVER ANIMATIONS
   =========================== */

.rate-card, 
.provider-card,
.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  will-change: transform;
}

.rate-card:hover,
.provider-card:hover,
.card-hover:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 24px rgba(0, 102, 255, 0.12),
              0 4px 8px rgba(0, 229, 255, 0.08);
  border-color: rgba(0, 229, 255, 0.3);
}

.dark .rate-card:hover,
.dark .provider-card:hover,
.dark .card-hover:hover {
  box-shadow: 0 12px 24px rgba(0, 229, 255, 0.18),
              0 4px 8px rgba(0, 229, 255, 0.12);
}

/* ===========================
   BUTTON MICRO-INTERACTIONS
   =========================== */

button,
.btn,
a[role="button"] {
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  will-change: transform;
}

button:active,
.btn:active,
a[role="button"]:active {
  transform: scale(0.97);
}

button:hover:not(:disabled),
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.15);
}

.dark button:hover:not(:disabled),
.dark .btn:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(0, 229, 255, 0.2);
}

button:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===========================
   FOCUS STATES (Accessibility)
   =========================== */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(0, 229, 255, 0.5);
  outline-offset: 2px;
  border-radius: 8px;
}

.dark button:focus-visible,
.dark a:focus-visible,
.dark input:focus-visible,
.dark select:focus-visible,
.dark textarea:focus-visible {
  outline-color: rgba(0, 229, 255, 0.6);
}

/* ===========================
   AMOUNT FIELD ENHANCEMENTS
   =========================== */

/* Pulse animation on value update */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 rgba(0, 229, 255, 0);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
  }
}

.amount-field.value-updated {
  animation: pulse-glow 0.6s ease-out;
}

/* Success glow (when best rate found) */
@keyframes success-glow {
  0%, 100% {
    box-shadow: 0 0 0 rgba(16, 185, 129, 0);
  }
  50% {
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.5);
  }
}

.amount-field.best-rate {
  animation: success-glow 0.8s ease-out;
  border-color: rgba(16, 185, 129, 0.5);
}

/* Number counting animation */
.count-up {
  display: inline-block;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===========================
   LIVE RATE INDICATOR
   =========================== */

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #10b981;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.1);
}

.dark .live-indicator {
  color: #34d399;
  background: rgba(52, 211, 153, 0.15);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse-dot 2s ease-in-out infinite;
}

.dark .live-dot {
  background: #34d399;
}

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

/* Rate timestamp */
.rate-timestamp {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.dark .rate-timestamp {
  color: #94a3b8;
}

/* ===========================
   PROVIDER BADGES
   =========================== */

.provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-best-rate {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: #1f2937;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.badge-fastest {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.badge-popular {
  background: linear-gradient(135deg, #00E5FF 0%, #0066FF 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 229, 255, 0.3);
}

/* ===========================
   COMPARISON HIGHLIGHTS
   =========================== */

.savings-highlight {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.15) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 13px;
  font-weight: 600;
  color: #059669;
}

.dark .savings-highlight {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2) 0%, rgba(16, 185, 129, 0.2) 100%);
  border-color: rgba(52, 211, 153, 0.4);
  color: #34d399;
}

.savings-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Fee comparison bar */
.fee-bar {
  height: 4px;
  border-radius: 2px;
  background: #e2e8f0;
  overflow: hidden;
  position: relative;
}

.dark .fee-bar {
  background: #334155;
}

.fee-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Speed indicator */
.speed-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
}

.dark .speed-badge {
  color: #94a3b8;
}

.speed-icon {
  width: 14px;
  height: 14px;
}

/* ===========================
   TOOLTIPS
   =========================== */

.tooltip-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}

.tooltip-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(100, 116, 139, 0.15);
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.tooltip-icon:hover {
  background: rgba(0, 229, 255, 0.2);
  color: #0066FF;
  transform: scale(1.1);
}

.dark .tooltip-icon {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.dark .tooltip-icon:hover {
  background: rgba(0, 229, 255, 0.25);
  color: #00E5FF;
}

.tooltip-content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 14px;
  background: #1f2937;
  color: white;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.tooltip-trigger:hover .tooltip-content {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}

.tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1f2937;
}

/* ===========================
   DIVIDERS BETWEEN CARDS
   =========================== */

.rate-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(226, 232, 240, 0.5) 50%, transparent 100%);
  margin: 12px 0;
}

.dark .rate-divider {
  background: linear-gradient(90deg, transparent 0%, rgba(51, 65, 85, 0.5) 50%, transparent 100%);
}

/* ===========================
   TOUCH TARGETS (Mobile)
   =========================== */

@media (max-width: 768px) {
  button,
  a[role="button"],
  .clickable {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Ensure all interactive elements meet Apple's guideline */
  input,
  select,
  textarea {
    min-height: 44px;
  }
}

/* ===========================
   PULL-TO-REFRESH INDICATOR
   =========================== */

.pull-refresh-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  padding: 12px 24px;
  background: rgba(0, 229, 255, 0.95);
  color: white;
  border-radius: 0 0 12px 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 229, 255, 0.3);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
}

.pull-refresh-indicator.visible {
  transform: translateX(-50%) translateY(0);
}

/* ===========================
   LOADING SKELETON SHIMMER
   =========================== */

.skeleton {
  background: linear-gradient(
    90deg,
    #f0f4f8 0%,
    #e2e8f0 20%,
    #f0f4f8 40%,
    #f0f4f8 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 8px;
}

.dark .skeleton {
  background: linear-gradient(
    90deg,
    #1e293b 0%,
    #334155 20%,
    #1e293b 40%,
    #1e293b 100%
  );
  background-size: 200% 100%;
}

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

.skeleton-card {
  height: 120px;
  margin-bottom: 12px;
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-text.large {
  height: 24px;
}

/* ===========================
   SUCCESS CHECKMARK ANIMATION
   =========================== */

@keyframes checkmark-draw {
  0% {
    stroke-dashoffset: 50;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.success-checkmark {
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: checkmark-draw 0.5s ease-out forwards;
}

/* ===========================
   MICRO CELEBRATION EFFECT
   =========================== */

@keyframes confetti {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) rotate(360deg);
    opacity: 0;
  }
}

.celebration-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: confetti 0.8s ease-out forwards;
}

/* ===========================
   BETTER EMPTY STATES
   =========================== */

.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  opacity: 0.4;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 8px;
}

.dark .empty-state-title {
  color: #f1f5f9;
}

.empty-state-description {
  font-size: 14px;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 20px;
}

.dark .empty-state-description {
  color: #94a3b8;
}

/* ===========================
   STICKY MOBILE CALCULATOR
   =========================== */

@media (max-width: 768px) {
  .calculator-sticky {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .dark .calculator-sticky {
    background: #0f172a;
    box-shadow: 0 4px 12px rgba(0, 229, 255, 0.15);
  }
  
  .calculator-sticky.visible {
    transform: translateY(0);
  }
  
  .calculator-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  
  .calculator-compact-amount {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
  }
  
  .dark .calculator-compact-amount {
    color: #f1f5f9;
  }
}

/* ===========================
   COLOR ACCENTS & SEMANTIC COLORS
   =========================== */

.text-success {
  color: #10b981;
}

.dark .text-success {
  color: #34d399;
}

.text-warning {
  color: #f59e0b;
}

.dark .text-warning {
  color: #fbbf24;
}

.text-danger {
  color: #ef4444;
}

.dark .text-danger {
  color: #f87171;
}

.text-info {
  color: #0066FF;
}

.dark .text-info {
  color: #00E5FF;
}

/* Background variants */
.bg-success-light {
  background: rgba(16, 185, 129, 0.1);
}

.dark .bg-success-light {
  background: rgba(52, 211, 153, 0.15);
}

.bg-warning-light {
  background: rgba(245, 158, 11, 0.1);
}

.dark .bg-warning-light {
  background: rgba(251, 191, 36, 0.15);
}

.bg-danger-light {
  background: rgba(239, 68, 68, 0.1);
}

.dark .bg-danger-light {
  background: rgba(248, 113, 113, 0.15);
}

/* ===========================
   GLASS MORPHISM EFFECTS
   =========================== */

.glass {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.dark .glass {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(255, 255, 255, 0.1);
}

