/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: #fff;
    border-bottom: 1px solid #e1e4e8;
    padding: 12px 0;
    margin-bottom: 24px;
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    min-width: 0;
}

header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-right: 24px;
    white-space: nowrap;
}

.brand-link {
    color: inherit;
    text-decoration: none;
}

.brand-link:hover {
    color: #0366d6;
}

nav {
    display: flex;
    align-items: center;
}

nav a {
    color: #0366d6;
    text-decoration: none;
    margin-right: 16px;
    font-weight: 500;
}

nav a:hover {
    text-decoration: underline;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Context label (current workspace / project) */
.context-label {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 13px;
    color: #586069;
    flex-wrap: wrap;
}

.context-label .context-project {
    font-weight: 600;
    color: #24292e;
    overflow: hidden;
    text-overflow: ellipsis;
}

.context-label .context-sep {
    color: #d1d5da;
}

/* Account menu (avatar + dropdown) */
.account-menu {
    position: relative;
}

.account-menu > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 50%;
}

.account-menu > summary::-webkit-details-marker {
    display: none;
}

.account-menu > summary:focus-visible {
    outline: 2px solid #0366d6;
    outline-offset: 2px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #24292e;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    user-select: none;
}

.account-menu[open] .avatar {
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.2);
}

.dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 260px;
    max-width: calc(100vw - 32px);
    background-color: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(27, 31, 35, 0.15);
    padding: 6px 0;
    z-index: 100;
}

.dropdown-header {
    padding: 8px 16px 10px;
    border-bottom: 1px solid #e1e4e8;
    font-size: 13px;
    color: #24292e;
    font-weight: 500;
    word-break: break-all;
}

.dropdown-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #586069;
}

.dropdown-section-title .btn-link {
    font-size: 12px;
    text-transform: none;
    letter-spacing: normal;
    color: #0366d6;
    text-decoration: none;
    font-weight: 500;
}

.dropdown-section-title .btn-link:hover {
    text-decoration: underline;
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 7px 16px;
    font-size: 13px;
    color: #24292e;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-item:hover {
    background-color: #f6f8fa;
}

.dropdown-item .check {
    color: #28a745;
    font-weight: 600;
}

.dropdown-item.is-active {
    font-weight: 600;
}

.dropdown-empty {
    padding: 7px 16px;
    font-size: 13px;
    color: #586069;
    font-style: italic;
}

.dropdown-divider {
    border-top: 1px solid #e1e4e8;
    margin: 6px 0;
}

.dropdown-item.dropdown-danger {
    color: #d73a4a;
}

.dropdown form {
    margin: 0;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
}

/* Filters */
.filters {
    background-color: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 24px;
}

.filter-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 13px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    font-size: 14px;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #0366d6;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #0366d6;
    color: #fff;
    border-color: #0366d6;
}

.btn-primary:hover {
    background-color: #0256c2;
}

.btn-secondary {
    background-color: #fff;
    color: #24292e;
    border-color: #e1e4e8;
}

.btn-secondary:hover {
    background-color: #f6f8fa;
}

/* Table */
.table-container {
    background-color: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 24px;
}

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

.events-table thead {
    background-color: #f6f8fa;
    border-bottom: 1px solid #e1e4e8;
}

.events-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: #586069;
}

.events-table td {
    padding: 12px 16px;
    border-top: 1px solid #e1e4e8;
    vertical-align: top;
}

.events-table tbody tr:hover {
    background-color: #f6f8fa;
}

.events-table td a {
    color: #0366d6;
    text-decoration: none;
}

.events-table td a:hover {
    text-decoration: underline;
}

.no-results {
    text-align: center;
    color: #586069;
    padding: 48px 16px !important;
}

.timestamp {
    white-space: nowrap;
}

.service-name,
.exception-type {
    font-weight: 500;
}

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

code {
    background-color: #f6f8fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
}

.badge-prod,
.badge-production {
    background-color: #d73a4a;
    color: #fff;
}

.badge-dev,
.badge-development {
    background-color: #6f42c1;
    color: #fff;
}

.badge-staging,
.badge-stage {
    background-color: #fb8500;
    color: #fff;
}

.badge-test,
.badge-testing {
    background-color: #0366d6;
    color: #fff;
}

.badge-error {
    background-color: #d73a4a;
    color: #fff;
}

.badge-warning {
    background-color: #fb8500;
    color: #fff;
}

.badge-info {
    background-color: #0366d6;
    color: #fff;
}

.badge-fatal,
.badge-critical {
    background-color: #6a0dad;
    color: #fff;
}

.badge-status-unresolved {
    background-color: #d73a4a;
    color: #fff;
}

.badge-status-resolved {
    background-color: #28a745;
    color: #fff;
}

.badge-status-ignored {
    background-color: #6c757d;
    color: #fff;
}

.status-controls {
    margin-top: 8px;
}

.status-controls select {
    padding: 6px 10px;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    font-size: 14px;
}

.issue-title {
    max-width: 500px;
}

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
}

.pagination-info {
    color: #586069;
    font-size: 14px;
}

/* Detail page */
.detail-card {
    background-color: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 24px;
}

.detail-section {
    margin-bottom: 32px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e1e4e8;
}

.detail-list {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 12px 24px;
}

.detail-list dt {
    font-weight: 600;
    color: #586069;
}

.detail-list dd {
    word-break: break-word;
}

.copyable {
    cursor: pointer;
    transition: background-color 0.2s;
}

.copyable:hover {
    background-color: #e1e4e8;
}

.stack-trace {
    background-color: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 4px;
    padding: 16px;
    overflow-x: auto;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    line-height: 1.6;
}

.json-display {
    background-color: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 4px;
    padding: 16px;
    overflow-x: auto;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    line-height: 1.6;
}

.tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    background-color: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
}

.tag-key {
    font-weight: 600;
    color: #0366d6;
}

.tag-value {
    color: #24292e;
}

/* Mobile */
@media (max-width: 640px) {
    header h1 {
        font-size: 17px;
        margin-right: 12px;
    }

    nav a {
        margin-right: 10px;
    }
}

/* Visually hidden, available to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
