/* taxonomy-viewer-core v1.0.0 */
/* Shared CSS for Taxonomy Suite — Dark Theme */
/* License: MIT | (c) 2024-2026 Sven Hallwirth */

:root {
    --bg: #1a1b2e;
    --bg-card: #232540;
    --bg-hover: #2a2d52;
    --bg-input: #2e3158;
    --text: #e0e0e8;
    --text-muted: #9498b8;
    --text-dim: #6b6f94;
    --accent: #6c8cff;
    --accent-hover: #8da6ff;
    --border: #3a3d62;
    --success: #4caf84;
    --warning: #f0a050;
    --danger: #e05858;
}

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

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

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

/* ── Header ── */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.header h1 {
    font-size: 1.3rem;
    font-weight: 600;
    white-space: nowrap;
}
.header h1 span { color: var(--accent); }
.stats-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.82rem;
}
.stat-item {
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.stat-item .val { color: var(--accent); font-weight: 600; margin-right: 4px; }

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 2px;
    margin: 16px 0 12px;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}
.tab {
    padding: 8px 20px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all 0.15s;
    border: 1px solid transparent;
    border-bottom: none;
}
.tab:hover { color: var(--text); background: var(--bg-hover); }
.tab.active {
    color: var(--accent);
    background: var(--bg-card);
    border-color: var(--border);
    font-weight: 600;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Search ── */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}
.search-box input {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border 0.2s;
}
.search-box input:focus { border-color: var(--accent); }
.search-box input::placeholder { color: var(--text-dim); }

/* ── Buttons ── */
.btn {
    padding: 8px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s;
}
.btn:hover { background: var(--accent-hover); }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--accent); color: var(--text); background: var(--bg-hover); }

/* ── Tables ── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-card);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}
td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
tr:hover td { background: var(--bg-hover); }
.table-wrap { overflow-x: auto; }

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
}
.card h2 { font-size: 1.1rem; margin-bottom: 12px; color: var(--text); }
.card h3 { font-size: 0.95rem; margin: 16px 0 8px; color: var(--text-muted); }

/* ── Entity Card Grid ── */
.entity-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}
.entity-card-grid.single-row {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}
.entity-card-grid.single-row .entity-card-def { display: none; }
.entity-card-grid.single-row .entity-card { padding: 10px; }
.entity-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.entity-card:hover { border-color: var(--accent); }
.entity-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.entity-card-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}
.entity-card-label { font-weight: 600; font-size: 0.9rem; }
.entity-card-def {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.entity-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ── Detail Overlay ── */
.detail-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    overflow-y: auto;
    padding: 40px 20px;
}
.detail-overlay.active { display: block; }
.detail-panel {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.detail-header {
    background: var(--bg-card);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
}
.detail-header h2 { font-size: 1.2rem; }
.detail-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.detail-close:hover { color: var(--text); }
.detail-body { padding: 24px; }

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.info-item { padding: 10px; background: var(--bg-card); border-radius: 8px; }
.info-item .lbl { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.info-item .val { font-size: 0.92rem; color: var(--text); }

/* ── Heatmap ── */
.heatmap-table { font-size: 0.8rem; }
.heatmap-table th { padding: 6px 8px; font-size: 0.72rem; }
.heatmap-table td {
    padding: 6px 8px;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 500;
    min-width: 55px;
}
.heatmap-table td.row-label {
    text-align: left;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}
.heatmap-table td.total-cell { font-weight: 700; color: var(--text); }

/* ── Taxonomy Browser ── */
.tax-group { margin-bottom: 16px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.tax-header {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    background: var(--bg-hover); cursor: pointer; user-select: none;
}
.tax-header:hover { background: var(--bg-input); }
.tax-header .tax-code { font-weight: 700; font-size: 0.95rem; min-width: 50px; }
.tax-header .tax-label { font-weight: 600; flex: 1; }
.tax-header .tax-count {
    font-size: 0.8rem; color: var(--text-muted); background: var(--bg);
    padding: 2px 8px; border-radius: 10px;
}
.tax-header .tax-chevron { transition: transform 0.2s; color: var(--text-dim); }
.tax-header.open .tax-chevron { transform: rotate(90deg); }
.tax-body { display: none; padding: 0 16px 12px; }
.tax-header.open + .tax-body { display: block; }
.tax-def { font-size: 0.84rem; color: var(--text-muted); margin: 8px 0 12px; line-height: 1.5; }
.tax-subtypes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px; }
.tax-subtype {
    display: flex; gap: 8px; align-items: baseline; font-size: 0.82rem;
    padding: 4px 8px; border-radius: 4px;
}
.tax-subtype:hover { background: var(--bg-hover); }
.tax-subtype .sub-name { color: var(--text); font-weight: 500; }
.tax-subtype .sub-count { color: var(--text-dim); font-size: 0.75rem; min-width: 30px; text-align: right; }
.tax-subtype .sub-def { color: var(--text-muted); font-size: 0.78rem; }

/* ── Chart Container ── */
.chart-container { max-width: 600px; margin: 16px 0; }

/* ── Loading / Empty ── */
.loading, .empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-dim);
    font-size: 0.9rem;
}
.loading::after {
    content: '';
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ── */
.footer {
    text-align: center;
    padding: 24px 0;
    margin-top: 40px;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-dim);
}
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Glossar: Kategorie-Badge (Normbeschreibung vs. Legaldefinition) ── */
.cat-badge {
    display: inline-block; font-size: 0.65rem; font-weight: 600;
    padding: 1px 6px; border-radius: 8px; vertical-align: middle;
    background: #3a3550; color: #c9b8ff; border: 1px solid #5a4d80;
    white-space: nowrap;
}

/* ── Glossar: Definitions-Unterpunkte a)/b)/c) als barrierefreie Liste ── */
.def-enum { list-style: none; margin: 0.35em 0 0 0; padding-left: 1.9em; }
.def-enum > li { margin: 0.2em 0; text-indent: -1.3em; }
.def-enum-mark { display: inline-block; min-width: 1.1em; font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .header-inner { flex-direction: column; align-items: flex-start; }
    .stats-bar { font-size: 0.75rem; }
    .info-grid { grid-template-columns: 1fr; }
    .entity-card-grid { grid-template-columns: 1fr; }
    .tax-subtypes { grid-template-columns: 1fr; }
}
