/* Debug Overlay - Blazor WebAssembly Edition */
/* Scoped styles for debug telemetry system */

.debug-overlay {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 10000;
    pointer-events: none;
}

.debug-toggle,
.debug-panel {
    pointer-events: auto;
}

/* Toggle Button - Bottom Right Corner */
.debug-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.debug-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.debug-toggle i {
    color: white;
}

.debug-error-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

/* Debug Panel - Opens from Bottom Right */
.debug-panel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
}

/* Header */
.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.debug-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.debug-actions {
    display: flex;
    gap: 8px;
}

.debug-actions button {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
}

.debug-actions button:hover {
    background: #f3f4f6;
    color: #111827;
}

/* Tabs */
.debug-tabs {
    display: flex;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    overflow-x: auto;
}

.debug-tab {
    flex: 1;
    min-width: fit-content;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.debug-tab:hover {
    background: #f3f4f6;
    color: #111827;
}

.debug-tab-active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

/* Subtabs */
.debug-subtabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.debug-subtab {
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #6b7280;
    transition: all 0.2s;
}

.debug-subtab:hover {
    background: #e5e7eb;
}

.debug-subtab-active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Content */
.debug-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: white;
}

.debug-tab-content h3 {
    margin: 0 0 16px 0;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tables */
.debug-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 12px;
}

.debug-table thead tr {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.debug-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: #6b7280;
    font-size: 11px;
    text-transform: uppercase;
}

.debug-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}

.debug-table tbody tr:hover {
    background: #f9fafb;
}

.debug-row-warning {
    background: #fef3c7 !important;
}

.debug-text-warning {
    color: #d97706;
    font-weight: 600;
}

.debug-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Badges */
.debug-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
}

.debug-badge-success {
    background: #d1fae5;
    color: #065f46;
}

.debug-badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.debug-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.debug-badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.debug-badge-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

/* Stats Cards */
.debug-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.debug-stat-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.debug-stat-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 600;
}

.debug-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

/* Error Cards */
.debug-error-card {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.debug-error-header {
    padding: 12px;
    border-bottom: 1px solid #fecaca;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-error-body {
    padding: 12px;
    font-size: 12px;
}

.debug-error-body strong {
    color: #991b1b;
}

.debug-error-body p {
    margin: 4px 0 12px 0;
    color: #374151;
}

.debug-stacktrace {
    margin-top: 8px;
}

.debug-stacktrace summary {
    cursor: pointer;
    color: #991b1b;
    font-weight: 600;
    padding: 8px;
    background: white;
    border: 1px solid #fecaca;
    border-radius: 6px;
}

.debug-stacktrace pre {
    margin: 8px 0 0 0;
    padding: 12px;
    background: white;
    border: 1px solid #fecaca;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 11px;
    color: #374151;
}

.debug-error-msg {
    margin-top: 4px;
    font-size: 11px;
    color: #991b1b;
}

.debug-timestamp {
    font-size: 11px;
    color: #6b7280;
    margin-left: 8px;
}

/* Empty States */
.debug-empty {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    font-size: 13px;
}

.debug-empty code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: #667eea;
}

.debug-success-message {
    text-align: center;
    padding: 40px 20px;
    color: #059669;
}

.debug-success-message i {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.debug-info {
    text-align: center;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 11px;
    color: #6b7280;
    margin-top: 12px;
}

/* Loading */
.debug-loading {
    text-align: center;
    padding: 20px;
    color: #6b7280;
    font-size: 13px;
}

.debug-loading i {
    margin-right: 8px;
}

/* Buttons */
.debug-btn-small {
    padding: 4px 8px;
    font-size: 11px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.debug-btn-small:hover {
    background: #f3f4f6;
}

.debug-error-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .debug-panel {
        background: #1e293b;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    }

    .debug-header {
        background: #0f172a;
        border-bottom-color: #334155;
    }

    .debug-header h4 {
        color: #f1f5f9;
    }

    .debug-tabs {
        background: #0f172a;
        border-bottom-color: #334155;
    }

    .debug-tab {
        color: #94a3b8;
    }

    .debug-tab:hover {
        background: #1e293b;
        color: #f1f5f9;
    }

    .debug-tab-active {
        background: #1e293b;
        color: #818cf8;
        border-bottom-color: #818cf8;
    }

    .debug-content {
        background: #1e293b;
    }

    .debug-tab-content h3 {
        color: #f1f5f9;
    }

    .debug-table thead tr {
        background: #0f172a;
        border-bottom-color: #334155;
    }

    .debug-table th {
        color: #94a3b8;
    }

    .debug-table td {
        color: #e2e8f0;
        border-bottom-color: #334155;
    }

    .debug-table tbody tr:hover {
        background: #0f172a;
    }

    .debug-actions button {
        background: #0f172a;
        border-color: #334155;
        color: #94a3b8;
    }

    .debug-actions button:hover {
        background: #334155;
        color: #f1f5f9;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .debug-panel {
        width: calc(100vw - 40px);
        right: 20px;
    }

    .debug-tabs {
        overflow-x: auto;
    }

    .debug-tab {
        flex: none;
        min-width: 100px;
    }

    .debug-stats {
        grid-template-columns: 1fr;
    }
}
