/* ========================================
   Error Catcher - Professional Light Theme
   ======================================== */

:root {
    --color-bg: #f8f9fb;
    --color-surface: #ffffff;
    --color-border: #e2e6ed;
    --color-border-light: #eef1f6;
    --color-text: #1a1d26;
    --color-text-secondary: #5f6980;
    --color-text-muted: #8a92a6;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #eff4ff;
    --color-danger: #dc2626;
    --color-danger-light: #fef2f2;
    --color-warning: #d97706;
    --color-warning-light: #fffbeb;
    --color-success: #059669;
    --color-success-light: #ecfdf5;
    --color-info: #0284c7;
    --color-info-light: #f0f9ff;
    --sidebar-width: 240px;
    --header-height: 60px;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.03);
    --transition: 150ms ease;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }

/* ---- Layout ---- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
    font-size: 16px;
    color: var(--color-text);
    letter-spacing: -0.3px;
}

.sidebar-brand span {
    color: var(--color-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    padding: 0 8px;
    margin-bottom: 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    color: var(--color-text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
}

.sidebar-link:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.sidebar-link.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--color-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 13px;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--color-text-muted);
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

.content-header {
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.content-header h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.content-body {
    padding: 28px 32px;
}

/* ---- Cards ---- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

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

.card-header h2 {
    font-size: 14px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-body-flush {
    padding: 0;
}

/* ---- Stats Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--color-text);
}

.stat-card.stat-danger .stat-value { color: var(--color-danger); }
.stat-card.stat-warning .stat-value { color: var(--color-warning); }
.stat-card.stat-success .stat-value { color: var(--color-success); }
.stat-card.stat-info .stat-value { color: var(--color-info); }

/* ---- Tables ---- */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 13px;
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: #f8fafc;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.badge-error,
.badge-critical,
.badge-alert,
.badge-emergency {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.badge-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.badge-notice,
.badge-info,
.badge-deprecated {
    background: var(--color-info-light);
    color: var(--color-info);
}

.badge-unresolved {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.badge-resolved {
    background: var(--color-success-light);
    color: var(--color-success);
}

.badge-ignored {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-admin {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.badge-active {
    background: var(--color-success-light);
    color: var(--color-success);
}

.badge-inactive {
    background: #f3f4f6;
    color: #6b7280;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

.btn:hover { opacity: 0.9; }

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background: var(--color-primary-hover);
    color: #fff;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}
.btn-secondary:hover {
    background: var(--color-bg);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 5px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color var(--transition);
    line-height: 1.4;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: var(--color-text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 20px;
    padding-right: 36px;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.form-hint {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

.form-check label {
    font-size: 13px;
    cursor: pointer;
}

.form-error {
    font-size: 12px;
    color: var(--color-danger);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ---- Filters ---- */
.filters-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.filters-bar .form-control {
    width: auto;
    min-width: 160px;
}

.filters-bar .search-input {
    min-width: 250px;
}

/* ---- Pagination ---- */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    padding: 16px;
}

.pagination {
    display: flex;
    gap: 4px;
    list-style: none;
}

.pagination li a,
.pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--color-text-secondary);
    transition: all var(--transition);
}

.pagination li a:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.pagination li.active span {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.pagination li.disabled span {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---- Alerts ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 20px;
    border: 1px solid;
}

.alert-success {
    background: var(--color-success-light);
    color: var(--color-success);
    border-color: #a7f3d0;
}

.alert-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-color: #fecaca;
}

/* ---- Error Detail ---- */
.error-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.error-detail-title {
    font-size: 18px;
    font-weight: 600;
    word-break: break-word;
}

.error-detail-meta {
    display: flex;
    gap: 20px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.error-detail-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.stack-trace {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: var(--radius);
    padding: 20px;
    overflow-x: auto;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, monospace;
    font-size: 12px;
    line-height: 1.7;
}

.stack-frame {
    padding: 4px 0;
}

.stack-frame-file {
    color: #93c5fd;
}

.stack-frame-line {
    color: #fbbf24;
}

.stack-frame-method {
    color: #a5b4fc;
}

.context-section {
    margin-bottom: 20px;
}

.context-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.context-table {
    width: 100%;
}

.context-table td {
    padding: 6px 12px;
    font-size: 12.5px;
    border-bottom: 1px solid var(--color-border-light);
}

.context-table td:first-child {
    font-weight: 500;
    color: var(--color-text);
    width: 180px;
    white-space: nowrap;
}

.context-table td:last-child {
    color: var(--color-text-secondary);
    word-break: break-all;
    font-family: 'SF Mono', monospace;
    font-size: 12px;
}

/* ---- Grid layouts ---- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

/* ---- Chart ---- */
.chart-container {
    position: relative;
    height: 280px;
    padding: 10px;
}

/* ---- Credentials Block ---- */
.credentials-block {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.credentials-block label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
    display: block;
}

.credentials-block code {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-family: 'SF Mono', monospace;
    font-size: 12px;
    word-break: break-all;
    margin-bottom: 12px;
    color: var(--color-text);
}

.credentials-block code:last-child {
    margin-bottom: 0;
}

/* ---- Auth Page ---- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 40px;
}

.auth-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.auth-subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 28px;
}

.auth-card .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 10px;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 13px;
}

/* ---- Utility ---- */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-mono {
    font-family: 'SF Mono', monospace;
    font-size: 12px;
}

.text-muted { color: var(--color-text-muted); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
    }
    .content-body {
        padding: 16px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filters-bar .form-control {
        width: 100%;
        min-width: unset;
    }
}
