/* ── Reset & base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #1a1a1a;
    background: #f5f5f5;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ─────────────────────────────────────────────────────── */
header {
    background: #1a1a2e;
    color: #fff;
    padding: 1.25rem 2rem;
}

.header-inner h1 { font-size: 1.5rem; font-weight: 700; }
.header-inner .subtitle { font-size: 0.875rem; color: #a0aec0; margin-top: 0.2rem; }

/* ── Main layout ────────────────────────────────────────────────── */
main {
    display: flex;
    min-height: calc(100vh - 120px);
}

/* ── Filter panel ───────────────────────────────────────────────── */
.filter-panel {
    width: 280px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
}

.filter-panel h2 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.filter-group { display: flex; flex-direction: column; gap: 0.4rem; }

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
}

select, input[type="text"] {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    background: #fff;
    color: #1a1a1a;
}

select:focus, input[type="text"]:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

/* ── Brain area / Layer buttons ─────────────────────────────────── */
.button-group { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.filter-btn {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    color: #374151;
    transition: background 0.1s, border-color 0.1s;
}

.filter-btn:hover { background: #f0f4ff; border-color: #2563eb; }
.filter-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* ── Count feedback ─────────────────────────────────────────────── */
.count-feedback { font-size: 0.8rem; color: #6b7280; }

/* ── Neuron list ────────────────────────────────────────────────── */
.neuron-list {
    list-style: none;
    margin-top: 0.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    max-height: 220px;
    overflow-y: auto;
}

.neuron-item {
    padding: 0.4rem 0.65rem;
    font-size: 0.82rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
}

.neuron-item:last-child { border-bottom: none; }
.neuron-item:hover { background: #f0f4ff; }
.neuron-item.active { background: #eff6ff; font-weight: 600; color: #1d4ed8; }

.no-results { font-size: 0.82rem; color: #9ca3af; margin-top: 0.25rem; }
.too-many-hint { font-size: 0.82rem; color: #6b7280; margin-top: 0.25rem; font-style: italic; }

/* ── Download link ──────────────────────────────────────────────── */
.download-link { font-size: 0.8rem; margin-top: auto; }

/* ── Neuron display ─────────────────────────────────────────────── */
.neuron-display {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.load-error {
    padding: 2rem;
    color: #b91c1c;
    font-size: 0.9rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    margin: 2rem;
}

.empty-state {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 0.95rem;
}

.neuron-detail-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.3rem;
}

.neuron-detail-header h2 { font-size: 1.35rem; }

.dismiss-btn {
    flex-shrink: 0;
    width: 1.6rem;
    height: 1.6rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #6b7280;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.dismiss-btn:hover { background: #fee2e2; border-color: #ef4444; color: #ef4444; }

.neuron-meta { font-size: 0.85rem; color: #6b7280; margin-bottom: 1.5rem; }

/* ── MEDI GIF ───────────────────────────────────────────────────── */
.medi-container {
    display: inline-block;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.medi-gif {
    display: block;
    max-width: 480px;
    max-height: 480px;
    width: 100%;
}

/* ── Properties table ───────────────────────────────────────────── */
.properties-table {
    border-collapse: collapse;
    font-size: 0.875rem;
    width: max-content;
    max-width: 100%;
}

.properties-table th, .properties-table td {
    padding: 0.4rem 1rem 0.4rem 0;
    text-align: left;
    vertical-align: top;
}

.properties-table th {
    color: #6b7280;
    font-weight: 600;
    padding-right: 1.5rem;
    white-space: nowrap;
}

/* ── Footer ─────────────────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: #9ca3af;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 700px) {
    main { flex-direction: column; }
    .filter-panel { width: 100%; border-right: none; border-bottom: 1px solid #e2e8f0; }
}
