/* ── DICOM Viewer ─────────────────────────────────────────────────────────── */

:root {
    --dv-primary: #2563eb;
    --dv-border: #e5e7eb;
}

/* ── Base button ── */
.dv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-family: inherit;
    padding: 4px 10px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #222;
    color: #ccc;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.4;
    transition: background 0.15s, color 0.15s;
}

.dv-btn:hover {
    background: #333;
    color: #fff;
}

/* ── Viewer wrap ── */
.dv-viewer-wrap {
    border: 1px solid var(--dv-border);
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    margin-bottom: 10px;
    box-sizing: border-box;
}

/* ── Series bar ── */
.dv-series-bar {
    display: flex;
    gap: 6px;
    padding: 8px;
    background: #111;
    overflow-x: auto;
    flex-wrap: wrap;
}

.dv-series-thumb {
    background: #222;
    color: #ccc;
    border: 1px solid #444;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.dv-series-thumb:hover {
    background: #333;
}

.dv-series-thumb.is-active {
    background: var(--dv-primary);
    color: #fff;
    border-color: var(--dv-primary);
}

/* ── Main viewer ── */
.dv-viewer {
    width: 100%;
    height: 480px;
    position: relative;
    background: #000;
}

.dv-viewer canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ── Slice scrollbar ── */
.dv-slice-scrollbar {
    position: absolute;
    right: 4px;
    top: 10px;
    bottom: 10px;
    width: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    z-index: 10;
}

.dv-slice-thumb {
    position: absolute;
    left: 0;
    right: 0;
    height: 40px;
    top: 0;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 10px;
    transition: background 0.1s;
}

.dv-slice-scrollbar:hover .dv-slice-thumb,
.dv-slice-scrollbar:active .dv-slice-thumb {
    background: rgba(255, 255, 255, 0.75);
}

/* ── Overlay (loading / error) ── */
.dv-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}

.dv-loading,
.dv-error {
    color: #aaa;
    font-size: 14px;
}

.dv-error {
    color: #f87171;
}

/* ── Toolbar ── */
.dv-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    background: #111;
    border-top: 1px solid #333;
}

.dv-tools {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.dv-tool-btn,
.dv-reset-btn,
.dv-prev,
.dv-next {
    color: #ccc;
    border-color: #444;
    background: #222;
}

.dv-tool-btn:hover,
.dv-reset-btn:hover,
.dv-prev:hover,
.dv-next:hover,
.dv-zoom-in:hover,
.dv-zoom-out:hover,
.dv-wl-inc:hover,
.dv-wl-dec:hover {
    background: #333;
    color: #fff;
}

/* ── Button group (zoom +/-, W/L +/-) ── */
.dv-btn-group {
    display: flex;
    border: 1px solid #444;
    border-radius: 4px;
    background: #222;
    overflow: hidden;
    margin-right: 4px;
}

.dv-btn-group button {
    border: none !important;
    background: transparent !important;
    color: #ccc;
    min-width: 32px;
    height: 28px;
    padding: 0 8px;
    font-weight: bold;
    cursor: pointer;
}

.dv-btn-group button:first-child {
    border-right: 1px solid #444 !important;
}

.dv-btn-group button:hover {
    background: #333 !important;
    color: #fff !important;
}

/* ── Active tool ── */
.dv-tool-btn.is-active {
    background: var(--dv-primary);
    color: #fff;
    border-color: var(--dv-primary);
}

/* ── Slice navigation ── */
.dv-slice-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dv-slice-info {
    color: #aaa;
    font-size: 13px;
    min-width: 50px;
    text-align: center;
}

/* ── Download bar ── */
.dv-download-bar {
    padding: 8px 12px;
    background: #111;
    border-top: 1px solid #333;
}

.dv-download {
    display: inline-block;
    padding: 4px 12px;
    font-size: 13px;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.dv-download:hover {
    background: #333;
    color: #fff;
}

.dv-download-name {
    color: #888;
    font-size: 12px;
    margin-left: 4px;
}

/* Series bar: dropdown mode */
.dv-series-bar .dv-series-label {
    color: #aaa;
    font-size: 12px;
    white-space: nowrap;
    align-self: center;
    margin-right: 4px;
    user-select: none;
}

.dv-series-select {
    font-size: 13px;
    font-family: inherit;
    background: #222;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    min-width: 160px;
    max-width: 320px;
    flex: 1 1 auto;
    line-height: 1.4;
}

.dv-series-select:hover { border-color: #666; background: #2a2a2a; }
.dv-series-select:focus { outline: 2px solid var(--dv-primary); outline-offset: 1px; }

.dv-series-bar:has(.dv-series-select) { flex-wrap: nowrap; align-items: center; }

/* Select2 dark theme overrides (only active when Select2 is present) */
.dv-select2-dropdown { background: #1a1a1a; border: 1px solid #444; color: #ccc; }
