/* ==========================================================================
   MultiBroker Investment Dashboard — Global Stylesheet
   Dark Theme Design System & Tokens (#0b0f17 canvas, slate-900 surfaces)
   ========================================================================== */

:root {
  --bg-canvas: #0b0f17;
  --surface-card: rgba(15, 23, 42, 0.9);
  --surface-table: #020617;
  --border-primary: #1e293b;
  --border-secondary: #334155;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-cyan: #06b6d4;
  --accent-rose: #f43f5e;
}

/* Base Body Styling */
body {
  background-color: var(--bg-canvas);
  color: #e2e8f0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Minimalist Dark Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-canvas);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Interactive Metric Cards */
.metric-card {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.6);
}

/* Top Tab Bar Styles & Subtle Glow Indicator */
.nav-tab-active {
  background-color: #4f46e5 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}
.nav-tab-inactive {
  color: #94a3b8;
  font-weight: 500;
}
.nav-tab-inactive:hover {
  color: #f1f5f9;
  background-color: rgba(30, 41, 59, 0.6);
}

/* Pure CSS Tooltip Subsystem (Supports both .has-tooltip/.tooltip-content and .tooltip/.tooltip-text) */
.has-tooltip,
.tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}

.tooltip-content,
.tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: 130%;
  left: 0; /* Por defecto alineado a la izquierda para expandirse a la derecha (evita recortes) */
  right: auto;
  background-color: #1e293b;
  color: #f8fafc;
  text-align: left;
  padding: 9px 13px;
  border-radius: 8px;
  border: 1px solid #475569;
  font-size: 11px;
  line-height: 1.45;
  white-space: normal;
  width: 280px;
  max-width: min(320px, 90vw);
  z-index: 100;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.85);
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.has-tooltip:hover .tooltip-content,
.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Centered Tooltips for Table Columns */
.tooltip-center .tooltip-content,
.tooltip-center .tooltip-text {
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
}

/* Left-aligned Tooltips for Tickers & First Column */
.tooltip-left .tooltip-content,
.has-tooltip.tooltip-left .tooltip-content,
.tooltip-left .tooltip-text {
  left: 0 !important;
  right: auto !important;
  transform: none !important;
}

/* Right-aligned Tooltips for Rightmost Columns */
.tooltip-right .tooltip-content,
.has-tooltip.tooltip-right .tooltip-content,
.tooltip-right .tooltip-text {
  left: auto !important;
  right: 0 !important;
  transform: none !important;
}

/* Ocultar tooltips estáticos cuando el portal flotante inteligente está activo */
body.has-smart-tooltips .has-tooltip .tooltip-content,
body.has-smart-tooltips .tooltip .tooltip-text {
  display: none !important;
}

/* Custody Transfer Badges */
.badge-traido {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background-color: rgba(69, 26, 3, 0.9);
  color: #fcd34d;
  border: 1px solid rgba(180, 83, 9, 0.7);
}

.badge-enviado {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background-color: rgba(8, 51, 68, 0.9);
  color: #67e8f9;
  border: 1px solid rgba(14, 116, 144, 0.7);
}

.badge-ambos {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background-color: rgba(49, 46, 129, 0.8);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.6);
}

.badge-mercado {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background-color: #1e293b;
  color: #cbd5e1;
}

/* Table Totals Row Accent */
.table-totals-row {
  background-color: #020617;
  border-top: 2px solid rgba(99, 102, 241, 0.6);
  font-weight: 700;
}

/* Drag & Drop Dropzone Styles (Ready for M2) */
.dropzone-container {
  border: 2px dashed #334155;
  transition: all 0.2s ease;
}
.dropzone-container.drag-over {
  border-color: #6366f1;
  background-color: rgba(49, 46, 129, 0.15);
}
