/* =====================================================
   DICOM Scroll Viewer — viewer.css
   ===================================================== */

/* ── ラッパー ──────────────────────────────────────── */
.dsv-viewer-wrap {
    font-family: sans-serif;
    line-height: 1;
    box-sizing: border-box;
    margin: 1.5em auto;
}

.dsv-viewer-wrap *,
.dsv-viewer-wrap *::before,
.dsv-viewer-wrap *::after {
    box-sizing: inherit;
}

.dsv-inner {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

/* ── メインエリア ──────────────────────────────────── */
.dsv-main {
    flex: 1;
    min-width: 0;
}

/* ── 画像フレーム ─────────────────────────────────── */
.dsv-frame {
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    cursor: ns-resize;
    user-select: none;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dsv-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

/* ── オーバーレイ ─────────────────────────────────── */
.dsv-overlay-tl {
    position: absolute;
    top: 10px;
    left: 12px;
    color: #aaff99;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.7;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.dsv-label {
    font-weight: bold;
    letter-spacing: 0.05em;
}

.dsv-overlay-br {
    position: absolute;
    bottom: 10px;
    right: 18px;
    color: #aaaaff;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.7;
    pointer-events: none;
    text-align: right;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* ── スクロールバー ───────────────────────────────── */
.dsv-scrollbar {
    position: absolute;
    right: 5px;
    top: 5px;
    bottom: 5px;
    width: 4px;
    background: rgba(255,255,255,0.12);
    border-radius: 2px;
    pointer-events: none;
}

.dsv-scrollthumb {
    position: absolute;
    width: 100%;
    background: rgba(255,255,255,0.55);
    border-radius: 2px;
    transition: top 0.05s linear;
}

/* ── ローディング ─────────────────────────────────── */
.dsv-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    color: #ccc;
    font-size: 14px;
    letter-spacing: 0.05em;
    border-radius: 6px;
}

.dsv-loading.dsv-hidden {
    display: none;
}

/* ── コントロールバー ─────────────────────────────── */
.dsv-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.dsv-slider {
    flex: 1;
    height: 4px;
    cursor: pointer;
    accent-color: #4af;
}

.dsv-btn {
    background: #1a1a1a;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

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

.dsv-btn:active {
    background: #444;
}

/* ── ヒントテキスト ───────────────────────────────── */
.dsv-hint {
    text-align: center;
    font-size: 11px;
    color: #888;
    margin: 6px 0 0;
}

/* ── サムネイルサイドバー ────────────────────────── */
.dsv-thumbs {
    flex-direction: column;
    gap: 5px;
    width: 72px;
    flex-shrink: 0;
    max-height: 600px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #555 #111;
}

.dsv-thumbs::-webkit-scrollbar        { width: 4px; }
.dsv-thumbs::-webkit-scrollbar-track  { background: #111; }
.dsv-thumbs::-webkit-scrollbar-thumb  { background: #555; border-radius: 2px; }

.dsv-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    background: #111;
    display: block;
    transition: border-color 0.12s, opacity 0.12s;
    opacity: 0.6;
}

.dsv-thumb:hover {
    opacity: 0.85;
}

.dsv-thumb.dsv-thumb-active {
    border-color: #4af;
    opacity: 1;
}

/* ── レスポンシブ ─────────────────────────────────── */
@media (max-width: 520px) {
    .dsv-thumbs {
        width: 52px;
    }
    .dsv-overlay-tl,
    .dsv-overlay-br {
        font-size: 10px;
    }
}

/* ── 最大化ボタン ─────────────────────────────────── */
.dsv-btn-fullscreen {
    position: absolute;
    top: 8px;
    right: 18px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 5px;
    color: #ddd;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    transition: background 0.15s, color 0.15s;
    z-index: 10;
}

.dsv-btn-fullscreen:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.dsv-btn-fullscreen svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ── フルスクリーン時のスタイル ───────────────────── */
.dsv-viewer-wrap.dsv-is-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 12px !important;
    background: #000 !important;
    z-index: 2147483647 !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
}

.dsv-viewer-wrap.dsv-is-fullscreen .dsv-inner {
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

.dsv-viewer-wrap.dsv-is-fullscreen .dsv-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.dsv-viewer-wrap.dsv-is-fullscreen .dsv-frame {
    flex: 1;
    height: auto !important;
    min-height: 0;
}

.dsv-viewer-wrap.dsv-is-fullscreen .dsv-thumbs {
    max-height: none;
}
