/* ============ BASE ============ */
body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #312e81 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #fff;
}

/* ============ INFO BAR (IP / ISP / CIUDAD) ============ */
.info-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 0;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50px;
    padding: 8px 20px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.75);
    letter-spacing: 0.3px;
}
.info-bar i { margin-right: 4px; opacity: 0.85; }
.info-sep { opacity: 0.3; margin: 0 12px; }

/* ============ GLASSMORPHISM CARD ============ */
.glass-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

/* ============ GAUGE ============ */
.gauge-container { position: relative; width: 260px; height: 260px; margin: 0 auto; }
.gauge-svg { transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 14; }
.gauge-progress {
    fill: none; stroke: url(#gradient); stroke-width: 14;
    stroke-linecap: round; stroke-dasharray: 691; stroke-dashoffset: 691;
    transition: stroke-dashoffset 0.3s ease;
}
.gauge-value {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); text-align: center;
}
.gauge-value .number {
    font-size: 3rem; font-weight: 700;
    background: linear-gradient(135deg, #22d3ee, #a78bfa);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* ============ METRIC BOXES ============ */
.metric-box {
    background: rgba(255,255,255,0.05); border-radius: 16px;
    padding: 20px; text-align: center;
    border: 1px solid rgba(255,255,255,0.08);
    transition: all 0.3s;
}
.metric-box:hover { background: rgba(255,255,255,0.1); transform: translateY(-4px); }
.metric-box .icon { font-size: 1.8rem; margin-bottom: 8px; }
.metric-box .label { font-size: 0.85rem; opacity: 0.7; text-transform: uppercase; letter-spacing: 1px; }
.metric-box .value { font-size: 1.6rem; font-weight: 700; }

/* ============ START BUTTON ============ */
.btn-start {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border: none; padding: 14px 48px; font-weight: 600;
    font-size: 1.1rem; border-radius: 50px; color: #fff;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
    transition: all 0.3s;
}
.btn-start:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.6);
    color: #fff;
}
.btn-start:disabled { opacity: 0.6; cursor: not-allowed; }

/* ============ PHASE INDICATOR ============ */
.phase-indicator { font-size: 0.95rem; opacity: 0.8; min-height: 24px; }

/* ============ TABS PERSONALIZADOS ============ */
.nav-pills .nav-link {
    color: rgba(255,255,255,0.7);
    border-radius: 50px;
    padding: 8px 24px;
    font-weight: 500;
}
.nav-pills .nav-link.active {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #fff;
}

/* ============ CHART ============ */
.chart-container {
    position: relative;
    height: 340px;
    width: 100%;
}

/* ============ STAT SUMMARY CARDS ============ */
.stat-summary-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}
.stat-summary-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}
.stat-summary-card .stat-icon {
    font-size: 1.6rem;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-summary-card .stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 2px;
}
.stat-summary-card .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

/* ============ CONTROLS ============ */
.btn-action-pill {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    border-radius: 50px;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.25s ease;
}
.btn-action-pill:hover {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #fff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ============ HISTORY TABLE WRAPPER ============ */
.history-table-wrapper {
    max-height: 440px;
    overflow-y: auto;
    border-radius: 16px;
    padding-right: 4px;
}
.history-table-wrapper::-webkit-scrollbar {
    width: 6px;
}
.history-table-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}
.history-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
.history-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ============ HISTORY TABLE ============ */
.history-table {
    --bs-table-bg: transparent !important;
    --bs-table-color: #fff !important;
    color: #fff;
    font-size: 0.88rem;
    border-collapse: separate;
    border-spacing: 0 6px;
}
.history-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(12px);
    border: none;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.5) !important;
    font-weight: 600;
    padding: 10px 14px;
}
.history-table tbody tr {
    background: rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px;
    transition: all 0.25s ease;
    animation: rowFadeIn 0.3s ease both;
}
.history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.14) !important;
    transform: translateY(-2px);
    box-shadow: -4px 0 0 #6366f1, 0 8px 24px rgba(0, 0, 0, 0.3);
}
.history-table td,
.history-table .date-cell {
    background: transparent !important;
    border: none;
    padding: 12px 14px;
    vertical-align: middle;
}
.history-table td:first-child { border-radius: 14px 0 0 14px; }
.history-table td:last-child  { border-radius: 0 14px 14px 0; }

/* Posición / Medallas */
.row-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.rank-1 { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; border: none; box-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }
.rank-2 { background: linear-gradient(135deg, #94a3b8, #64748b); color: #fff; border: none; }
.rank-3 { background: linear-gradient(135deg, #b45309, #78350f); color: #fff; border: none; }

/* Badges de valor tipo píldora brillante */
.val-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 4px 12px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.val-badge small {
    font-size: 0.68rem;
    opacity: 0.65;
    font-weight: 400;
}
.val-down {
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.08);
    border-color: rgba(34, 211, 238, 0.2);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.15);
}
.val-up {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.2);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.15);
}
.val-ping {
    color: #34d399;
    background: rgba(52, 211, 153, 0.08);
    border-color: rgba(52, 211, 153, 0.2);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.15);
}

/* Tags de calidad de red */
.quality-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.q-tag-excellent {
    background: rgba(52, 211, 153, 0.12);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.3);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.2);
}
.q-tag-good {
    background: rgba(34, 211, 238, 0.12);
    color: #22d3ee;
    border: 1px solid rgba(34, 211, 238, 0.3);
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.2);
}
.q-tag-fair {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}
.q-tag-slow {
    background: rgba(248, 113, 113, 0.12);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.3);
}

/* Cell de Fecha */
.date-cell .date-day { font-weight: 600; font-size: 0.86rem; color: #f1f5f9; }
.date-cell .date-time { font-size: 0.74rem; opacity: 0.5; color: #94a3b8; }

/* Animación de filas */
@keyframes rowFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============ BADGE COLORS (legacy) ============ */
.badge-down { color: #22d3ee; }
.badge-up   { color: #fbbf24; }
.badge-ping { color: #34d399; }
