/* ================================================================
   ERROR REPORTING — Report Bug modal + Error Admin modal
   Estilos para formulario de report e painel administrativo.
   ================================================================ */

/* --- Shared overlay pattern --- */
.report-bug-overlay,
.error-admin-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    padding: 24px;
}

/* --- Report Bug Modal --- */
.report-bug-dialog {
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid var(--border-color, #333);
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    position: relative;
}

/* Fluxo nao-bloqueante: screenshot carrega em background sem overlay full-form */

.report-bug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #333);
}

.report-bug-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
}

.report-bug-close {
    background: none;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.report-bug-close:hover {
    background: var(--hover-bg, rgba(255,255,255,0.08));
    color: var(--text-primary, #e0e0e0);
}

.report-bug-form {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.report-bug-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.report-bug-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #aaa);
}

.report-bug-field select,
.report-bug-field textarea {
    background: var(--bg-primary, #121220);
    border: 1px solid var(--border-color, #333);
    border-radius: 6px;
    color: var(--text-primary, #e0e0e0);
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

.report-bug-field select:focus,
.report-bug-field textarea:focus {
    border-color: var(--accent, #60a5fa);
    outline: none;
}

.report-bug-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary, #aaa);
    cursor: pointer;
}

.report-bug-screenshot-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-bug-capture-btn {
    background: var(--bg-primary, #121220);
    border: 1px solid var(--border-color, #555);
    border-radius: 6px;
    color: var(--text-secondary, #aaa);
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.report-bug-capture-btn:hover {
    background: var(--hover-bg, rgba(255,255,255,0.08));
    color: var(--text-primary, #e0e0e0);
    border-color: var(--accent, #60a5fa);
}
.report-bug-capture-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.report-bug-screenshot-status {
    font-size: 12px;
    color: var(--text-tertiary, #666);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.report-bug-capture-btn:disabled::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 6px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: report-bug-spin 0.8s linear infinite;
    vertical-align: middle;
}
@keyframes report-bug-spin {
    to { transform: rotate(360deg); }
}

.report-bug-screenshot-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 6px;
    border: 1px solid var(--border-color, #333);
    object-fit: contain;
    margin-top: 8px;
}

/* --- Attachment area --- */
.report-bug-attach-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-bug-attach-btn {
    background: var(--bg-primary, #121220);
    border: 1px dashed var(--border-color, #555);
    border-radius: 6px;
    color: var(--text-secondary, #aaa);
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
}
.report-bug-attach-btn:hover {
    border-color: var(--accent, #60a5fa);
    color: var(--accent, #60a5fa);
}

.report-bug-attach-hint {
    font-size: 11px;
    color: var(--text-tertiary, #666);
}

.report-bug-attach-previews {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.report-bug-attach-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color, #333);
}

.report-bug-attach-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.report-bug-attach-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.report-bug-attach-remove:hover {
    background: #f87171;
}

.report-bug-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
}

.report-bug-cancel,
.report-bug-submit {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-color, #333);
}

.report-bug-cancel {
    background: transparent;
    color: var(--text-secondary, #aaa);
}
.report-bug-cancel:hover {
    background: var(--hover-bg, rgba(255,255,255,0.08));
}

.report-bug-submit {
    background: var(--accent, #60a5fa);
    color: #fff;
    border-color: var(--accent, #60a5fa);
}
.report-bug-submit:hover {
    opacity: 0.9;
}
.report-bug-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Error Admin Modal --- */
.error-admin-dialog {
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid var(--border-color, #333);
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.error-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #333);
}

.error-admin-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
}

.error-admin-close {
    background: none;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.error-admin-close:hover {
    background: var(--hover-bg, rgba(255,255,255,0.08));
}

.error-admin-filters {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color, #333);
    flex-wrap: wrap;
}

.error-admin-filters select,
.error-admin-filters input {
    background: var(--bg-primary, #121220);
    border: 1px solid var(--border-color, #333);
    border-radius: 6px;
    color: var(--text-primary, #e0e0e0);
    padding: 6px 10px;
    font-size: 13px;
}

.error-admin-btn {
    background: var(--bg-primary, #121220);
    border: 1px solid var(--border-color, #333);
    border-radius: 6px;
    color: var(--text-primary, #e0e0e0);
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}
.error-admin-btn:hover {
    background: var(--hover-bg, rgba(255,255,255,0.08));
}

.error-admin-stats {
    display: flex;
    gap: 8px;
    padding: 8px 20px;
}

.error-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.error-badge-crash {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
}
.error-badge-warning {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}
.error-badge-bug,
.error-badge-bug_report {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
}

.error-admin-table-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
}

.error-admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.error-admin-table thead th {
    text-align: left;
    padding: 8px 6px;
    color: var(--text-secondary, #888);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color, #333);
    position: sticky;
    top: 0;
    background: var(--bg-secondary, #1e1e2e);
}

.error-admin-row {
    cursor: pointer;
}
.error-admin-row:hover {
    background: var(--hover-bg, rgba(255,255,255,0.04));
}
.error-admin-row td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.05));
    color: var(--text-primary, #e0e0e0);
    vertical-align: top;
}

.error-admin-message {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.error-admin-url {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary, #888);
}

.error-admin-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color, #333);
}

.error-admin-count {
    font-size: 12px;
    color: var(--text-tertiary, #666);
}

/* --- Error Detail Panel --- */
.error-admin-detail {
    border-top: 1px solid var(--border-color, #333);
    padding: 16px 20px;
    max-height: 50vh;
    overflow-y: auto;
    background: var(--bg-primary, #121220);
}

.error-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.error-detail-header strong {
    color: var(--text-primary, #e0e0e0);
    font-size: 14px;
}

.error-detail-close {
    background: none;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.error-detail-close:hover {
    background: var(--hover-bg, rgba(255,255,255,0.08));
}

.error-detail-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.error-detail-section {
    font-size: 13px;
    color: var(--text-primary, #e0e0e0);
}

.error-detail-section strong {
    color: var(--text-secondary, #aaa);
    font-weight: 500;
}

.error-detail-pre {
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid var(--border-color, #333);
    border-radius: 6px;
    padding: 10px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 4px;
}

.error-detail-stack {
    color: #f87171;
}

.error-detail-screenshot {
    max-width: 100%;
    max-height: 300px;
    border-radius: 6px;
    border: 1px solid var(--border-color, #333);
    margin-top: 8px;
    object-fit: contain;
}

.error-detail-attachments {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.error-detail-attachments img {
    max-width: 200px;
    max-height: 200px;
}

/* Bloco de rastreio estruturado ECB-* no topo do detalhe */
.error-admin-trace {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 10px;
    padding: 6px 8px;
    background: var(--surface-2, rgba(0,0,0,0.15));
    border-radius: 4px;
    font-size: 12px;
}

.err-code-badge {
    background: #c0392b;
    color: #fff;
    border-radius: 3px;
    padding: 1px 7px;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-family: monospace;
}

.err-trace-field {
    color: var(--neutral-300, #bbb);
}

.err-correlation {
    color: var(--neutral-400, #888);
    font-family: monospace;
    font-size: 11px;
    margin-left: auto;
}
