:root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --surface-hover: #1a1a24;
    --border: #2a2a3a;
    --text: #e4e4e7;
    --text-muted: #71717a;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --success: #22c55e;
    --warning: #eab308;
    --error: #ef4444;
    --radius: 8px;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Search */
.search-box {
    margin-bottom: 1.5rem;
}

.search-box input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--primary);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Filters */
.filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.filters select {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
}

.result-count {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* Results */
.results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.error-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.error-card:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateX(4px);
}

.error-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.error-code {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.error-name {
    font-weight: 500;
}

.error-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.error-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: var(--border);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.tag-fatal {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.tag-temporary {
    background: rgba(234, 179, 8, 0.2);
    color: var(--warning);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5rem;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}

.modal-close:hover {
    color: var(--text);
}

.modal-header {
    margin-bottom: 1.25rem;
}

.modal-code {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 600;
}

.modal-name {
    font-size: 1.1rem;
    margin-top: 0.25rem;
}

.modal-section {
    margin-bottom: 1.25rem;
}

.modal-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.modal-section p {
    font-size: 0.95rem;
}

.modal-section ul {
    list-style: none;
    padding: 0;
}

.modal-section li {
    font-size: 0.95rem;
    padding: 0.3rem 0 0.3rem 1.25rem;
    position: relative;
}

.modal-section li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary);
}

.xpath {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background: var(--bg);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    color: var(--success);
    overflow-x: auto;
    white-space: nowrap;
}

.resource-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.resource-link:hover {
    text-decoration: underline;
}

.resource-type {
    font-size: 0.65rem;
    background: var(--bg);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Footer */
.footer {
    margin-top: 3rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

.footer a:hover {
    text-decoration: underline;
}

.privacy {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    opacity: 0.7;
}

.feedback-link {
    margin-top: 0.75rem;
}

.feedback-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.feedback-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    text-decoration: none;
}

/* Empty State */
.empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

/* Responsive */
@media (max-width: 500px) {
    .header h1 {
        font-size: 1.75rem;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .result-count {
        margin-left: 0;
        text-align: center;
    }
}
