/* ═══════════════════════════════════════════════════════════════════════
 * AI Results — Rich visual presentation styles
 * ═══════════════════════════════════════════════════════════════════════ */

/* ── Summary Cards ─────────────────────────────────────────────────── */
.ar-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.ar-summary-card {
    background: var(--bg-elevated, #1a2535);
    border: 1px solid var(--border-color, #1f2a36);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border-color .2s, transform .15s;
}
.ar-summary-card:hover {
    border-color: rgba(76, 201, 240, .2);
    transform: translateY(-1px);
}
.ar-summary-icon {
    font-size: 20px;
    opacity: .8;
    flex-shrink: 0;
}
.ar-summary-body { min-width: 0; }
.ar-summary-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.3px;
}
.ar-summary-label {
    font-size: 11px;
    color: #6b7f94;
    margin-top: 2px;
    line-height: 1.3;
}
.ar-summary-sub {
    font-size: 9px;
    color: #4a5568;
    margin-top: 2px;
}

/* ── Panels ────────────────────────────────────────────────────────── */
.ar-panel {
    background: var(--bg-elevated, #1a2535);
    border: 1px solid var(--border-color, #1f2a36);
    border-radius: 10px;
    margin-bottom: 14px;
    overflow: hidden;
}
.ar-panel-header {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #99aabb;
    border-bottom: 1px solid var(--border-color, #1f2a36);
    display: flex;
    align-items: center;
    gap: 8px;
}
.ar-panel-header i {
    color: #4cc9f0;
    font-size: 13px;
}
.ar-panel-body {
    padding: 16px;
}

/* ── Data Tables ───────────────────────────────────────────────────── */
.ar-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.ar-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.ar-table th {
    text-align: left;
    padding: 8px 10px;
    color: #6b7f94;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    white-space: nowrap;
}
.ar-table td {
    padding: 8px 10px;
    color: #99aabb;
    border-bottom: 1px solid rgba(255,255,255,.03);
    vertical-align: middle;
}
.ar-table tr:hover td {
    background: rgba(76, 201, 240, .03);
}
.ar-table tr:last-child td {
    border-bottom: none;
}

/* ── Bar / Progress ────────────────────────────────────────────────── */
.ar-bar {
    display: inline-block;
    width: 80px;
    height: 6px;
    background: rgba(255,255,255,.06);
    border-radius: 3px;
    overflow: hidden;
    vertical-align: middle;
    margin-right: 4px;
}
.ar-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .6s ease;
}

/* ── Bar Chart ─────────────────────────────────────────────────────── */
.ar-barchart { padding: 4px 0; }
.ar-barchart-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.ar-barchart-label {
    width: 120px;
    flex-shrink: 0;
    font-size: 11px;
    color: #8899aa;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ar-barchart-track {
    flex: 1;
    height: 14px;
    background: rgba(255,255,255,.04);
    border-radius: 4px;
    overflow: hidden;
}
.ar-barchart-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .6s ease;
    min-width: 2px;
}
.ar-barchart-val {
    width: 70px;
    flex-shrink: 0;
    font-size: 11px;
    color: #6b7f94;
    font-variant-numeric: tabular-nums;
}

/* ── Pills ─────────────────────────────────────────────────────────── */
.ar-pill {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    color: #99aabb;
    margin: 2px 3px 2px 0;
    white-space: nowrap;
}

/* ── Key-Value Pairs ───────────────────────────────────────────────── */
.ar-kv {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.ar-kv-icon { color: #4cc9f0; font-size: 12px; width: 16px; text-align: center; }
.ar-kv-label { font-size: 11px; color: #6b7f94; }
.ar-kv-value { font-size: 11px; color: #99aabb; font-weight: 600; margin-left: auto; }

/* ── Threshold Bars ────────────────────────────────────────────────── */
.ar-threshold-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
.ar-threshold-label {
    font-size: 11px;
    color: #8899aa;
}
.ar-threshold-val {
    font-size: 11px;
    color: #6b7f94;
}

/* ── Timeline ──────────────────────────────────────────────────────── */
.ar-timeline {
    position: relative;
    padding-left: 28px;
}
.ar-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(76, 201, 240, .15);
    border-radius: 1px;
}
.ar-timeline-item {
    position: relative;
    margin-bottom: 16px;
    padding-left: 12px;
}
.ar-timeline-item:last-child { margin-bottom: 0; }
.ar-timeline-marker {
    position: absolute;
    left: -24px;
    top: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(76, 201, 240, .1);
    border: 2px solid rgba(76, 201, 240, .3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: #4cc9f0;
}
.ar-timeline-step {
    font-size: 10px;
    color: #556;
    margin-bottom: 2px;
}
.ar-timeline-type {
    font-size: 13px;
    color: #bbd;
    font-weight: 600;
    margin-bottom: 4px;
}
.ar-timeline-desc {
    font-size: 11px;
    color: #778899;
    line-height: 1.5;
}

/* ── Hypothesis Cards ──────────────────────────────────────────────── */
.ar-hypothesis {
    background: rgba(0,0,0,.2);
    border: 1px solid rgba(255,255,255,.04);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
}
.ar-hypothesis:last-child { margin-bottom: 0; }
.ar-hypothesis-title {
    font-size: 13px;
    color: #bbd;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ar-hypothesis-title i {
    color: #f59e0b;
}
.ar-hypothesis-row {
    font-size: 11px;
    color: #778899;
    line-height: 1.6;
    margin-bottom: 4px;
}
.ar-hypothesis-row strong {
    color: #99aabb;
}

/* ── Log Details (collapsible) ─────────────────────────────────────── */
.ar-log-details {
    margin-top: 14px;
    border: 1px solid var(--border-color, #1f2a36);
    border-radius: 8px;
    overflow: hidden;
}
.ar-log-details summary {
    padding: 10px 14px;
    font-size: 11px;
    color: #556677;
    cursor: pointer;
    background: rgba(0,0,0,.15);
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    transition: color .2s;
}
.ar-log-details summary:hover {
    color: #8899aa;
}
.ar-log-details summary i {
    color: #445566;
    font-size: 12px;
}
.ar-log-details[open] summary {
    border-bottom: 1px solid var(--border-color, #1f2a36);
}
.ar-log-content {
    padding: 12px 14px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #556677;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.6;
    background: rgba(0,0,0,.2);
}
.ar-log-content .ai-log-info { color: #556677; }
.ar-log-content .ai-log-success { color: #44aa66; }
.ar-log-content .ai-log-warn { color: #ccaa44; }

/* ── Loading Spinner ───────────────────────────────────────────────── */
.ar-loading {
    padding: 40px 20px;
    text-align: center;
}
.ar-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(76, 201, 240, .15);
    border-top-color: #4cc9f0;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: ar-spin 0.8s linear infinite;
}
@keyframes ar-spin {
    to { transform: rotate(360deg); }
}
.ar-loading-text {
    font-size: 14px;
    color: #99aabb;
    margin-bottom: 4px;
}
.ar-loading-text strong {
    color: #4cc9f0;
}
.ar-loading-sub {
    font-size: 11px;
    color: #556677;
}

/* ── Error State ───────────────────────────────────────────────────── */
.ar-error {
    padding: 20px;
    text-align: center;
    color: #ef4444;
    font-size: 13px;
}
.ar-error i {
    margin-right: 6px;
}

/* ── Results Container ─────────────────────────────────────────────── */
#ai-results {
    margin-top: 20px;
    display: none;
}
#ai-results.show {
    display: block;
    animation: ar-fade-in 0.3s ease;
}
@keyframes ar-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
