/* ===================================================
   Analytics Tab Styles
   =================================================== */

/* ---- toolbar ---- */
.analytics-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    flex-wrap: wrap;
}
.analytics-toolbar select {
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    border: 1px solid var(--border-color, #333);
    background: var(--bg-secondary, #1e1e2e);
    color: var(--text-primary, #e0e0e0);
    font-size: 0.85rem;
}
.analytics-toolbar .admin-add-btn {
    margin-left: auto;
}

/* ---- overview cards ---- */
.ana-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.ana-card {
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid var(--border-color, #333);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.ana-card-label {
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ana-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #e0e0e0);
    line-height: 1.2;
}
.ana-card-sub {
    font-size: 0.72rem;
    color: var(--text-secondary, #888);
}
.ana-card.danger .ana-card-value { color: #f87171; }

/* ---- trend chart ---- */
.ana-trend-section {
    margin-bottom: 1.5rem;
}
.ana-section-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    margin-bottom: 0.5rem;
}
.ana-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 130px;
    padding: 4px 0;
    overflow-x: auto;
}
.ana-bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    position: relative;
}
.ana-bar {
    width: 100%;
    background: var(--accent, #6c63ff);
    border-radius: 2px 2px 0 0;
    min-width: 4px;
    transition: height 0.3s;
}
.ana-bar.fail {
    background: #f87171;
    position: relative;
    border-radius: 0;
}
.ana-bar-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    color: var(--text-secondary, #888);
    margin-top: 0.4rem;
}
.ana-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}
.ana-legend-dot.ok  { background: var(--accent, #6c63ff); }
.ana-legend-dot.fail { background: #f87171; }

/* ---- tables ---- */
.ana-tables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 900px) {
    .ana-tables-grid { grid-template-columns: 1fr; }
}
.ana-table-section {
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid var(--border-color, #333);
    border-radius: 10px;
    overflow: hidden;
}
.ana-table-header {
    padding: 0.7rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    border-bottom: 1px solid var(--border-color, #333);
}
.ana-table-wrap {
    overflow-x: auto;
    max-height: 320px;
    overflow-y: auto;
}
.ana-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.ana-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    color: var(--text-secondary, #888);
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
    background: var(--bg-secondary, #1e1e2e);
    border-bottom: 1px solid var(--border-color, #333);
}
.ana-table td {
    padding: 0.45rem 0.75rem;
    color: var(--text-primary, #e0e0e0);
    border-bottom: 1px solid var(--border-color, #222);
    white-space: nowrap;
}
.ana-table tbody tr:hover {
    background: rgba(108, 99, 255, 0.06);
}
.ana-name-cell {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ana-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.ana-ts {
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
}
.ana-warn { color: #f87171; font-weight: 600; }

.ana-empty {
    text-align: center;
    color: var(--text-secondary, #888);
    padding: 1.5rem 1rem;
    font-style: italic;
}

/* ---- error / spinner ---- */
#analytics-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #f87171;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.82rem;
    margin-bottom: 1rem;
}
#analytics-spinner {
    display: none;
}

/* ---- severity filter group ---- */
.ana-severity-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.ana-severity-label {
    font-size: 0.78rem;
    color: var(--text-secondary, #888);
    white-space: nowrap;
}
.ana-severity-group select {
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    border: 1px solid var(--border-color, #333);
    background: var(--bg-secondary, #1e1e2e);
    color: var(--text-primary, #e0e0e0);
    font-size: 0.82rem;
}

/* ---- section sub-label ---- */
.ana-section-sub {
    font-size: 0.72rem;
    color: var(--text-secondary, #888);
    font-weight: 400;
    margin-left: 0.5rem;
}

/* ---- full width table sections ---- */
.ana-full-width {
    width: 100%;
}

/* ---- severity badges ---- */
.ana-sev-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.ana-sev-verbose  { background: rgba(140, 140, 140, 0.15); color: #999; }
.ana-sev-info     { background: rgba(59, 130, 246, 0.12); color: #60a5fa; }
.ana-sev-warn     { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.ana-sev-error    { background: rgba(248, 113, 113, 0.12); color: #f87171; }
.ana-sev-critical { background: rgba(220, 38, 38, 0.2); color: #ff4444; font-weight: 700; }

/* ---- trace message cell ---- */
.ana-trace-msg {
    max-width: 500px;
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
}

/* ---- response code badges ---- */
.ana-code-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-mono, monospace);
}
.ana-code-2xx { background: rgba(34, 197, 94, 0.12); color: #4ade80; }
.ana-code-3xx { background: rgba(59, 130, 246, 0.12); color: #60a5fa; }
.ana-code-4xx { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.ana-code-5xx { background: rgba(248, 113, 113, 0.12); color: #f87171; }

/* ---- inline bar for response code breakdown ---- */
.ana-bar-inline {
    display: inline-block;
    width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    vertical-align: middle;
    margin-right: 6px;
}
.ana-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}
.ana-bar-fill.ana-code-2xx { background: #4ade80; }
.ana-bar-fill.ana-code-3xx { background: #60a5fa; }
.ana-bar-fill.ana-code-4xx { background: #fbbf24; }
.ana-bar-fill.ana-code-5xx { background: #f87171; }
.ana-bar-pct {
    font-size: 0.72rem;
    color: var(--text-secondary, #888);
    vertical-align: middle;
}
