/* AI Detection Benchmark Dashboard */
:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #232733;
    --border: #2d3244;
    --text: #e1e4ed;
    --text-dim: #8890a4;
    --accent: #6c8cff;
    --accent-dim: #3d5199;
    --green: #3dd68c;
    --red: #ff5c5c;
    --orange: #ffaa3b;
    --yellow: #ffe14d;
}

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

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

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 2rem 0;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

nav {
    display: flex;
    gap: 0;
    margin-top: 1rem;
}

.tab {
    background: none;
    border: none;
    color: var(--text-dim);
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.tab:hover { color: var(--text); }
.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

.view { display: none; }
.view.active { display: block; }

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

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-card .label {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.stat-card.green .value { color: var(--green); }
.stat-card.red .value { color: var(--red); }
.stat-card.orange .value { color: var(--orange); }
.stat-card.accent .value { color: var(--accent); }

/* Panels */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.panel h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.hint {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

/* Tables */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

th {
    color: var(--text-dim);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td.good { color: var(--green); }
td.bad { color: var(--red); }
td.mid { color: var(--orange); }

/* Charts */
.chart-container { position: relative; max-width: 700px; }
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

/* Model Info Grid */
.model-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.model-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
}

.model-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.model-card .model-type {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    margin-bottom: 0.5rem;
}

.model-card .model-type.ai-det {
    background: rgba(108, 140, 255, 0.15);
    color: var(--accent);
}

.model-card .model-type.manip-det {
    background: rgba(255, 170, 59, 0.15);
    color: var(--orange);
}

.model-card p {
    color: var(--text-dim);
    font-size: 0.8rem;
    line-height: 1.4;
}

.model-card a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.8rem;
}

/* Gallery */
.gallery-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    color: var(--text-dim);
    font-size: 0.8rem;
}

select {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

.gallery-count {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-left: auto;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.gallery-item {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
}

.gallery-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.gallery-item.gt-ai { border-color: var(--red); }
.gallery-item.gt-borderline { border-color: var(--orange); }
.gallery-item.gt-clear { border-color: var(--green); }

.gallery-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.gallery-item .item-info {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}

.gallery-item .item-info .gt-label {
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gallery-item .item-info .gt-label.ai { color: var(--red); }
.gallery-item .item-info .gt-label.non-ai { color: var(--green); }
.gallery-item .item-info .gt-label.borderline { color: var(--orange); }

.gallery-item .score-bar {
    display: flex;
    gap: 2px;
    margin-top: 0.3rem;
}

.gallery-item .score-dot {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
}

.gallery-item .score-dot.high { background: var(--red); }
.gallery-item .score-dot.mid { background: var(--orange); }
.gallery-item .score-dot.low { background: var(--green); }
.gallery-item .score-dot.na { background: var(--border); }

/* Detail View */
#detail-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.detail-image-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.detail-image-panel img {
    width: 100%;
    display: block;
}

.detail-meta {
    padding: 1rem;
    font-size: 0.85rem;
}

.detail-meta .meta-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
}

.detail-meta .meta-row .key { color: var(--text-dim); }

.detail-scores-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}

.detail-scores-panel h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.score-row {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.score-row .model-name {
    width: 120px;
    font-size: 0.85rem;
    font-weight: 500;
}

.score-row .score-bar-bg {
    flex: 1;
    height: 24px;
    background: var(--surface2);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.score-row .score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.score-row .score-value {
    width: 60px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.heatmap-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.heatmap-card img { width: 100%; display: block; }
.heatmap-card .hm-label {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Detail view single column on narrow */
@media (max-width: 900px) {
    #detail-content { grid-template-columns: 1fr; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

footer {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    color: var(--text-dim);
    font-size: 0.75rem;
    text-align: center;
    border-top: 1px solid var(--border);
}

/* Loading state */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-dim);
}

.no-data {
    text-align: center;
    padding: 3rem;
    color: var(--text-dim);
    font-style: italic;
}
