/* Filter Inspector */

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

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#top-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: #16213e;
    border-bottom: 1px solid #2a2a4a;
    flex-shrink: 0;
}

#top-bar h1 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

#top-bar select {
    background: #0f1729;
    color: #e0e0e0;
    border: 1px solid #333;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 13px;
}

#summary {
    color: #888;
    font-size: 13px;
    margin-left: auto;
    margin-right: 16px;
}

#top-bar nav {
    display: flex;
    gap: 12px;
}

#top-bar nav a {
    color: #8888cc;
    text-decoration: none;
    font-size: 13px;
}

#top-bar nav a:hover { color: #aaaaee; }

/* ── Main layout ─────────────────────────────────────────────── */

#content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

#words-panel {
    width: 420px;
    flex-shrink: 0;
    background: #14192a;
    border-right: 1px solid #2a2a4a;
    display: flex;
    flex-direction: column;
}

#words-header {
    padding: 10px 14px;
    border-bottom: 1px solid #2a2a4a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #888;
}

#pagination {
    display: flex;
    align-items: center;
    gap: 6px;
}

#pagination button {
    background: #2a2a4a;
    border: none;
    color: #ccc;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

#pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#pagination button:hover:not(:disabled) {
    background: #3a3a5a;
}

#words-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.empty-state {
    text-align: center;
    color: #555;
    padding: 40px 20px;
    font-size: 13px;
}

/* ── Word card ──────────────────────────────────────────────── */

.word-card {
    background: #0f1729;
    border: 1px solid #2a2a4a;
    border-left: 3px solid transparent;
    border-radius: 5px;
    padding: 8px 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.word-card:hover {
    background: #16213e;
}

.word-card.selected {
    border-left-color: #6666cc;
    background: #1c2440;
}

.word-card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.word-text {
    font-size: 16px;
    color: #fff;
    direction: rtl;
    font-family: 'SBL Hebrew', 'Times New Roman', serif;
}

.word-loc {
    font-size: 11px;
    color: #777;
    font-variant-numeric: tabular-nums;
}

.alts {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.alt {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 6px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.15);
    font-size: 13px;
}

.alt-text {
    direction: rtl;
    color: #ddd;
    font-family: 'SBL Hebrew', 'Times New Roman', serif;
}

.alt-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 11px;
    color: #777;
}

.alt-source {
    font-style: italic;
}

.alt-conf {
    font-variant-numeric: tabular-nums;
    color: #888;
}

.alt.alt-flagged {
    background: rgba(180, 80, 60, 0.12);
    color: #cc7766;
}

.alt.alt-flagged .alt-text {
    color: #cc7766;
    text-decoration: line-through;
    text-decoration-color: rgba(204, 119, 102, 0.5);
}

.flag-badge {
    background: #4a2a2a;
    color: #cc7766;
    padding: 1px 5px;
    border-radius: 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ── Resize handle ─────────────────────────────────────────── */

.resize-handle {
    width: 4px;
    background: #2a2a4a;
    cursor: col-resize;
    flex-shrink: 0;
}

.resize-handle:hover {
    background: #4a4a6a;
}

/* ── Page viewer ──────────────────────────────────────────── */

#page-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0a0e1a;
    overflow: hidden;
}

#viewer-toolbar {
    padding: 8px 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    background: #14192a;
    border-bottom: 1px solid #2a2a4a;
    font-size: 12px;
    color: #888;
}

#viewer-toolbar button {
    background: #2a2a4a;
    border: none;
    color: #ccc;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

#viewer-toolbar button:hover {
    background: #3a3a5a;
}

#viewer-page-info {
    flex: 1;
}

#viewer-canvas-wrap {
    flex: 1;
    overflow: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 12px;
}

#viewer-empty {
    margin: auto;
    color: #555;
    font-size: 14px;
    text-align: center;
}

#viewer-canvas {
    position: relative;
    display: inline-block;
    margin: auto;
}

#page-image {
    display: block;
    max-width: none;
}

#bbox-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.word-bbox {
    position: absolute;
    border: 2px solid #ffaa44;
    background: rgba(255, 170, 68, 0.18);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5);
    border-radius: 2px;
    transition: all 0.2s;
}

.hidden { display: none !important; }
