/* ==========================================================================
   DASHBOARD - SISTEMA DE METRICAS Y DESARROLLO (OPERACIONES IP)
   Corporate Identity: Telecom Precision Analytics (Stitch)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. GRID & LAYOUT (12-Column Desktop, 8 Tablet, 4 Mobile)
   -------------------------------------------------------------------------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
    margin: 1.5rem;
}

@media (max-width: 1439px) {
    .dashboard-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
        margin: 1rem;
    }
}

@media (max-width: 767px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        margin: 1rem;
        gap: 0.75rem;
    }
}

.col-span-full { grid-column: 1 / -1; }
.col-span-4 { grid-column: span 4 / span 4; }
.col-span-8 { grid-column: span 8 / span 8; }
.col-span-12 { grid-column: span 12 / span 12; }
.col-span-3 { grid-column: span 3 / span 3; }
.col-span-6 { grid-column: span 6 / span 6; }

/* --------------------------------------------------------------------------
   2. CONTENEDORES Y TARJETAS KPI (GLASSMORPHISM)
   -------------------------------------------------------------------------- */
.dashboard-kpi-card {
    background-color: var(--panel);
    border: 1px solid var(--border);
    border-radius: 0.5rem; /* rounded-lg */
    padding: 0.875rem 1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    overflow: hidden;
}

.dashboard-kpi-card:hover {
    transform: translateY(-1px);
    border-color: #93C5FD;
    box-shadow: 0 4px 12px rgba(28, 88, 168, 0.06);
}

/* Tarjeta Hero KPI (Meta Ponderada de Produccion) */
.dashboard-hero-kpi {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.15) 0%, rgba(10, 15, 29, 0.8) 100%);
    backdrop-filter: blur(24px) saturate(180%);
    color: #FFFFFF;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid rgba(13, 110, 253, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 8px 28px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.dashboard-kpi-value {
    font-family: 'Inter', monospace;
    font-weight: 700;
    letter-spacing: -0.025em;
    font-feature-settings: "tnum" 1, "zero" 1;
}

/* Pildoras de Tendencia / Variacion (Pill Trends) */
.kpi-trend-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    line-height: 1;
}

.kpi-trend-pill.positive {
    background-color: var(--emerald-tint);
    color: var(--emerald);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.kpi-trend-pill.warning {
    background-color: var(--yellow-tint);
    color: var(--yellow);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.kpi-trend-pill.negative {
    background-color: var(--crimson-tint);
    color: var(--crimson);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* --------------------------------------------------------------------------
   3. BARRAS DE PROGRESO Y DISTRIBUCION DE PUNTOS
   -------------------------------------------------------------------------- */
.dashboard-progress-track {
    height: 0.5rem;
    background-color: rgba(255, 255, 255, 0.06);
    border-radius: 0.125rem; /* rounded-sm */
    overflow: hidden;
    position: relative;
}

.dashboard-progress-fill {
    height: 100%;
    border-radius: 0.125rem;
    transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Colores Segun Celula Tecnica */
.progress-fill-ftth {
    background: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 100%);
}

.progress-fill-cabecera {
    background: linear-gradient(90deg, var(--yellow) 0%, #D97706 100%);
}

.progress-fill-telefonia {
    background: linear-gradient(90deg, #818CF8 0%, #4F46E5 100%);
}

/* --------------------------------------------------------------------------
   4. CONTENEDORES DE GRAFICAS INTERACTIVAS (CHART.JS)
   -------------------------------------------------------------------------- */
.dashboard-chart-card {
    background-color: var(--panel);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
    animation: stitch-fade-in-up 0.4s cubic-bezier(0.2, 0, 0, 1) forwards;
}

.dashboard-chart-card:nth-child(1) { animation-delay: 0.1s; }
.dashboard-chart-card:nth-child(2) { animation-delay: 0.15s; }
.dashboard-chart-card:nth-child(3) { animation-delay: 0.2s; }

.dashboard-chart-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
    border-color: #CBD5E1;
}

html[data-theme="dark"] .dashboard-chart-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
html[data-theme="dark"] .dashboard-chart-card:hover {
    border-color: rgba(91, 155, 224, 0.4);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.dashboard-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-2);
}

.dashboard-chart-canvas-wrapper {
    position: relative;
    width: 100%;
    min-height: 240px;
}

/* --------------------------------------------------------------------------
   5. TABLAS CORPORATIVAS DE METRICAS Y AUDITORIA
   -------------------------------------------------------------------------- */
.table-corporate-metrics {
    width: 100%;
    text-align: left;
    border-collapse: separate;
    border-spacing: 0;
}

.table-corporate-metrics thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    background-color: var(--border-2);
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-corporate-metrics tbody td {
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    transition: background-color 120ms ease;
    font-feature-settings: "tnum" 1, "zero" 1;
}

.table-corporate-metrics tbody tr {
    transition: background-color 0.15s ease;
}

.table-corporate-metrics tbody tr:hover {
    background-color: var(--border-2);
}

html[data-theme="dark"] .table-corporate-metrics thead th {
    background-color: rgba(15, 23, 42, 0.85);
    color: var(--muted);
}
html[data-theme="dark"] .table-corporate-metrics tbody td {
    color: #E2E8F0;
    border-bottom-color: var(--border);
}
html[data-theme="dark"] .table-corporate-metrics tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

/* --------------------------------------------------------------------------
   6. PILDORAS Y BOTONES DE FILTRADO
   -------------------------------------------------------------------------- */
.dashboard-filter-pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    cursor: pointer;
    transition: all 150ms ease;
}

.dashboard-filter-pill:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
}

.dashboard-filter-pill.active {
    background-color: var(--brand);
    color: #FFFFFF !important;
    border-color: var(--brand);
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* --------------------------------------------------------------------------
   7. MODAL Y DIALOGOS DE APOYO
   -------------------------------------------------------------------------- */
.dashboard-modal-backdrop {
    background-color: rgba(10, 15, 29, 0.75);
    backdrop-filter: blur(8px);
}

.dashboard-modal-surface {
    background-color: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.5rem;
    box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   8. SISTEMA DE TABS — NAVEGACIÓN PRINCIPAL (VISTA OPERATIVA, RENDIMIENTO, AUDITORÍA)
   -------------------------------------------------------------------------- */

/* Contenedor pill de tabs */
.dash-tab-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    background-color: #F1F5F9;
    border-radius: 0.75rem;
    border: 1px solid #E2E8F0;
}

html[data-theme="dark"] .dash-tab-nav {
    background-color: rgba(15, 23, 42, 0.7);
    border-color: var(--border);
}

/* Botón base de tab */
.dash-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: 1.5px solid transparent;
    transition:
        color 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.15s ease;
    white-space: nowrap;
    position: relative;
}

/* Hover suave (sin estar activo) */
.dash-tab-btn:not(.dash-tab-active):hover {
    color: var(--text);
    background-color: rgba(28, 88, 168, 0.06);
    border-color: rgba(28, 88, 168, 0.15);
}

html[data-theme="dark"] .dash-tab-btn:not(.dash-tab-active):hover {
    background-color: rgba(91, 155, 224, 0.1);
    color: var(--text);
    border-color: rgba(91, 155, 224, 0.2);
}

/* Estado activo — borde inferior corporativo + fondo contrastante */
.dash-tab-btn.dash-tab-active {
    background-color: #FFFFFF;
    color: var(--brand);
    font-weight: 700;
    border-color: var(--border);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(28, 88, 168, 0.08) inset;
    /* Borde inferior corporativo de 2px */
    border-bottom: 2px solid var(--brand);
}

html[data-theme="dark"] .dash-tab-btn.dash-tab-active {
    background-color: var(--panel);
    color: var(--brand);
    border-color: var(--border);
    border-bottom: 2px solid var(--brand);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* Icono del tab activo hereda el color */
.dash-tab-btn.dash-tab-active i,
.dash-tab-btn.dash-tab-active svg {
    color: inherit;
}

/* --------------------------------------------------------------------------
   9. TARJETAS KPI AUDIT (AUDITORIA FORENSE) — ALINEACIÓN DE BORDES
   -------------------------------------------------------------------------- */

.card-audit-kpi-blue {
    background: linear-gradient(135deg, #EAF2FC 0%, #F0F7FF 100%);
    border: 1px solid #BFDBF7;
    border-radius: 0.625rem;
}

.card-audit-kpi-purple {
    background: linear-gradient(135deg, #F3F0FF 0%, #FAF7FF 100%);
    border: 1px solid #D4BBFB;
    border-radius: 0.625rem;
}

.card-audit-kpi-amber {
    background: linear-gradient(135deg, #FEF6E0 0%, #FFFBF0 100%);
    border: 1px solid #F6E0A0;
    border-radius: 0.625rem;
}

html[data-theme="dark"] .card-audit-kpi-blue {
    background: rgba(91, 155, 224, 0.08);
    border-color: rgba(91, 155, 224, 0.2);
}

html[data-theme="dark"] .card-audit-kpi-purple {
    background: rgba(129, 140, 248, 0.08);
    border-color: rgba(129, 140, 248, 0.2);
}

html[data-theme="dark"] .card-audit-kpi-amber {
    background: rgba(245, 194, 77, 0.08);
    border-color: rgba(245, 194, 77, 0.2);
}

/* --------------------------------------------------------------------------
   10. BADGE KPI — ESTADO DE COLA (reemplaza semántica de bandeja)
   -------------------------------------------------------------------------- */
.badge-kpi-normal {
    background-color: #ECFDF5;
    color: #059669;
    border: 1px solid #A7F3D0;
}

.badge-kpi-alert {
    background-color: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FECACA;
}

/* --------------------------------------------------------------------------
   11. ESTÁNDAR TELCO INDUSTRIAL (DATADOG/CLOUDFLARE STYLE DENSITY)
   -------------------------------------------------------------------------- */

/* Tablas de Alta Densidad (py-1.5 a py-2) */
.table-corporate-metrics {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.table-corporate-metrics th {
    padding: 0.4rem 0.65rem !important;
    font-size: 0.6875rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: var(--muted) !important;
    background-color: #F8FAFC !important;
    border-bottom: 1px solid var(--border) !important;
    white-space: nowrap;
}
.table-corporate-metrics td {
    padding: 0.45rem 0.65rem !important;
    font-size: 0.75rem !important;
    border-bottom: 1px solid var(--border-2) !important;
    vertical-align: middle;
}
html[data-theme="dark"] .table-corporate-metrics th {
    background-color: #0E1728 !important;
    color: var(--muted) !important;
}

/* Badges DERS Oficiales (P1 a P5) */
.badge-ders-p1, .badge-ders-p2, [data-ders="P1"], [data-ders="P2"] {
    background-color: #F1F5F9 !important;
    color: #334155 !important;
    border: 1px solid #CBD5E1 !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    font-size: 10px !important;
    padding: 1px 6px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    display: inline-flex;
    align-items: center;
}
.badge-ders-p3, [data-ders="P3"] {
    background-color: #FFFBEB !important;
    color: #92400E !important;
    border: 1px solid #FCD34D !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    font-size: 10px !important;
    padding: 1px 6px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    display: inline-flex;
    align-items: center;
}
.badge-ders-p4, .badge-ders-p5, [data-ders="P4"], [data-ders="P5"] {
    background-color: #FFF1F2 !important;
    color: #BE123C !important;
    border: 1px solid #FDA4AF !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    font-size: 10px !important;
    padding: 1px 6px !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
    display: inline-flex;
    align-items: center;
}

/* Telemetría industrial monoespaciada */
.telemetry-mono, .font-mono {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    font-feature-settings: "tnum" 1, "zero" 1;
}


