/* ============================================================================
   API Monitor (#544) — global styles for the page.
   Dark HUD theme, cyan accents — same voice as dbhealth.css (sci-fi is the
   BASE; corporate/slate override these classes in themes/*.css).
   ============================================================================ */

.apimonitor { color: #e6edf3; }

/* ── Header ───────────────────────────────────────────────────────────────*/
.apm-header-ico {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: #071019;
    background: linear-gradient(135deg, #22d3ee, #0ea5e9);
    box-shadow: 0 0 22px rgba(34, 211, 238, 0.45);
}
.apm-title {
    font-weight: 800; letter-spacing: 0.5px;
    background: linear-gradient(90deg, #e6f9ff, #7fd7ff);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.apm-subtitle { color: #8fb6c9; font-size: 0.85rem; }

/* ── Tabs ─────────────────────────────────────────────────────────────────*/
.apm-tabs { display: flex; gap: 8px; }
.apm-tab {
    background: rgba(13, 24, 38, 0.72); color: #9fc9db;
    border: 1px solid rgba(0, 200, 255, 0.16); border-radius: 10px;
    font-weight: 600; padding: 0.45rem 1.1rem;
}
.apm-tab:hover { color: #e6f9ff; border-color: rgba(0, 200, 255, 0.4); }
.apm-tab-active, .apm-tab-active:hover {
    background: linear-gradient(135deg, #22d3ee, #0ea5e9); color: #04121b;
    border-color: transparent; font-weight: 700;
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.35);
}

/* ── Cards / filter bar ───────────────────────────────────────────────────*/
.apm-card {
    background: rgba(13, 24, 38, 0.72);
    border: 1px solid rgba(0, 200, 255, 0.16);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}
.apm-filterbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.apm-ctl { display: flex; flex-direction: column; gap: 4px; min-width: 110px; }
.apm-ctl-grow { flex: 1 1 220px; }
.apm-ctl label { font-size: 0.72rem; color: #8fb6c9; letter-spacing: 0.4px; }
.apm-ctl .form-control, .apm-ctl .form-select {
    background: rgba(4, 18, 27, 0.7); color: #e6edf3;
    border: 1px solid rgba(0, 200, 255, 0.2); border-radius: 8px;
}
.apm-ctl .form-control:focus, .apm-ctl .form-select:focus {
    background: rgba(4, 18, 27, 0.9); color: #e6edf3;
    border-color: #22d3ee; box-shadow: 0 0 0 0.15rem rgba(34, 211, 238, 0.2);
}
/* the native pickers/spinners inside these inputs render dark-on-dark without this */
.apm-ctl .form-control::-webkit-calendar-picker-indicator { filter: invert(0.8); }

.apm-search, .apm-refresh {
    background: linear-gradient(135deg, #22d3ee, #0ea5e9); color: #04121b;
    font-weight: 700; border: none; border-radius: 10px; padding: 0.45rem 1.25rem;
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.35);
}
.apm-refresh { background: rgba(13, 24, 38, 0.9); color: #9fc9db; border: 1px solid rgba(0, 200, 255, 0.25); box-shadow: none; }
.apm-search:hover:not(:disabled) { filter: brightness(1.08); color: #04121b; }
.apm-refresh:hover:not(:disabled) { color: #e6f9ff; border-color: rgba(0, 200, 255, 0.5); }
.apm-search:disabled, .apm-refresh:disabled { opacity: 0.6; }

/* ── Results/detail split (Syncfusion splitter, draggable divider) ────────*/
.apm-splitter.e-splitter {
    background: transparent; border: none;
}
.apm-splitter .e-pane { overflow: hidden; background: transparent; }
.apm-splitter .e-pane:first-child { padding-right: 8px; }
.apm-splitter .e-pane:last-child { padding-left: 8px; }
.apm-splitter .e-split-bar {
    background: rgba(0, 200, 255, 0.18);
    border-radius: 3px;
}
.apm-splitter .e-split-bar:hover,
.apm-splitter .e-split-bar.e-split-bar-active {
    background: rgba(34, 211, 238, 0.55);
}
.apm-splitter .e-split-bar .e-resize-handler { color: #22d3ee; }

.apm-results { height: 100%; display: flex; flex-direction: column; }
.apm-results .apm-scroll { flex: 1 1 auto; overflow: auto; }
.apm-detail { height: 100%; display: flex; flex-direction: column; }

/* ── Table ────────────────────────────────────────────────────────────────*/
.apm-table { --bs-table-bg: transparent; color: #dbeef7; font-size: 0.8rem; }
.apm-table thead th {
    position: sticky; top: 0; z-index: 1;
    background: #0b1622; color: #8fb6c9;
    border-bottom: 1px solid rgba(0, 200, 255, 0.25);
    font-weight: 600; letter-spacing: 0.3px; white-space: nowrap;
}
.apm-table td { border-color: rgba(0, 200, 255, 0.08); vertical-align: middle; color: inherit; }
.apm-row { cursor: pointer; }
.apm-row:hover td { background: rgba(34, 211, 238, 0.07); }
.apm-row-selected td { background: rgba(34, 211, 238, 0.14); }
.apm-row-failed td { background: rgba(248, 113, 113, 0.07); }
.apm-row-failed:hover td { background: rgba(248, 113, 113, 0.12); }

.apm-mono { font-family: 'JetBrains Mono', 'Share Tech Mono', monospace; font-size: 0.74rem; }
.apm-nowrap { white-space: nowrap; }
.apm-api { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apm-preview {
    max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: #9fc9db; font-family: 'JetBrains Mono', 'Share Tech Mono', monospace; font-size: 0.7rem;
}
.apm-empty { color: #6f97ab; font-style: italic; padding: 1.2rem; text-align: center; }
.apm-foot {
    padding: 0.5rem 1rem; font-size: 0.72rem; color: #7fa7bb;
    border-top: 1px solid rgba(0, 200, 255, 0.12);
}

.apm-status {
    display: inline-block; min-width: 44px; text-align: center;
    padding: 1px 8px; border-radius: 999px;
    font-family: 'JetBrains Mono', 'Share Tech Mono', monospace; font-size: 0.72rem; font-weight: 700;
}
/* outline badges — site.css washes bg-* utility fills to 10% alpha, so filled
   Bootstrap badges are not available here. Colours come from the AA-tuned
   per-theme tokens, never literals. */
.apm-status-ok  { color: var(--srn-ok, #00ff87); border: 1px solid color-mix(in srgb, var(--srn-ok, #00ff87) 55%, transparent); }
.apm-status-bad { color: var(--srn-danger, #ff3366); border: 1px solid color-mix(in srgb, var(--srn-danger, #ff3366) 55%, transparent); }

/* ── Detail pane ──────────────────────────────────────────────────────────*/
.apm-detail-head { padding: 0.9rem 1rem 0.6rem; border-bottom: 1px solid rgba(0, 200, 255, 0.12); }
.apm-detail-title { font-size: 0.9rem; font-weight: 700; color: #e6f9ff; word-break: break-all; }
.apm-detail-meta { color: #8fb6c9; font-size: 0.78rem; margin-top: 4px; }
.apm-detail-body { padding: 0.75rem 1rem 1rem; overflow: auto; }
.apm-section-label {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
    color: #7fd7ff; margin: 0.9rem 0 0.35rem;
}
.apm-section-label:first-child { margin-top: 0; }
/* collapsible section headers: same look, plus chevron + hover affordance */
.apm-section-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.apm-section-row .apm-section-toggle { flex: 1 1 auto; }
.apm-section-toggle {
    display: block; width: 100%; text-align: left;
    background: none; border: none; padding: 0.2rem 0; cursor: pointer;
}
.apm-section-toggle:hover { color: #b7ecff; }
.apm-section-toggle .fa-solid { font-size: 0.6rem; width: 0.8rem; }
.apm-section-copy {
    flex: 0 0 auto;
    background: rgba(13, 24, 38, 0.9); color: #9fc9db;
    border: 1px solid rgba(0, 200, 255, 0.25); border-radius: 6px;
    font-size: 0.64rem; font-weight: 600; letter-spacing: 0.4px;
    padding: 2px 8px; cursor: pointer;
}
.apm-section-copy:hover { color: #e6f9ff; border-color: rgba(0, 200, 255, 0.5); }
.apm-section-copy .fa-check { color: var(--srn-ok, #00ff87); }
/* Retro terminal treatment — same recipe as .json-block on the order
   integration page (site.css). Sci-fi only: corporate/slate override the
   surface and kill the scanline pseudo-element. */
.apm-json {
    position: relative;
    background: radial-gradient(circle at 20% 15%, #0d120d 0%, #050705 70%);
    color: #00ff6a;
    border: 1px solid #0f3d1f; border-radius: 4px;
    padding: 0.6rem 0.75rem; margin: 0;
    font-family: 'JetBrains Mono', 'Share Tech Mono', monospace; font-size: 0.7rem;
    line-height: 1.1rem;
    white-space: pre-wrap; word-break: break-word;
    max-height: 300px; overflow: auto;
    box-shadow: 0 0 6px #042d14 inset, 0 0 8px rgba(0, 255, 120, 0.15);
    animation: apmTerminalPulse 6s ease-in-out infinite;
}
.apm-json::before {
    content: "";
    position: absolute; inset: 0;
    background: repeating-linear-gradient(to bottom,
        rgba(0, 255, 120, 0.06) 0px, rgba(0, 255, 120, 0.06) 2px,
        transparent 2px, transparent 4px);
    pointer-events: none; mix-blend-mode: screen; opacity: 0.35;
}
@keyframes apmTerminalPulse {
    0%, 100% { box-shadow: 0 0 6px #323d37 inset, 0 0 8px rgba(0, 255, 120, 0.15); }
    50%      { box-shadow: 0 0 10px #064024 inset, 0 0 14px rgba(0, 255, 140, 0.25); }
}
.apm-json::-webkit-scrollbar { width: 8px; }
.apm-json::-webkit-scrollbar-track { background: #061006; }
.apm-json::-webkit-scrollbar-thumb { background: #0d522b; border-radius: 4px; }
.apm-json::-webkit-scrollbar-thumb:hover { background: #12733b; }

/* ── Config tab ───────────────────────────────────────────────────────────*/
.apm-config-note { color: #8fb6c9; font-size: 0.78rem; margin: 0 2px 12px; }
.apm-config-note code { color: #7fd7ff; }
.apm-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin: 0; }
.apm-toggle input { accent-color: #22d3ee; width: 15px; height: 15px; cursor: pointer; }
.apm-toggle span { font-size: 0.76rem; color: #9fc9db; min-width: 24px; }
.apm-toggle-busy { opacity: 0.55; }
