/* ========================================================================== */
/* ELIMINAR ITEMS MODAL - Modal para gestionar items a eliminar             */
/* ========================================================================== */

/* Overlay del modal */
.eliminar-items-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Contenedor del modal */
.eliminar-items-modal-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    width: 85%;
    max-width: 85%;
    height: 80vh;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Header del Modal - Override de tabulacion-filters */
.eliminar-items-modal-header {
    background: linear-gradient(135deg, #F07400, #00b4ff) !important;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0;
    min-height: 50px;
    max-height: 50px;
    border-bottom: none;
}

/* Título del Header */
.eliminar-items-modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Botón de cerrar */
.eliminar-items-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: #ffffff;
}

.eliminar-items-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

.eliminar-items-close-btn svg {
    width: 20px;
    height: 20px;
}

/* Override para camaras-container-indoor dentro del modal */
.eliminar-items-modal-container .camaras-container-indoor {
    flex: 1;
    overflow: hidden;
    padding: 0.5rem;
    gap: 0.5rem;
    background-color: var(--bg-primary);
}

/* Asegurar que los paneles ocupen todo el espacio */
.eliminar-items-modal-container .camara-panel {
    height: 100%;
    overflow: hidden;
}

/* Override para el header del panel izquierdo (solo input, sin título) */
.eliminar-items-modal-container .camara-panel:first-child .camara-header {
    margin-bottom: 0.5rem;
}

.eliminar-items-modal-container .camara-panel:first-child .camara-header .modern-input {
    width: 100%;
}

/* Asegurar que el título del panel derecho esté centrado */
.eliminar-items-modal-container .camara-panel-wide .camara-header {
    display: flex;
    align-items: center;
    justify-content: center;
}

.eliminar-items-modal-container .camara-panel-wide .camara-header h4 {
    text-align: center;
    margin: 0;
}

/* Override para camara-body cuando contiene items-body-container */
.eliminar-items-modal-container .camara-body:has(.items-body-container) {
    padding: 0.5rem;
}

/* Centrar vertical y horizontalmente el mensaje de empty-camera en el panel de imágenes */
.eliminar-items-modal-container .camara-panel-wide .empty-camera {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.eliminar-items-modal-container .camara-panel-wide .empty-camera p {
    margin: 0;
    text-align: center;
}

/* Contenedor del body de items con layout vertical */
.items-body-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* ========================================================================== */
/* LABEL DE ITEMS PERMITIDOS A ELIMINAR (BitacoraItems)                      */
/* ========================================================================== */

.items-allowed-delete-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(240, 116, 0, 0.1), rgba(0, 180, 255, 0.1));
    border: 1px solid rgba(240, 116, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.items-allowed-delete-label .label-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #F07400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.items-allowed-delete-label .label-items {
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.4;
}

/* Botones de acciones en el panel de Items */
.items-actions-buttons {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    flex-shrink: 0;
    padding: 0 1rem;
    margin-top: 0.75rem;
}

.items-actions-buttons button {
    flex: 1;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Wrapper para la lista de items que ocupa el espacio restante */
.items-list-wrapper {
    flex: 1;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-top: 0.5rem;
    padding-top: 0.5rem; /* Espacio entre botones y primer item */
}

/* Asegurar que censo-list ocupe todo el espacio del wrapper */
.items-list-wrapper .censo-list {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    padding: 0 0.5rem;
}

/* Padding horizontal para cada item */
.items-list-wrapper .censo-item {
    position: relative;
    padding-left: 0.75rem;
    padding-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

/* Texto completamente centrado */
.items-list-wrapper .censo-item .selectable-item-text {
    text-align: center;
}

/* Checkbox en posición absoluta a la izquierda */
.items-list-wrapper .censo-item .custom-checkbox-container {
    position: absolute;
    left: 20px;
}

/* ========================================================================== */
/* CUSTOM CHECKBOX - Diseño visual atractivo                                */
/* ========================================================================== */

/* Contenedor del checkbox */
.custom-checkbox-container {
    position: relative;
    display: inline-flex;
    cursor: pointer;
    user-select: none;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

/* Ocultar checkbox nativo */
.custom-checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    width: 0;
    height: 0;
}

/* Checkmark personalizado */
.custom-checkbox-container .checkmark {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 2px solid var(--border-color);
    background-color: var(--bg-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover en el checkbox */
.custom-checkbox-container:hover .checkmark {
    border-color: #F07400;
    box-shadow: 0 0 8px rgba(240, 116, 0, 0.3);
    transform: scale(1.05);
}

/* Checkbox checked - Fondo con gradiente */
.custom-checkbox-container input:checked ~ .checkmark {
    background: linear-gradient(135deg, #F07400, #00b4ff);
    border-color: transparent;
    box-shadow: 0 0 12px rgba(240, 116, 0, 0.4);
}

/* Checkmark icon (✓) */
.custom-checkbox-container .checkmark::after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

/* Mostrar el checkmark cuando está checked */
.custom-checkbox-container input:checked ~ .checkmark::after {
    display: block;
    animation: checkmarkPop 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

/* Animación del checkmark */
@keyframes checkmarkPop {
    0% {
        transform: rotate(45deg) scale(0);
        opacity: 0;
    }
    50% {
        transform: rotate(45deg) scale(1.2);
    }
    100% {
        transform: rotate(45deg) scale(1);
        opacity: 1;
    }
}

/* Efecto de pulso al hacer click */
.custom-checkbox-container input:active ~ .checkmark {
    transform: scale(0.95);
}

/* Modo claro - ajustes */
:root.light-mode .custom-checkbox-container .checkmark {
    border-color: #d0d0d0;
    background-color: #ffffff;
}

:root.light-mode .custom-checkbox-container:hover .checkmark {
    border-color: #F07400;
}

/* ========================================================================== */
/* GRID DE IMÁGENES - Visualización dinámica de items seleccionados         */
/* ========================================================================== */

/* Grid que distribuye equitativamente las imágenes */
.items-images-grid {
    display: grid;
    gap: 1rem;
    width: 100%;
    padding: 0.5rem;
    overflow-y: auto;
    height: 100%;
    /* Altura mínima de 300px por fila, permite scroll para más de 6 items */
    grid-auto-rows: minmax(300px, 1fr);
    align-content: start;
}

/* Contenedor de cada imagen con su header */
.item-image-container {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    min-height: 0;
}

.item-image-container:hover {
    box-shadow: 0 4px 12px rgba(240, 116, 0, 0.2);
    transform: translateY(-2px);
}

/* Header con información del item */
.item-image-header {
    background: linear-gradient(135deg, #F07400, #00b4ff);
    color: #ffffff;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

/* Wrapper para la imagen que ocupa el espacio restante */
.item-image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    overflow: hidden;
    min-height: 0;
    cursor: pointer;
    transition: background 0.2s ease;
}

.item-image-wrapper:hover {
    background: var(--bg-secondary);
}

/* Imagen del item */
.item-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Mensaje cuando no hay imagen disponible */
.item-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.item-no-image p {
    margin: 0;
    padding: 2rem;
    text-align: center;
}

/* ========================================================================== */
/* RESPONSIVE                                                                */
/* ========================================================================== */

@media (max-width: 1200px) {
    .eliminar-items-modal-container {
        width: 90%;
        max-width: 90%;
        height: 85vh;
        max-height: 85vh;
    }
}

@media (max-width: 768px) {
    .eliminar-items-modal-container {
        width: 95%;
        max-width: 95%;
        height: 90vh;
        max-height: 90vh;
    }

    .eliminar-items-modal-header {
        padding: 12px 16px;
        min-height: 45px;
        max-height: 45px;
    }

    .eliminar-items-modal-title {
        font-size: 14px;
    }

    /* Cambiar a layout vertical en móviles */
    .eliminar-items-modal-container .camaras-container-indoor {
        grid-template-columns: 1fr;
        grid-template-rows: 30% 1fr;
        padding: 0.4rem;
        gap: 0.4rem;
    }

    .eliminar-items-modal-container .camara-panel-wide {
        grid-column: span 1;
    }

    /* Reducir columnas en móviles para mejor visualización */
    .items-images-grid {
        gap: 0.75rem;
        padding: 0.4rem;
    }

    .item-image-header {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .eliminar-items-modal-container {
        width: 98%;
        max-width: 98%;
        height: 95vh;
        max-height: 95vh;
        border-radius: 8px;
    }

    .eliminar-items-modal-header {
        padding: 10px 14px;
        min-height: 42px;
        max-height: 42px;
        border-radius: 8px 8px 0 0;
    }

    .eliminar-items-modal-title {
        font-size: 13px;
    }

    .eliminar-items-close-btn svg {
        width: 18px;
        height: 18px;
    }

    .eliminar-items-modal-container .camaras-container-indoor {
        padding: 0.3rem;
        gap: 0.3rem;
    }

    /* Ajustes adicionales para pantallas muy pequeñas */
    .items-images-grid {
        gap: 0.5rem;
        padding: 0.3rem;
    }

    .item-image-header {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
    }
}
