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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    padding: 30px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
    position: relative;
}

header h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 30px;
    text-decoration: none;
}

main {
    flex: 1;
}

section {
    background: var(--surface);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

section h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.input-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.input-group label {
    font-weight: 500;
}

input[type="date"],
input[type="text"],
input[type="password"] {
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

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

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

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

.btn-secondary:hover {
    background: #475569;
}

.info-list {
    list-style: none;
}

.info-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.info-list li:last-child {
    border-bottom: none;
}

.info-list strong {
    color: var(--primary-color);
}

/* Report Styles */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.summary-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.summary-card.danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

.summary-card.warning {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
}

.summary-card h4 {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

.summary-card .number {
    font-size: 2rem;
    font-weight: bold;
}

.error-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.error-table th,
.error-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.error-table th {
    background: var(--background);
    font-weight: 600;
    color: var(--text-secondary);
}

.error-table tr:hover {
    background: var(--background);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-5xx {
    background: #fee2e2;
    color: #991b1b;
}

.badge-4xx {
    background: #fef3c7;
    color: #92400e;
}

.user-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.user-tag {
    background: var(--danger-color);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.alert-warning {
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    color: #92400e;
}

.alert-danger {
    background: #fee2e2;
    border-left: 4px solid var(--danger-color);
    color: #991b1b;
}

.alert-info {
    background: #dbeafe;
    border-left: 4px solid var(--primary-color);
    color: #1e40af;
}

.loading {
    text-align: center;
    padding: 50px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Modal */
.modal {
    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.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
}

.modal-content h2 {
    margin-bottom: 15px;
}

.modal-content input {
    width: 100%;
    margin-bottom: 15px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    margin-top: 30px;
}

@media (max-width: 768px) {
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .error-table {
        font-size: 0.85rem;
    }

    .error-table th,
    .error-table td {
        padding: 8px;
    }
}

/* Model list for rate limit errors */
.model-list {
    margin-top: 12px;
}

.model-item {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.model-item:last-child {
    margin-bottom: 0;
}

.model-item .namespace {
    font-weight: 600;
    color: #92400e;
}

.model-item .model-name {
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

.model-item .error-count {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Model tags for access denied users */
.model-tag {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    margin-right: 6px;
    margin-bottom: 4px;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Small button for actions */
.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

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

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

/* Logs modal */
.logs-modal-content {
    width: 95vw;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.logs-modal-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.logs-modal-header h3 {
    margin-bottom: 5px;
    color: var(--text-primary);
}

.logs-modal-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
}

.logs-modal-body {
    overflow-y: auto;
    flex: 1;
    background: var(--background);
    padding: 15px;
    border-radius: 4px;
    max-height: calc(90vh - 150px);
}

.log-entry {
    background: var(--surface);
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    border-left: 3px solid var(--primary-color);
}

.log-entry:last-child {
    margin-bottom: 0;
}

.log-time {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.log-metadata {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.log-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--background);
    border-radius: 3px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.log-content {
    background: var(--background);
    padding: 10px;
    border-radius: 4px;
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
}

.no-logs {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}
