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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.5;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--gray-700);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 1rem;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background-color 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-block {
    width: 100%;
}

.error-message {
    background: #fef2f2;
    color: var(--danger);
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    display: none;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--gray-900);
    color: white;
    padding: 1rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 1rem 1rem;
    border-bottom: 1px solid var(--gray-700);
    margin-bottom: 1rem;
}

.sidebar-header h1 {
    font-size: 1.125rem;
    font-weight: 600;
}

.sidebar-header span {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    color: var(--gray-300);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background: var(--gray-700);
    color: white;
}

.sidebar-nav a svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    border-top: 1px solid var(--gray-700);
}

.sidebar-footer .user-info {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.sidebar-footer button {
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--gray-700);
    color: var(--gray-300);
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.sidebar-footer button:hover {
    background: var(--gray-700);
}

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 1.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
}

.card-body {
    padding: 1rem;
}

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

.stat-card {
    background: white;
    padding: 1.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card .label {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 600;
}

/* Table */
.table-container {
    overflow-x: auto;
}

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

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--gray-500);
}

tr:hover {
    background: var(--gray-50);
}

.clickable-row {
    cursor: pointer;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-open {
    background: #fef2f2;
    color: var(--danger);
}

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

.badge-ignored {
    background: var(--gray-100);
    color: var(--gray-500);
}

/* Issue detail */
.issue-header {
    margin-bottom: 1.5rem;
}

.issue-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.issue-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.stack-trace {
    background: var(--gray-900);
    color: #e5e7eb;
    padding: 1rem;
    border-radius: 0.375rem;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8125rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 0.5rem;
    width: 100%;
    max-width: 450px;
    margin: 1rem;
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Code blocks */
.code-block {
    position: relative;
    background: var(--gray-900);
    border-radius: 0.375rem;
    padding: 1rem;
    overflow-x: auto;
}

.code-block code,
.code-block pre {
    color: #e5e7eb;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8125rem;
    margin: 0;
    white-space: pre;
}

.copy-code-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--gray-700);
    color: var(--gray-300);
    border: none;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.copy-code-btn:hover {
    background: var(--gray-600);
}

.btn-setup {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
}

.btn-setup:hover {
    background: var(--primary-dark);
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-muted {
    color: var(--gray-500);
}

.text-sm {
    font-size: 0.875rem;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.api-key {
    font-family: monospace;
    background: var(--gray-100);
    padding: 0.5rem;
    border-radius: 0.25rem;
    word-break: break-all;
    font-size: 0.8125rem;
}

.copy-btn {
    margin-left: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.back-link:hover {
    color: var(--gray-700);
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}
