/* =========================================================
   API Logs Pages — Shared Styles
   ========================================================= */

/* ── Status-code badges ─────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.status-2xx { background: #d1fae5; color: #065f46; }
.status-3xx { background: #dbeafe; color: #1e40af; }
.status-4xx { background: #fef3c7; color: #92400e; }
.status-5xx { background: #fee2e2; color: #991b1b; }
.status-unknown { background: #f3f4f6; color: #374151; }

/* ── HTTP-method badges ─────────────────────────────────── */
.method-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.method-get    { background: #d1fae5; color: #065f46; }
.method-post   { background: #dbeafe; color: #1e40af; }
.method-put    { background: #fef3c7; color: #92400e; }
.method-patch  { background: #ede9fe; color: #5b21b6; }
.method-delete { background: #fee2e2; color: #991b1b; }
.method-other  { background: #f3f4f6; color: #374151; }

/* ── Exception indicator ───────────────────────────────── */
.exception-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    flex-shrink: 0;
}
.no-exception-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
}

/* ── Response-time colouring ───────────────────────────── */
.rt-fast   { color: #10b981; font-weight: 600; }
.rt-medium { color: #f59e0b; font-weight: 600; }
.rt-slow   { color: #ef4444; font-weight: 600; }

/* ── Table truncation ──────────────────────────────────── */
.cell-truncate {
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================================================
   Detail Page
   ========================================================= */

/* ── Top action bar (copy + download) ──────────────────── */
.log-actions-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.log-actions-bar .btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

/* ── Overview card (hero area at top of detail) ─────────── */
.log-overview-card {
    background: #fff;
    border: 1px solid #e5e9f2;
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.log-overview-top {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.log-overview-top .method-badge { font-size: 14px; padding: 5px 14px; }
.log-overview-top .status-badge { font-size: 14px; padding: 5px 14px; }
.log-endpoint {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    word-break: break-all;
    flex: 1;
}
.log-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}
.log-meta-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.log-meta-item .meta-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
}
.log-meta-item .meta-value {
    font-size: 13px;
    color: #334155;
    font-weight: 500;
    word-break: break-word;
}

/* ── Section cards ──────────────────────────────────────── */
.log-section {
    background: #fff;
    border: 1px solid #e5e9f2;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    overflow: hidden;
}
.log-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e9f2;
    cursor: pointer;
    user-select: none;
}
.log-section-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    margin: 0;
    flex: 1;
}
.log-section-header i.section-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.section-icon-request  { background: #dbeafe; color: #1e40af; }
.section-icon-response { background: #d1fae5; color: #065f46; }
.section-icon-exception { background: #fee2e2; color: #991b1b; }
.section-icon-general  { background: #ede9fe; color: #5b21b6; }

.log-section-body {
    padding: 20px 22px;
}

/* ── Key-value pairs inside sections ───────────────────── */
.kv-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0;
    font-size: 13px;
}
.kv-row {
    display: contents;
}
.kv-row .kv-key {
    padding: 9px 12px 9px 0;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}
.kv-row .kv-val {
    padding: 9px 0;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    word-break: break-word;
}
.kv-row:last-child .kv-key,
.kv-row:last-child .kv-val {
    border-bottom: none;
}

/* ── Code / body blocks ─────────────────────────────────── */
.code-block-wrapper {
    position: relative;
    margin-top: 4px;
}
.code-block {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 16px 18px;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}
.code-block.exception-block {
    background: #1a0a0a;
    color: #fca5a5;
    border: 1px solid #7f1d1d;
}
.copy-block-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    color: #e2e8f0;
    border-radius: 5px;
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s;
}
.copy-block-btn:hover { background: rgba(255,255,255,.22); }

/* ── Headers table ──────────────────────────────────────── */
.headers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.headers-table th {
    text-align: left;
    padding: 6px 10px;
    background: #f8fafc;
    color: #64748b;
    font-weight: 700;
    border-bottom: 1px solid #e5e9f2;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.headers-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: top;
    word-break: break-word;
}
.headers-table td:first-child {
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    width: 220px;
}
.headers-table tr:last-child td { border-bottom: none; }

/* ── Empty / NA placeholder ─────────────────────────────── */
.log-empty-field {
    color: #94a3b8;
    font-style: italic;
    font-size: 12px;
}

/* ── Exception section highlight ───────────────────────── */
.log-section.has-exception .log-section-header {
    background: #fef2f2;
    border-bottom-color: #fecaca;
}
.log-section.has-exception .log-section-header h3 {
    color: #991b1b;
}

/* ── Trace ID chip ──────────────────────────────────────── */
.trace-chip {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 3px 10px;
    color: #475569;
    letter-spacing: 0.3px;
}

/* ── Loading / error state ──────────────────────────────── */
.log-detail-loading {
    text-align: center;
    padding: 80px 20px;
    color: #64748b;
}
.log-detail-loading i { font-size: 36px; margin-bottom: 16px; display: block; }
.log-detail-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    color: #991b1b;
}

/* ── Collapse chevron ───────────────────────────────────── */
.section-chevron {
    color: #94a3b8;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.section-chevron.collapsed { transform: rotate(-90deg); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
    .kv-grid { grid-template-columns: 1fr; }
    .kv-row .kv-key { border-bottom: none; padding-bottom: 2px; }
    .log-meta-grid { grid-template-columns: 1fr 1fr; }
}
