/* ============================================================
   ESTILO_KPI_TRM.CSS - Estilos exclusivos para KPIs de TRM (Tasa de Rendimiento Medio)
   (NO contiene estilos de NAV - vienen de estilo_base.css)
   ============================================================ */

/* Fondo de la página */
body {
    background: linear-gradient(135deg, #0a0c10 0%, #14181f 100%);
    color: #fff;
    font-family: 'Inter', sans-serif;
}

/* Variables específicas para TRM */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #10b981;
    --accent: #8b5cf6;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark-900: #0a0c10;
    --dark-800: #14181f;
    --dark-700: #1e242c;
    --dark-600: #2d3748;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --border-light: rgba(255,255,255,0.05);
    --card-bg: rgba(30, 36, 44, 0.7);
}

/* ============================================================
   UTILIDADES RESPONSIVAS
============================================================ */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: clamp(0.8rem, 3vw, 1rem);
}

@media (min-width: 640px) {
    .container {
        padding: clamp(1rem, 3vw, 1.5rem);
    }
}

@media (min-width: 1024px) {
    .container {
        padding: clamp(1.5rem, 3vw, 2rem);
    }
}

/* ============================================================
   HEADER
============================================================ */
.dashboard-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: clamp(1rem, 4vw, 1.5rem);
}

@media (min-width: 768px) {
    .dashboard-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-bottom: clamp(1.5rem, 4vw, 2rem);
    }
}

.header-title h1 {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.3rem;
    line-height: 1.2;
}

.header-title p {
    color: var(--gray-400);
    font-size: clamp(0.75rem, 3vw, 0.9rem);
}

.header-date {
    background: rgba(255,255,255,0.05);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    border: 1px solid var(--border-light);
    backdrop-filter: blur(10px);
    font-size: clamp(0.8rem, 3vw, 0.9rem);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
}

.header-date i {
    color: var(--primary);
}

/* ============================================================
   KPI GRID
============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(0.8rem, 3vw, 1rem);
    margin-bottom: clamp(1rem, 4vw, 1.5rem);
}

@media (min-width: 480px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: clamp(1rem, 3vw, 1.5rem);
        margin-bottom: clamp(1.5rem, 4vw, 2rem);
    }
}

.kpi-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: clamp(1rem, 3vw, 1.5rem);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    border-color: rgba(59, 130, 246, 0.3);
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-icon {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    margin-bottom: clamp(0.5rem, 2vw, 1rem);
    color: var(--primary);
}

.kpi-label {
    color: var(--gray-400);
    font-size: clamp(0.65rem, 2.5vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

.kpi-value {
    font-size: clamp(1.2rem, 5vw, 2.2rem);
    font-weight: 700;
    margin-bottom: 0.3rem;
    line-height: 1.2;
    word-break: break-word;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: clamp(0.65rem, 2.5vw, 0.85rem);
    color: var(--gray-400);
    flex-wrap: wrap;
}

.trend-up { 
    color: #10b981; 
}

.trend-down { 
    color: #ef4444; 
}

/* ============================================================
   CHARTS GRID
============================================================ */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(1rem, 4vw, 1.5rem);
    margin-bottom: clamp(1rem, 4vw, 1.5rem);
}

@media (min-width: 1024px) {
    .charts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: clamp(1.2rem, 4vw, 1.8rem);
        margin-bottom: clamp(1.5rem, 4vw, 2rem);
    }
}

.chart-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: clamp(0.8rem, 3vw, 1.5rem);
    transition: all 0.3s ease;
    width: 100%;
    overflow: hidden;
}

.chart-card:hover {
    border-color: rgba(59, 130, 246, 0.2);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.chart-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

@media (min-width: 480px) {
    .chart-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.chart-header h3 {
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-header span {
    color: var(--primary);
    font-size: 0.8rem;
    padding: 0.2rem 0.8rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 50px;
    width: fit-content;
}

.chart-container {
    width: 100%;
    height: clamp(250px, 40vw, 350px);
}

/* ============================================================
   STATS ROW
============================================================ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(0.5rem, 2vw, 0.8rem);
    margin-bottom: clamp(1rem, 4vw, 1.5rem);
}

@media (min-width: 640px) {
    .stats-row {
        grid-template-columns: repeat(4, 1fr);
        gap: clamp(0.6rem, 2vw, 1rem);
    }
}

.stat-item {
    background: rgba(30, 36, 44, 0.3);
    border-radius: 16px;
    padding: clamp(0.6rem, 2vw, 1rem);
    text-align: center;
    border: 1px solid rgba(255,255,255,0.03);
}

.stat-value {
    font-size: clamp(0.9rem, 4vw, 1.3rem);
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: clamp(0.6rem, 2.5vw, 0.8rem);
    color: var(--gray-400);
}

/* ============================================================
   QUICK ACTIONS
============================================================ */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.4rem, 2vw, 0.6rem);
    justify-content: flex-start;
    margin-top: 1rem;
}

@media (min-width: 768px) {
    .quick-actions {
        gap: clamp(0.6rem, 2vw, 1rem);
        justify-content: flex-end;
    }
}

.action-btn {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #fff;
    padding: clamp(0.4rem, 2vw, 0.6rem) clamp(0.8rem, 3vw, 1.2rem);
    border-radius: 50px;
    font-size: clamp(0.7rem, 2.5vw, 0.9rem);
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 auto;
    justify-content: center;
}

@media (min-width: 480px) {
    .action-btn {
        flex: 0 1 auto;
        padding: clamp(0.5rem, 2vw, 0.6rem) clamp(1rem, 3vw, 1.2rem);
    }
}

.action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* ============================================================
   FOOTER DASHBOARD
============================================================ */
.dashboard-footer {
    margin-top: 2rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    text-align: center;
}

@media (min-width: 768px) {
    .dashboard-footer {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

.footer-copyright {
    color: var(--gray-400);
    font-size: 0.8rem;
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.footer-social a {
    color: var(--gray-400);
    font-size: clamp(1rem, 4vw, 1.2rem);
    transition: color 0.3s ease;
}

.footer-social a:hover {
    color: var(--primary);
}

@media (min-width: 768px) {
    .footer-social a {
        font-size: clamp(1rem, 2vw, 1.3rem);
    }
}

/* ============================================================
   UTILIDADES
============================================================ */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Fix para gráficas en móvil */
.js-plotly-plot, 
.plot-container {
    width: 100% !important;
    height: 100% !important;
}

.svg-container {
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
}

/* ============================================================
   DARK MODE - AJUSTES ADICIONALES
============================================================ */
.dark-mode .kpi-card,
.dark-mode .chart-card,
.dark-mode .stat-item {
    background: rgba(30, 36, 44, 0.5);
}

.dark-mode .header-date {
    background: rgba(0,0,0,0.3);
}

.dark-mode .footer-copyright {
    color: #6b7280;
}

.trend-up {
    color: #10b981;
}
.trend-down {
    color: #ef4444;
}

/* ============================================================
   ESTILOS FALTANTES PARA PRESENTACIÓN
   ============================================================ */

/* Header y logo */
.logo {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo span {
  -webkit-text-fill-color: #3b82f6;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: rgba(22, 28, 38, 0.85);
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  border: 1px solid rgba(255,255,255,0.08);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.live-dot {
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

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

/* Ticker */
.ticker-wrap {
  background: rgba(22, 28, 38, 0.85);
  border-top: 1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  padding: 0.6rem 0;
  margin-bottom: 1.5rem;
}

.ticker {
  display: flex;
  animation: ticker-scroll 60s linear infinite;
  white-space: nowrap;
}

.ticker:hover { animation-play-state: paused; }

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  margin-right: 2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.ticker-sym { font-weight: 600; color: #e5eaf3; }
.ticker-val { color: #94a3b8; }
.ticker-chg.up { color: #10b981; }
.ticker-chg.dn { color: #ef4444; }

/* Dashboard y secciones */
.dashboard {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem 2rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 1rem;
  color: #e5eaf3;
  border-left: 3px solid #3b82f6;
  padding-left: 0.8rem;
}

/* Main Grid */
.main-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Paneles */
.panel {
  background: rgba(22, 28, 38, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  overflow: hidden;
}

.panel-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.panel-title { font-weight: 600; color: #e5eaf3; }
.panel-badge {
  font-size: 0.65rem;
  padding: 0.2rem 0.6rem;
  background: rgba(59, 130, 246, 0.15);
  border-radius: 20px;
  color: #3b82f6;
}

.panel-body { padding: 0.8rem 1.2rem 1.2rem; }

/* Watchlist */
.watch-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.watch-item:last-child { border-bottom: none; }
.watch-sym { font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.watch-sym-up { color: #10b981; }
.watch-sym-dn { color: #ef4444; }
.watch-name { font-size: 0.75rem; color: #94a3b8; flex: 1; }
.watch-price { font-family: 'JetBrains Mono', monospace; font-weight: 500; color: #e5eaf3; }
.watch-chg { font-size: 0.75rem; font-weight: 500; }
.watch-chg.up { color: #10b981; }
.watch-chg.dn { color: #ef4444; }

/* Tabla */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table th, .data-table td {
  padding: 0.6rem 0.4rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.data-table th { text-align: left; color: #94a3b8; font-weight: 500; }
.data-table td:last-child, .data-table th:last-child { text-align: right; }
.data-table td:first-child { text-align: left; }

/* Badges */
.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 500;
}
.badge.up { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge.dn { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

/* KPI Bar */
.kpi-bar {
  height: 3px;
  border-radius: 3px;
  margin-top: 0.8rem;
  background: rgba(255,255,255,0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard { padding: 0 1rem 1rem; }
  .main-grid { grid-template-columns: 1fr; }
  .ticker-item { font-size: 0.7rem; }
  .kpi-value { font-size: 1.2rem; }
}