/**
 * HSC Market Insights - Real-time FX & Smart Currency Tooltip System
 * Design: Premium Dark Glassmorphism, Zero Layout Shifts, High DPI
 */

/* --- 1. Hero FX Ticker Widget --- */
.fx-widget-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  white-space: nowrap;
  flex-shrink: 0;
  background: rgba(28, 25, 23, 0.85); /* stone-900 */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(245, 158, 11, 0.35); /* amber-500/35 */
  border-radius: 9999px;
  padding: 0.375rem 0.875rem;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  user-select: none;
}

.fx-widget-badge:hover {
  background: rgba(41, 37, 36, 0.95);
  border-color: rgba(245, 158, 11, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px -2px rgba(245, 158, 11, 0.15), 0 4px 12px rgba(0, 0, 0, 0.5);
}

.fx-pulse-dot {
  position: relative;
  display: flex;
  height: 0.5rem;
  width: 0.5rem;
}

.fx-pulse-dot .fx-ping {
  position: absolute;
  display: inline-flex;
  height: 100%;
  width: 100%;
  border-radius: 9999px;
  background-color: #34d399; /* emerald-400 */
  opacity: 0.75;
  animation: fx-ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.fx-pulse-dot .fx-core {
  position: relative;
  display: inline-flex;
  border-radius: 9999px;
  height: 0.5rem;
  width: 0.5rem;
  background-color: #10b981; /* emerald-500 */
  box-shadow: 0 0 8px #34d399;
}

@keyframes fx-ping {
  75%, 100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.fx-divider {
  width: 1px;
  height: 0.875rem;
  background-color: rgba(120, 113, 108, 0.4); /* stone-700 */
}

/* --- 2. Interactive Convertible Figures (Underline Trigger) --- */
.fx-convertible {
  position: relative;
  display: inline-block;
  cursor: help;
  text-decoration: none;
  border-bottom: 1.5px dashed rgba(245, 158, 11, 0.65);
  transition: all 0.2s ease;
  padding-bottom: 1px;
}

.fx-convertible:hover {
  border-bottom-color: #fbbf24; /* amber-400 */
  color: #fbbf24 !important;
  text-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

/* On card titles/values */
.card-interactive .fx-convertible {
  border-bottom-style: dotted;
}

/* --- 3. Smart Currency Floating Tooltip --- */
#hsc-fx-tooltip {
  position: fixed;
  z-index: 999999;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.97);
  transform-origin: top center;
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: min(320px, calc(100vw - 20px));
  min-width: min(240px, calc(100vw - 20px));
  background: rgba(15, 23, 42, 0.96); /* slate-900 96% */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(245, 158, 11, 0.4); /* amber-500/40 */
  border-radius: 0.875rem;
  padding: 0.75rem 0.95rem;
  box-shadow: 0 20px 30px -8px rgba(0, 0, 0, 0.65),
              0 0 0 1px rgba(255, 255, 255, 0.05),
              0 0 20px rgba(245, 158, 11, 0.12);
  color: #f8fafc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Yu Gothic", "Noto Sans JP", sans-serif;
}

#hsc-fx-tooltip.visible {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) scale(1) !important;
}

#hsc-fx-tooltip .tooltip-arrow {
  position: absolute;
  width: 10px;
  height: 10px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(245, 158, 11, 0.4);
  transform: rotate(45deg);
  pointer-events: none;
}

#hsc-fx-tooltip.arrow-top .tooltip-arrow {
  top: -6px;
  left: calc(50% - 5px);
  border-bottom: none;
  border-right: none;
}

#hsc-fx-tooltip.arrow-bottom .tooltip-arrow {
  bottom: -6px;
  left: calc(50% - 5px);
  border-top: none;
  border-left: none;
}

/* Tooltip Content Typography */
.fx-tt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  padding-bottom: 0.375rem;
  margin-bottom: 0.5rem;
  font-size: 0.6875rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.fx-tt-primary {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  margin-bottom: 0.375rem;
}

.fx-tt-primary-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fbbf24; /* amber-400 */
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.fx-tt-secondary {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: #cbd5e1;
  background: rgba(30, 41, 59, 0.6);
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
}

.fx-tt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.625rem;
  color: #64748b;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  padding-top: 0.375rem;
  line-height: 1.3;
}

/* --- 4. Currency Quick Converter Modal --- */
.fx-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.fx-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.fx-modal-card {
  width: 100%;
  max-width: 420px;
  background: #1e293b; /* slate-800 */
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  transform: translateY(12px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: #f1f5f9;
}

.fx-modal-backdrop.open .fx-modal-card {
  transform: translateY(0) scale(1);
}
