/* ============================================================
   HC-IMÁGENES — pestaña "Imágenes" de la Historia Clínica
   Acompaña a js/modules/hc-imagenes.js
   ============================================================ */

.hcimg-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Barra de herramientas ─────────────────────────────── */
.hcimg-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
}

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

.hcimg-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    background: #fff;
    color: #4338ca;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
}

.hcimg-btn:hover {
    background: #f5f3ff;
    box-shadow: 0 1px 4px rgba(79, 70, 229, .18);
}

.hcimg-btn.primary {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}

.hcimg-btn.primary:hover {
    background: #4338ca;
}

.hcimg-btn .material-symbols-outlined {
    font-size: 1.05rem;
}

.hcimg-hint-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .72rem;
    font-weight: 600;
    color: #64748b;
}

.hcimg-hint-inline .material-symbols-outlined {
    font-size: .95rem;
}

.hcimg-tag {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
}

.hcimg-tag label {
    font-size: .72rem;
    font-weight: 700;
    color: #4338ca;
}

.hcimg-select {
    padding: 5px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    font-size: .75rem;
    font-weight: 600;
    color: #334155;
    max-width: 100%;
}

.hcimg-budget {
    font-size: .7rem;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
}

.hcimg-budget.alto {
    color: #b91c1c;
}

/* ── Zona de arrastre ──────────────────────────────────── */
.hcimg-drop {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border: 2px dashed #c7d2fe;
    border-radius: 12px;
    background: #fafaff;
    color: #475569;
    font-size: .82rem;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.hcimg-drop:hover,
.hcimg-drop.activo {
    border-color: #4f46e5;
    background: #eef2ff;
}

.hcimg-drop .material-symbols-outlined {
    font-size: 2rem;
    color: #6366f1;
}

.hcimg-drop small {
    display: block;
    margin-top: 2px;
    font-size: .72rem;
    color: #94a3b8;
}

/* ── Grilla de tarjetas ────────────────────────────────── */
.hcimg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
}

.hcimg-vacio {
    grid-column: 1 / -1;
    padding: 26px;
    text-align: center;
    color: #94a3b8;
    font-size: .82rem;
    border: 1px dashed #e2e8f0;
    border-radius: 10px;
}

.hcimg-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}

.hcimg-card.subiendo {
    opacity: .78;
}

.hcimg-thumbwrap {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: #0f172a;
    cursor: zoom-in;
}

.hcimg-thumbwrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.hcimg-badge,
.hcimg-pdf,
.hcimg-estado {
    position: absolute;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: .63rem;
    font-weight: 700;
    line-height: 1.4;
    backdrop-filter: blur(4px);
}

.hcimg-badge {
    top: 5px;
    left: 5px;
    background: rgba(79, 70, 229, .88);
    color: #fff;
}

.hcimg-pdf {
    top: 5px;
    right: 5px;
    background: rgba(220, 38, 38, .88);
    color: #fff;
}

.hcimg-estado {
    bottom: 5px;
    left: 5px;
    background: rgba(15, 23, 42, .75);
    color: #e2e8f0;
}

.hcimg-estado.ok {
    background: rgba(22, 163, 74, .85);
    color: #fff;
}

.hcimg-estado.error {
    background: rgba(220, 38, 38, .9);
    color: #fff;
    cursor: pointer;
}

.hcimg-titulo,
.hcimg-nota {
    width: 100%;
    padding: 5px 7px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    font-size: .75rem;
    font-family: inherit;
    color: #1e293b;
    background: #fff;
}

.hcimg-titulo {
    font-weight: 700;
}

.hcimg-nota {
    min-height: 42px;
    resize: vertical;
}

.hcimg-titulo:focus,
.hcimg-nota:focus,
.hcimg-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, .16);
}

.hcimg-selectores {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 5px;
}

.hcimg-acciones {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.hcimg-check {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: .7rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
}

.hcimg-check input {
    accent-color: #4f46e5;
}

.hcimg-check .material-symbols-outlined {
    font-size: .95rem;
}

.hcimg-acciones-der {
    display: inline-flex;
    gap: 2px;
}

.hcimg-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    text-decoration: none;
}

.hcimg-icon:hover {
    background: #f1f5f9;
    color: #4f46e5;
}

.hcimg-icon.peligro:hover {
    background: #fef2f2;
    color: #dc2626;
}

.hcimg-icon .material-symbols-outlined {
    font-size: 1.05rem;
}

/* ── Visor a pantalla completa ─────────────────────────── */
.hcimg-visor {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    background: rgba(2, 6, 23, .94);
}

.hcimg-visor.abierto {
    display: block;
}

.hcimg-visor-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: linear-gradient(180deg, rgba(2, 6, 23, .85), transparent);
    z-index: 2;
}

.hcimg-visor-titulo {
    color: #f1f5f9;
    font-size: .88rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hcimg-visor-tools {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.hcimg-visor-tools button,
.hcimg-visor-tools a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, .1);
    color: #e2e8f0;
    cursor: pointer;
    text-decoration: none;
}

.hcimg-visor-tools button:hover,
.hcimg-visor-tools a:hover {
    background: rgba(255, 255, 255, .22);
}

.hcimg-visor-lienzo {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}

.hcimg-visor-lienzo img {
    max-width: 92vw;
    max-height: 82vh;
    transform-origin: center center;
    transition: transform .08s linear;
    user-select: none;
    -webkit-user-drag: none;
}

.hcimg-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 62px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, .08);
    color: #e2e8f0;
    cursor: pointer;
    z-index: 2;
}

.hcimg-nav:hover {
    background: rgba(255, 255, 255, .2);
}

.hcimg-nav.prev {
    left: 10px;
}

.hcimg-nav.next {
    right: 10px;
}

.hcimg-visor-pie {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 12px 16px;
    background: linear-gradient(0deg, rgba(2, 6, 23, .9), transparent);
    color: #cbd5e1;
    font-size: .78rem;
    text-align: center;
    z-index: 2;
}

@media (max-width: 640px) {
    .hcimg-tag {
        margin-left: 0;
        width: 100%;
    }

    .hcimg-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .hcimg-drop {
        padding: 12px;
    }
}
