/* Columnas, paneles laterales y distribución principal. */

/* ============================================================
   INFORMACIÓN FIJA A LA DERECHA
   ============================================================ */

/*
 * El panel deja de comportarse como drawer desplegable.
 * La zona principal reserva siempre su espacio.
 */
.info-drawer {
    width: var(--info-width) !important;

    position: fixed !important;

    top: 80px !important;
    right: 12px !important;
    bottom: 12px !important;

    z-index: 70 !important;

    display: flex !important;
    flex-direction: column !important;

    overflow: hidden !important;

    opacity: 1 !important;
    pointer-events: auto !important;

    transform: none !important;

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.99),
            rgba(245, 250, 254, 0.99)
        ) !important;

    border:
        1px solid #b8cfdf !important;

    border-radius:
        18px !important;

    box-shadow:
        0 18px 48px
        rgba(62, 94, 118, 0.17) !important;
}

/*
 * La aplicación reserva físicamente el ancho del panel.
 * No tapa las tarjetas.
 */
.main-area {
    margin-right:
        calc(var(--info-width) + 12px) !important;
}

/*
 * Ya no tiene sentido cerrar o desplegar la información.
 */
#infoToggle,
#infoClose {
    display: none !important;
}

.info-header {
    min-height: 58px !important;

    padding:
        11px 15px !important;

    background:
        linear-gradient(
            180deg,
            #ffffff,
            #f1f8fd
        ) !important;

    border-bottom:
        1px solid var(--border) !important;
}

.info-header strong {
    font-size: 15px;
    font-weight: 760;
}

.info-body {
    min-height: 0 !important;
    flex: 1 !important;

    overflow-y: auto !important;

    padding: 15px !important;
}

.info-preview {
    height: 185px !important;

    margin-bottom: 14px !important;

    background:
        linear-gradient(
            145deg,
            #eef7fd,
            #e3f0f9
        ) !important;

    border:
        1px solid #c9ddea !important;

    border-radius:
        13px !important;

    box-shadow:
        inset 0 0 0 1px
        rgba(255, 255, 255, 0.65);
}

.info-title {
    padding:
        0 2px 12px !important;

    border-bottom:
        1px solid var(--border);

    font-size:
        16px !important;

    line-height:
        1.35;
}

.info-table {
    display: grid;
    gap: 10px;

    margin-top: 13px;
    padding: 12px;

    background:
        rgba(255, 255, 255, 0.74);

    border:
        1px solid #dce8f1;

    border-radius:
        12px;
}

.info-row {
    grid-template-columns:
        103px minmax(0, 1fr) !important;
}

.info-value {
    font-weight: 520;
}


/* ============================================================
   VISOR: FLECHAS EN LOS LATERALES
   ============================================================ */

.viewer-modal {
    width: min(1450px, 96vw) !important;
}

.viewer-stage {
    min-height:
        calc(100vh - 150px) !important;

    position: relative !important;

    background:
        linear-gradient(
            145deg,
            #edf6fc,
            #e1edf6
        ) !important;
}

.viewer-stage img {
    width: auto !important;
    height: auto !important;

    max-width: 100% !important;
    max-height:
        calc(100vh - 180px) !important;

    object-fit: contain !important;
}

.viewer-stage video {
    width: min(
        100%,
        1280px
    ) !important;

    height: auto !important;

    max-height:
        calc(100vh - 180px) !important;

    background: black;
    object-fit: contain !important;
}

.viewer-side-arrow {
    width: 50px;
    height: 76px;

    position: absolute;
    top: 50%;
    z-index: 5;

    display: grid;
    place-items: center;

    color: #234a68;
    background:
        rgba(255, 255, 255, 0.90);

    border:
        1px solid #bfd5e5;

    border-radius:
        15px;

    box-shadow:
        0 8px 26px
        rgba(52, 84, 108, 0.18);

    font-size: 27px;
    cursor: pointer;

    transform:
        translateY(-50%);

    backdrop-filter:
        blur(12px);
}

.viewer-side-arrow.previous {
    left: 16px;
}

.viewer-side-arrow.next {
    right: 16px;
}

.viewer-side-arrow:disabled {
    opacity: 0.22;
    cursor: default;
}


/* ============================================================
   MENÚ CONTEXTUAL
   ============================================================ */

.context-menu {
    min-width:
        250px !important;

    padding:
        7px !important;
}

.context-menu-section {
    padding:
        5px 10px 4px;

    color:
        var(--text-muted);

    font-size:
        10px;

    font-weight:
        800;

    letter-spacing:
        0.10em;

    text-transform:
        uppercase;
}

.context-menu-separator {
    height: 1px;

    margin: 5px 4px;

    background:
        var(--border);
}

.context-menu button {
    min-height:
        38px !important;

    padding:
        9px 11px !important;
}

.context-shortcut {
    margin-left: auto;

    color:
        var(--text-muted);

    font-size:
        11px;
}

#compressSelectedButton {
    color: #67518f;
}


/* En pantallas pequeñas el panel pasa a ocupar casi todo. */
@media (max-width: 1000px) {
    .main-area {
        margin-right: 0 !important;
    }

    .info-drawer {
        left: 10px !important;
        right: 10px !important;

        width: auto !important;
    }
}

/* ============================================================
   BOTÓN DE ESCANEO
   ============================================================ */

#scanAllFilesButton {
    color: #2d719f;
    background:
        linear-gradient(
            180deg,
            #f8fcff,
            #edf7fd
        );
}

#scanAllFilesButton:hover {
    color: #1d5c89;
    background: #e6f3fc;
    border-color: #a9cee7;
}

#scanAllFilesButton.scanning {
    pointer-events: none;
    opacity: 0.72;
}


/* ============================================================
   PANEL DE PROGRESO
   ============================================================ */

.scan-all-panel {
    position: fixed;

    right: 22px;
    bottom: 22px;

    z-index: 180;

    width: min(
        430px,
        calc(100vw - 44px)
    );

    overflow: hidden;

    color: var(--text);

    background:
        linear-gradient(
            160deg,
            rgba(255, 255, 255, 0.99),
            rgba(239, 248, 254, 0.99)
        );

    border: 1px solid #b9d2e3;
    border-radius: 16px;

    box-shadow:
        0 20px 60px
        rgba(50, 83, 108, 0.22);

    animation:
        scan-panel-enter 180ms ease both;
}

.scan-all-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 13px 15px;

    background:
        linear-gradient(
            180deg,
            #ffffff,
            #f1f8fd
        );

    border-bottom: 1px solid var(--border);
}

.scan-all-header strong {
    font-size: 14px;
}

.scan-all-close {
    width: 30px;
    height: 30px;

    display: grid;
    place-items: center;

    color: var(--text-muted);
    background: white;
    border: 1px solid var(--border);
    border-radius: 9px;

    cursor: pointer;
}

.scan-all-body {
    max-height: 330px;

    overflow-y: auto;
    padding: 13px;
}

.scan-all-summary {
    margin-bottom: 11px;

    color: var(--text-soft);
    font-size: 12px;
}

.scan-location {
    margin-bottom: 9px;
    padding: 11px;

    background: rgba(255, 255, 255, 0.76);
    border: 1px solid #d7e6f0;
    border-radius: 11px;
}

.scan-location:last-child {
    margin-bottom: 0;
}

.scan-location-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    margin-bottom: 7px;
}

.scan-location-name {
    min-width: 0;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    font-weight: 680;
}

.scan-location-state {
    flex: 0 0 auto;

    color: var(--text-muted);
    font-size: 11px;
}

.scan-location-details {
    color: var(--text-muted);
    font-size: 11px;
}

.scan-progress {
    height: 6px;

    overflow: hidden;

    margin-top: 9px;

    background: #e4eff6;
    border-radius: 999px;
}

.scan-progress span {
    width: 0;
    height: 100%;

    display: block;

    background:
        linear-gradient(
            90deg,
            #65afe4,
            #3389c8
        );

    border-radius: inherit;

    transition: width 250ms ease;
}

.scan-progress.indeterminate span {
    width: 38%;

    animation:
        scan-indeterminate 1.15s ease-in-out infinite;
}

.scan-location.finished .scan-progress span {
    width: 100%;
    background: #43a77e;
}

.scan-location.error {
    border-color: #e8b9bf;
}

.scan-location.error .scan-progress span {
    width: 100%;
    background: #d65e6a;
}

@keyframes scan-panel-enter {
    from {
        opacity: 0;
        transform: translateY(9px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scan-indeterminate {
    from {
        transform: translateX(-110%);
    }

    to {
        transform: translateX(285%);
    }
}

/* ============================================================
   CARGADORES
   ============================================================ */

.carajillo-spinner {
    width: 34px;
    height: 34px;

    border:
        3px solid rgba(
            79,
            145,
            194,
            0.18
        );

    border-top-color:
        #4f91c2;

    border-radius:
        999px;

    animation:
        carajillo-spin
        0.78s linear infinite;
}

.carajillo-spinner.small {
    width: 22px;
    height: 22px;

    border-width: 2px;
}

.carajillo-media-loader {
    position: absolute;
    inset: 0;
    z-index: 3;

    display: grid;
    place-items: center;

    pointer-events: none;

    background:
        rgba(
            233,
            244,
            252,
            0.22
        );

    transition:
        opacity 180ms ease;
}

.carajillo-media-loader.hidden-loader {
    opacity: 0;
}

.carajillo-preview-image {
    transition:
        filter 220ms ease,
        opacity 220ms ease;
}

.carajillo-preview-image.preview-blurred {
    filter: blur(9px);
    transform: scale(1.025);
}

.carajillo-preview-image.preview-clear {
    filter: blur(0);
    transform: scale(1);
}

.file-visual {
    position: relative;
}

.preview-pending-badge {
    position: absolute;
    right: 7px;
    bottom: 7px;

    width: 26px;
    height: 26px;

    display: grid;
    place-items: center;

    background:
        rgba(
            255,
            255,
            255,
            0.86
        );

    border:
        1px solid #c5dae9;

    border-radius:
        999px;

    backdrop-filter:
        blur(8px);
}

.scan-worker-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;

    z-index: 190;

    width: min(
        420px,
        calc(100vw - 48px)
    );

    padding: 15px;

    background:
        rgba(
            255,
            255,
            255,
            0.98
        );

    border:
        1px solid #bcd3e3;

    border-radius:
        15px;

    box-shadow:
        0 20px 60px
        rgba(
            50,
            82,
            105,
            0.22
        );
}

.scan-worker-head {
    display: flex;
    align-items: center;
    gap: 11px;
}

.scan-worker-head strong {
    flex: 1;
}

.scan-worker-details {
    margin-top: 10px;

    color:
        var(--text-muted);

    font-size: 12px;
    line-height: 1.6;
}

@keyframes carajillo-spin {
    to {
        transform: rotate(360deg);
    }
}
