/* ===== FUENTE ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
    --accent: #00a8ff;
    --bg: #000;
    --panel: #111;
    --border: #2a2a2a;
    --text: #e0e0e0;
    --text-dim: #888;
    --success: #28a745;
    --danger: #e53e3e;
    --radius: 6px;
}

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

html,
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    user-select: none;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ===== HEADER ===== */
header {
    background: var(--panel);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    gap: 1.5rem;
    flex-shrink: 0;
    min-height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.logo .icon {
    font-size: 1.4rem;
}

.logo h1 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.paciente-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.paciente-info p {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.4;
}

#nombre-paciente {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

#meta-estudio {
    font-size: 0.72rem;
}

.imagen-counter {
    background: rgba(0, 168, 255, 0.15);
    color: var(--accent);
    border: 1px solid rgba(0, 168, 255, 0.3);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ===== MAIN LAYOUT ===== */
main {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* ===== BARRA DE HERRAMIENTAS ===== */
.herramientas {
    width: 54px;
    background: var(--panel);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 6px;
    border-right: 1px solid var(--border);
    align-items: center;
    flex-shrink: 0;
    overflow-y: auto;
    scrollbar-width: none;
}

.herramientas::-webkit-scrollbar {
    display: none;
}

.tool-sep {
    width: 70%;
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.tool-btn {
    width: 38px;
    height: 38px;
    background: #1a1a1a;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
    flex-shrink: 0;
}

.tool-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 0 10px rgba(0, 168, 255, 0.4);
    transform: scale(1.08);
}

.tool-btn.active {
    background: rgba(0, 168, 255, 0.2);
    border-color: var(--accent);
    color: var(--accent);
}

.reset-btn:hover {
    background: #444;
    border-color: #888;
}

/* ===== CONTENEDOR IMAGEN ===== */
.contenedor-imagen {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle, #1a1a1a 1px, transparent 1px);
    background-size: 20px 20px;
    background-color: #050505;
    cursor: grab;
}

.contenedor-imagen:active {
    cursor: grabbing;
}

#imagen-actual {
    position: relative;
    z-index: 5;
    max-width: 98%;
    max-height: 98%;
    display: none;
    object-fit: contain;
    transition: transform 0.1s ease-out, filter 0.1s ease-out;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    transform-origin: center center;
    background-color: #000;
    /* Fondo negro por si la imagen tiene transparencia */
}

#dicom-viewer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    display: none;
}

/* Mensaje sin imagen */
.no-image-msg {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-dim);
    text-align: center;
}

.no-image-msg span {
    font-size: 3rem;
}

.no-image-msg p {
    font-size: 0.95rem;
}

.no-image-msg small {
    font-size: 0.75rem;
}

.no-image-msg code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* ===== FLECHAS DE NAVEGACIÓN ===== */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 80px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--radius);
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.nav-arrow:hover {
    background: rgba(0, 168, 255, 0.5);
    border-color: var(--accent);
    color: white;
    transform: translateY(-50%) scale(1.05);
}

.nav-prev {
    left: 12px;
}

.nav-next {
    right: 12px;
}

/* ===== ZOOM INDICATOR ===== */
.zoom-indicator {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(0, 168, 255, 0.3);
    backdrop-filter: blur(4px);
    pointer-events: none;
    font-family: 'JetBrains Mono', monospace;
}

/* ===== LISTA DE MINIATURAS ===== */
.lista-imagenes {
    width: 110px;
    /* Más estrecha como en la imagen */
    background: #0a0a0a;
    /* Fondo muy oscuro */
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Espaciado mínimo */
    flex-shrink: 0;
}

.lista-imagenes::-webkit-scrollbar {
    width: 4px;
}

.lista-imagenes::-webkit-scrollbar-thumb {
    background: #222;
    border-radius: 2px;
}

.miniaturas-title {
    font-size: 0.6rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-bottom: 8px;
    margin-bottom: 5px;
    text-align: center;
    border-bottom: 1px solid #1a1a1a;
}

.miniatura {
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 100px;
    /* Asegurar que tengan altura */
    flex-shrink: 0;
    /* EVITAR QUE SE APLASTEN */
    background: #000;
    border: 1px solid #222;
    border-radius: 4px;
    cursor: pointer;
    background-size: cover;
    /* Volver a cover para que se vea lleno */
    background-repeat: no-repeat;
    background-position: center;
    display: flex;
    position: relative;
    overflow: hidden;
    transition: all 0.1s;
}

.miniatura:hover {
    border-color: #444;
}

.miniatura.activa {
    border: 1.5px solid var(--accent);
    box-shadow: inset 0 0 5px rgba(0, 168, 255, 0.3);
}

.mini-num,
.dcm-num {
    font-size: 0.55rem;
    color: #444;
    /* Color tenue como en la referencia */
    position: absolute;
    bottom: 2px;
    right: 3px;
    pointer-events: none;
}

.dcm-label {
    font-size: 0.55rem;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.dcm-num,
.mini-num {
    font-size: 0.65rem;
    color: var(--text-dim);
    position: absolute;
    bottom: 3px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    padding: 1px 4px;
    border-radius: 3px;
}

/* ===== FOOTER ===== */
footer {
    background: var(--panel);
    padding: 5px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    gap: 1rem;
}

#status-bar {
    color: var(--accent);
    font-weight: 500;
    font-family: monospace;
    min-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.footer-center {
    text-align: center;
    flex: 1;
}

.footer-right {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.key-hint {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.65rem;
    white-space: nowrap;
}