/* ========================================================================== */
/* REASIGNACIÓN MODAL - Modal de selección para reasignaciones               */
/* ========================================================================== */

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

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

@keyframes reasigSlideIn {
    from { transform: translateY(-30px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ========================================================================== */
/* CONTENEDOR PRINCIPAL                                                       */
/* ========================================================================== */

.reasignacion-modal {
    background: var(--bg-secondary);
    border-radius: 16px;
    max-width: 620px;
    width: 92%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35), 0 4px 16px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    animation: reasigSlideIn 0.25s ease-out;
    overflow: hidden;
}

.reasignacion-modal.wide-mode {
    max-width: 820px;
}

.reasignacion-modal.gallery-mode {
    max-width: 800px;
}

/* ========================================================================== */
/* HEADER                                                                     */
/* ========================================================================== */

.reasignacion-header {
    background: linear-gradient(135deg, #F07400, #00b4ff);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.reasignacion-header h3 {
    color: white;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.reasignacion-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 600;
}

.reasignacion-close:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
}

.reasignacion-close svg {
    width: 16px;
    height: 16px;
    stroke: white;
    stroke-width: 2.5;
}

/* ========================================================================== */
/* BODY                                                                       */
/* ========================================================================== */

.reasignacion-body {
    padding: 16px 20px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    outline: none;
}

/* ========================================================================== */
/* FILTRO INPUT (Modo Table)                                                  */
/* ========================================================================== */

.reasignacion-filter-container {
    position: relative;
    flex-shrink: 0;
}

.reasignacion-filter {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--input-bg, var(--bg-primary));
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

.reasignacion-filter:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(240, 116, 0, 0.12);
}

.reasignacion-filter::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.reasignacion-filter-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    stroke: var(--text-secondary);
    opacity: 0.5;
}

/* ========================================================================== */
/* TABLA (Modo Table)                                                         */
/* ========================================================================== */

.reasignacion-table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    min-height: 0;
    outline: none;
}

.reasignacion-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.reasignacion-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background: linear-gradient(135deg, #F07400, #00b4ff);
}

.reasignacion-table thead th {
    background: transparent;
    color: white;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 12px;
    text-align: center;
    border-bottom: none;
    white-space: nowrap;
}

.reasignacion-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid rgba(128, 128, 128, 0.1);
    user-select: none;
    -webkit-user-select: none;
}

.reasignacion-table tbody tr:hover {
    background-color: rgba(240, 116, 0, 0.06);
}

.reasignacion-table tbody tr.row-selected {
    background-color: rgba(240, 116, 0, 0.15);
    border-left: 3px solid var(--primary-color);
}

.reasignacion-table tbody tr.row-selected:hover {
    background-color: rgba(240, 116, 0, 0.2);
}

.reasignacion-table tbody td {
    padding: 8px 12px;
    color: var(--text-primary);
    max-width: 200px;
}

.reasignacion-table tbody td .td-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wide-mode .reasignacion-table tbody td {
    max-width: none;
}

.wide-mode .reasignacion-table tbody td .td-text {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.4;
}

/* ========================================================================== */
/* INPUT ONLY (Modo InputOnly)                                                */
/* ========================================================================== */

.reasignacion-input-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
}

.reasignacion-input-container label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.reasignacion-input-value {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--input-bg, var(--bg-primary));
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

.reasignacion-input-value:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(240, 116, 0, 0.12);
}

/* ========================================================================== */
/* GALERÍA DE CARDS (Modo CardGallery - Indoor Reasignar Censo)              */
/* ========================================================================== */

.reasignacion-gallery {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding: 4px;
    align-content: flex-start;
    min-height: 0;
}

.censo-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
}

.censo-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    border-color: rgba(240, 116, 0, 0.4);
}

.censo-card.card-selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(240, 116, 0, 0.2), 0 6px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-3px);
}

.censo-card-img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.censo-card-img-placeholder {
    width: 100%;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.censo-card-body {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.censo-card-id {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary-color);
}

.censo-card-tipo {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.censo-card-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================================================== */
/* PAGINACIÓN (Modo CardGallery)                                             */
/* ========================================================================== */

.reasignacion-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 0 4px;
    flex-shrink: 0;
}

.pagination-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(240, 116, 0, 0.1);
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-btn svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-primary);
    stroke-width: 2;
}

.pagination-info {
    font-size: 0.78rem;
    color: var(--text-secondary);
    min-width: 80px;
    text-align: center;
}

/* ========================================================================== */
/* FOOTER                                                                     */
/* ========================================================================== */

.reasignacion-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.reasignacion-btn {
    padding: 9px 22px;
    border-radius: 8px;
    border: none;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reasignacion-btn-cancel {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.reasignacion-btn-cancel:hover {
    background: rgba(128, 128, 128, 0.1);
}

.reasignacion-btn-confirm {
    background: linear-gradient(135deg, #F07400, #00b4ff);
    color: white;
    box-shadow: 0 2px 8px rgba(240, 116, 0, 0.3);
}

.reasignacion-btn-confirm:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(240, 116, 0, 0.5);
    transform: translateY(-1px);
}

.reasignacion-btn-confirm:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ========================================================================== */
/* MODO CLARO                                                                */
/* ========================================================================== */

:root.light-mode .reasignacion-modal {
    background: #ffffff;
    border-color: #e0e0e0;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.08);
}

:root.light-mode .reasignacion-filter {
    background: #f8f9fa;
    border-color: #d0d0d0;
}

:root.light-mode .reasignacion-table thead {
    background: linear-gradient(135deg, #F07400, #00b4ff);
}

:root.light-mode .reasignacion-table thead th {
    background: transparent;
    color: white;
}

:root.light-mode .reasignacion-table tbody tr:hover {
    background-color: rgba(240, 116, 0, 0.04);
}

:root.light-mode .reasignacion-table tbody tr.row-selected {
    background-color: rgba(240, 116, 0, 0.1);
}

:root.light-mode .reasignacion-input-value {
    background: #f8f9fa;
    border-color: #d0d0d0;
}

:root.light-mode .censo-card {
    border-color: #e0e0e0;
    background: #f8f9fa;
}

:root.light-mode .pagination-btn {
    background: #f8f9fa;
    border-color: #d0d0d0;
}

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

@media (max-width: 768px) {
    .reasignacion-modal {
        width: 96%;
        max-height: 90vh;
        border-radius: 12px;
    }

    .reasignacion-modal.gallery-mode {
        max-width: 96%;
    }

    .reasignacion-gallery {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }

    .censo-card-img {
        height: 90px;
    }
}

@media (max-width: 480px) {
    .reasignacion-header {
        padding: 12px 16px;
    }

    .reasignacion-body {
        padding: 12px 16px;
    }

    .reasignacion-footer {
        padding: 12px 16px;
        flex-direction: column;
    }

    .reasignacion-btn {
        width: 100%;
        justify-content: center;
    }

    .reasignacion-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}
