/* ==================================== */
/* 1. VARIABLES & RESET PRO             */
/* ==================================== */
:root {
    --color-primary: #007bff; /* Azul corporativo */
    --color-secondary: #6c757d; /* Gris para textos secundarios */
    --color-background: #f4f6f9; /* Fondo muy claro */
    --color-card-bg: #ffffff; /* Fondo de tarjetas */
    --color-sidebar-bg: #2c3e50; /* Gris oscuro para la sidebar */
    --color-text-dark: #343a40; /* Texto principal */
    --color-active: #28a745; /* Color para estado "Activo" */
    --color-inactive: #dc3545; /* Color para estado "Inactivo/Suspendido" */

    /* Colores para las Métricas del Dashboard */
    --color-success: #28a745;  
    --color-warning: #ffc107;
    --color-info: #17a2b8;
    --color-danger: #dc3545;
    --color-accent: #6f42c1; /* Púrpura */

    --sidebar-width: 240px;
    --border-radius: 8px;
}

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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Esto evita que la página completa se desplace */
}

body {
    background-color: var(--color-background);
    color: var(--color-text-dark);
    font-family: 'Inter', sans-serif;
    font-size: 80%;
    display: flex;
    flex-direction: column; /* Alinea el header arriba y el contenedor abajo */
}

h1, h2, strong {
    font-weight: 600;
}

/* ==================================== */
/* 2. HEADER Y NAVEGACIÓN               */
/* ==================================== */
.app-header {
    display: flex;
    align-items: center;
    padding: 10px 25px;
    background-color: var(--color-card-bg);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    height: 71px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1100; /* Lo subimos un poco más para asegurar */
}

.header-logo {
    display: flex;
    align-items: center;
    margin-right: 20px;
}

.header-logo-img {
    height: 70px;
}

.header-search-container {
    flex-grow: 1;
    max-width: 600px;
    display: flex;
    align-items: center;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 0 10px;
    margin-left: auto;
    margin-right: 20px;
}

.search-icon {
    color: var(--color-secondary);
    font-size: 20px;
}

.header-search {
    border: none;
    background: transparent;
    padding: 8px 10px;
    width: 100%;
    font-size: 0.9em;
}
.header-search:focus {
    outline: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.notification-icon {
    color: var(--color-secondary);
    cursor: pointer;
    font-size: 24px;
}

.user-profile {
    width: 38px !important;  /* Coincide con el tamaño real del header */
    height: 38px !important;
    background-color: var(--color-primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--color-card-bg);
    overflow: hidden; /* Evita que la foto se salga del círculo */
    cursor: pointer;
}

/* MENÚ DESPLEGABLE DE USUARIO */
.user-menu-container {
    position: relative;
}

.user-dropdown-menu {
    position: absolute;
    top: 40px;
    right: 0;
    width: 200px;
    background-color: var(--color-card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    padding: 10px 0;
    display: none;
    transform-origin: top right;
    animation: scaleIn 0.2s ease-out;
}

.user-dropdown-menu.show {
    display: block;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.user-info {
    padding: 5px 15px 10px 15px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.user-info strong {
    font-size: 1em;
    color: var(--color-text-dark);
}

.user-info span {
    display: block;
    font-size: 0.8em;
    color: var(--color-secondary);
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--color-text-dark);
    font-size: 0.9em;
    transition: background-color 0.15s;
}

.dropdown-link:hover {
    background-color: #f8f9fa;
    color: var(--color-primary);
}

.dropdown-link .material-icons {
    font-size: 18px;
}

.dropdown-separator {
    height: 1px;
    background-color: #f1f3f5;
    margin: 5px 0;
}

/* ==================================== */
/* 3. LAYOUT PRINCIPAL                  */
/* ==================================== */

.app-container {
    display: flex;
    height: calc(100vh - 71px);
    margin-top: 71px;
    padding: 0;
    overflow: hidden;
    position: relative;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100%;
    padding-top: 20px;
    flex-shrink: 0;
    overflow-y: auto;
    background-color: var(--color-sidebar-bg);
}

.main-nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    margin: 0 10px;
    color: #adb5bd;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    font-size: 0.9em;
    border-radius: 4px;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--color-card-bg);
}

.nav-item.active {
    background-color: var(--color-primary);
    color: var(--color-card-bg);
}

.nav-item .material-icons {
    margin-right: 10px;
    font-size: 20px;
}

.nav-separator {
    height: 1px;
    background-color: #495057;
    margin: 6px 20px;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    overflow-x: auto;
    
    /* 🔢 ESTE ES EL NÚMERO CLAVE: */
    /* 71px (header) + 40px (espacio) = 111px */
    padding: 25px 35px;
    
    background-color: var(--color-background);
    box-sizing: border-box;
    scroll-padding-top: 110px; /* Ayuda al navegador a entender dónde empieza el contenido */
}

/* ==================================== */
/* 4. VISTA PRINCIPAL & DASHBOARD       */
/* ==================================== */

/* Ocultar/Mostrar Vistas */
.main-view h1 {
    margin-top: 0;
    padding-top: 0;
}

.main-view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Metrics Grid */
.dashboard-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
    margin-bottom: 30px;
}

.metric-card {
    background-color: var(--color-card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: transform 0.2s, border-left 0.2s;
    border-left: 5px solid transparent;
}

/* Se elimina el movimiento y sombra de hover en cards para mantener la simpleza visual */
.metric-card:hover {
    transform: none; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); 
}

.metric-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.metric-value {
    font-size: 2.2em;
    font-weight: 700;
    color: var(--color-text-dark);
}

.metric-title {
    font-size: 0.9em;
    color: var(--color-secondary);
    font-weight: 500;
    text-transform: uppercase;
    margin-top: 5px;
}

/* Colores de Iconos y Bordes */
.primary-color { color: var(--color-primary); }
.accent-color { color: var(--color-accent); }
.success-color { color: var(--color-success); }
.warning-color { color: var(--color-warning); }
.info-color { color: var(--color-info); }
.danger-color { color: var(--color-danger); }

/* Se elimina el cambio de color de borde en hover */
.metric-card:nth-child(1):hover { border-left-color: transparent; }
.metric-card:nth-child(2):hover { border-left-color: transparent; }
.metric-card:nth-child(3):hover { border-left-color: transparent; }
.metric-card:nth-child(4):hover { border-left-color: transparent; }
.metric-card:nth-child(5):hover { border-left-color: transparent; }
.metric-card:nth-child(6):hover { border-left-color: transparent; }


/* ==================================== */
/* 5. PERFIL DEL ACTIVO (Asset View)    */
/* ==================================== */

/* Alineación de Título y Botones */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.view-actions {
    display: flex;
    gap: 10px;
    /* 🚀 CORRECCIÓN AÑADIDA: Permite que los elementos salten de línea */
    flex-wrap: wrap; 
}

.asset-header-title {
    margin-bottom: 20px;
}

.asset-header-title h1 {
    font-size: 1.8em;
    color: var(--color-text-dark);
}

.asset-id {
    font-size: 0.9em;
    color: var(--color-secondary);
    margin-top: 5px;
}

/* Tarjeta de Estado y Acciones */
.card {
    background-color: var(--color-card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.asset-status-card {
    border-left: 5px solid var(--color-primary);
}


.asset-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-indicator .icon-large {
    font-size: 36px;
}

.status-text strong {
    display: block;
    font-size: 1.5em;
    margin-top: 3px;
}

.status-active {
    color: var(--color-active);
}

.status-inactive {
    color: var(--color-danger);
}


.status-quick-info {
    display: flex;
    gap: 30px;
    margin-left: 30px;
}

.info-item span {
    display: block;
    color: var(--color-secondary);
    font-size: 0.85em;
    margin-bottom: 2px;
}

.info-item strong {
    font-size: 1em;
}

.status-actions {
    display: flex;
    gap: 10px;
}

/* Botones (VERSION SIMPLE Y PLANA, SIN HOVER) */
.btn {
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: none !important; /* ELIMINA TODAS LAS ANIMACIONES */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    border: 1px solid transparent;
    box-shadow: none !important; /* ELIMINA TODAS LAS SOMBRAS */
    transform: none !important; /* ELIMINA CUALQUIER MOVIMIENTO */
    font-size: 14px; 
    font-family: 'Inter', sans-serif; 
    font-weight: 400;
}

/* ------------------------------------------- */
/* 5.1. BOTONES: ESTILO UNIFORME Y ESTÁTICO (GRIS CLARO / BLANCO GENIAL) */
/* ------------------------------------------- */

/* Establece el estilo base para que todos los botones de acción sean iguales */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-success {
    background-color: #f8f9fa !important; /* Fondo Gris Claro / Blanco Genial */
    border-color: #ced4da !important; /* Borde Gris Suave */
    color: var(--color-text-dark) !important; /* Texto Oscuro */
    box-shadow: none !important;
    transform: none !important;
    opacity: 1 !important;
}

/* Asegura que no cambien en hover o active */
.btn-primary:hover, .btn-primary:active,
.btn-secondary:hover, .btn-secondary:active,
.btn-danger:hover, .btn-danger:active,
.btn-success:hover, .btn-success:active {
    background-color: #f8f9fa !important; 
    border-color: #ced4da !important;
    color: var(--color-text-dark) !important;
    transform: none !important;
    box-shadow: none !important;
    opacity: 1 !important;
}

/* 5. Botón Pequeño / Ícono */
.btn-small {
    padding: 5px 10px;
    font-size: 0.85em;
    font-weight: 500;
}

.btn-icon {
    /* Mantiene el color secundario como color de ícono, sin fondo */
    padding: 6px 8px;
    background: none !important;
    border: none !important;
    color: var(--color-secondary) !important;
}
.btn-icon:hover {
    color: var(--color-secondary) !important; /* El ícono no cambia de color */
    background: none !important;
    transform: none !important;
}
/* ------------------------------------------- */
/* 5.1. BOTONES: ESTILO UNIFORME Y ESTÁTICO (FIN) */
/* ------------------------------------------- */

/* ==================================== */
/* 5.5. DROPDOWNS DE UTILIDAD (Filtros) */
/* ==================================== */
.filter-dropdown-container {
    position: relative;
    /* Ajustar la posición en la barra de acciones */
    z-index: 50; 
}

/* Estilos generalizados para el menú desplegable (Filtros) */
.dropdown-menu {
    position: absolute;
    top: 45px; /* Más espacio que el botón */
    right: 0;
    width: 280px; /* Más ancho para las opciones de filtro */
    background-color: var(--color-card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    padding: 10px 0;
    display: none;
    transform-origin: top right;
    animation: scaleIn 0.2s ease-out;
    border: 1px solid #e9ecef;
}

.dropdown-menu.show {
    display: block !important;
    opacity: 1;
    visibility: visible;
}

.dropdown-menu h4 {
    padding: 5px 15px;
    margin-bottom: 5px;
    color: var(--color-secondary);
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
}

.sort-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--color-text-dark);
    font-size: 0.9em;
    transition: background-color 0.15s;
}

.sort-option:hover {
    background-color: #f8f9fa;
    color: var(--color-primary);
}

.sort-option .material-icons {
    font-size: 18px;
    color: var(--color-secondary); /* Íconos en gris por defecto */
}

.sort-option:hover .material-icons {
    color: var(--color-primary); /* Íconos en azul al hacer hover */
}

/* Ajuste específico para el selector de estado */
.dropdown-select-filter {
    width: calc(100% - 30px); /* Deja 15px de margen a cada lado */
    margin: 5px 15px 15px 15px; /* Alinea con el padding de las opciones */
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 0.9em;
    color: var(--color-text-dark);
    cursor: pointer;
    outline: none;
    display: block; /* Asegura que tome el margen */
}

/* Mejora el foco del selector */
.dropdown-select-filter:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

/* Alineación forzada para los títulos del menú */
.dropdown-menu h4 {
    padding: 10px 15px 5px 15px !important; /* Mismo margen de 15px */
    margin: 0;
}

/* ==================================== */


/* ==================================== */
/* 6. TABLAS DE DATOS                   */
/* ==================================== */

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    white-space: nowrap;
}

/* Estilo para Checkbox y Acciones */
.data-table th:first-child, .data-table td:first-child {
    width: 30px;
    padding-left: 10px;
    padding-right: 5px;
    text-align: center;
}

.data-table td:last-child {
    display: flex;
    gap: 5px;
    border-bottom: none;
}

.data-table th {
    background-color: #f8f9fa;
    color: var(--color-text-dark);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
}

.data-table tr:hover {
    background-color: #f1f3f5;
}

.loading-row, .no-data-row, .error-row {
    text-align: center !important;
    font-style: italic;
    color: var(--color-secondary);
    padding: 20px !important;
}

.error-row {
    color: var(--color-danger);
    font-weight: 600;
}




/* ==================================== */
/* 7. SECCIÓN DE DETALLES (Pestañas)    */
/* ==================================== */

.asset-details-area {
    display: flex;
    gap: 20px;
}

/* Navegación de Pestañas Vertical */
.tabs-navigation {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding-top: 10px;
}

.tab-button {
    text-align: left;
    padding: 10px 15px;
    margin-bottom: 5px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--color-secondary);
    transition: background-color 0.2s, color 0.2s;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
}

.tab-button:hover {
    background-color: #e9ecef;
}

/* El botón activo sigue siendo azul para que el usuario sepa dónde está */
.tab-button.active {
    background-color: var(--color-primary);
    color: var(--color-card-bg);
    font-weight: 600;
}

/* Contenido de Pestañas */
.tab-content-wrapper {
    flex-grow: 1;
}

.tab-content {
    display: none;
    padding: 25px;
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    font-size: 1.4em;
    margin-bottom: 20px;
    color: var(--color-text-dark);
    padding-bottom: 5px;
    border-bottom: 1px solid #f8f9fa;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px 30px;
}

.detail-item {
    font-size: 0.95em;
    line-height: 1.5;
}

.detail-item strong {
    display: block;
    color: var(--color-secondary);
    font-weight: 500;
    font-size: 0.8em;
    margin-bottom: 3px;
    text-transform: uppercase;
}

.detail-item:not(.full-width) {
    border-bottom: 1px dashed #e9ecef;
    padding-bottom: 5px;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.chart-placeholder {
    height: 200px;
    background-color: #f8f9fa;
    border: 1px dashed #ced4da;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--color-secondary);
    border-radius: 4px;
    margin-top: 15px;
}

/* Historial */
.history-list {
    list-style: none;
    padding-left: 0;
}

.history-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f5;
    font-size: 0.9em;
}

.history-list li:last-child {
    border-bottom: none;
}

/* ==================================== */
/* 8. MODAL Y FORMULARIO (Popup)        */
/* ==================================== */

/* 8.1. Estilos del Overlay y Centrado */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    /* CLAVE PARA EL CENTRADO PERFECTO: */
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
    display: none;
}

.modal-overlay.show-modal {
    display: flex;
}

.modal-content {
    background-color: var(--color-card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    max-width: 900px;
    width: 95%;
    max-height: 95vh;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    /* 🔑 Permite el scroll si el contenido es demasiado largo */
    overflow-y: auto;
}

.modal-overlay.show-modal .modal-content {
    transform: scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h2 {
    font-size: 1.5em;
    margin: 0;
}

.close-modal-btn {
    cursor: pointer;
    font-size: 24px;
    color: var(--color-secondary);
    transition: color 0.15s;
}

.close-modal-btn:hover {
    color: var(--color-text-dark);
}

.modal-form {
    padding-top: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: var(--color-text-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--color-text-dark);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--color-primary);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-hint {
    display: block;
    font-size: 0.75em;
    color: var(--color-secondary);
    margin-top: 5px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
}

/* Estilos específicos para el File Drop Area */
.file-drop-area {
    border: 2px dashed #ced4da;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    position: relative;
}

.file-drop-area:hover {
    border-color: var(--color-primary);
    background-color: #f8f9fa;
}

.file-drop-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 36px;
    color: var(--color-secondary);
    margin-bottom: 10px;
}


/* ==================================== */
/* 8.2. CHECKBOX / TOGGLE (CORREGIDO PARA USAR NATIVO) */
/* ==================================== */
.checkbox-container {
  display: flex; /* Usar flexbox para alinear checkbox y texto */
  align-items: center;
  position: relative;
  padding: 5px 15px; /* Agregar padding para que se pueda hacer click fácilmente */
  cursor: pointer;
  font-size: 0.9em;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  color: var(--color-text-dark);
  text-align: left;
  line-height: 1.2;
}

/* 🛑 Hacemos el input visible y alineado 🛑 */
.checkbox-container input[type="checkbox"] {
  position: static; /* Volver a la posición normal */
  opacity: 1; /* Volver a ser visible */
  height: auto;
  width: auto;
  margin-right: 8px; /* Espacio entre el checkbox y el texto */
}

/* Eliminamos todas las reglas del 'checkmark' que causaban el problema
   porque el JS no lo genera. */
.checkmark,
.checkbox-container input {
  /* Reglas antiguas eliminadas o neutralizadas */
  border: none !important;
  background: none !important;
}

/* Permitir hover en el ítem del menú */
.checkbox-container:hover {
    background-color: #f8f9fa;
}


/* ==================================== */
/* 9. WIZARD/MODAL MULTI-PASO (SIM CARD)*/
/* ==================================== */

.modal-content[style*="max-width: 650px;"] { 
    max-width: 650px;
}

/* 🛑 CAMBIO CLAVE AQUÍ: FORZAR EL DISEÑO HORIZONTAL CON FLEX */
.modal-wizard-steps {
    display: flex;
    justify-content: space-between; /* Distribuye los pasos uniformemente */
    margin: 20px 0;
    padding: 0 10px;
    border-bottom: 1px solid #ddd;
}
/* 🛑 FIN DEL CAMBIO CLAVE */

.wizard-step-item {
    flex-grow: 1;
    text-align: center;
    padding: 10px 15px;
    cursor: default;
    font-weight: 500;
    color: var(--color-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-size: 0.9em;
    /* Adicional: forzar ancho para evitar que se apilen si no hay espacio suficiente en el padre */
    flex-basis: 25%; /* Cada paso ocupa un cuarto del espacio */
}

.wizard-step-item.active {
    color: var(--color-primary);
    border-bottom: 3px solid var(--color-primary);
    font-weight: 600;
}

.modal-step {
    display: none;
    padding: 10px 0;
}

.modal-step.active {
    display: block;
}

.modal-step h3 {
    margin-bottom: 15px;
    color: var(--color-text-dark);
    font-size: 1.2em;
    border-bottom: 1px dotted #eee;
    padding-bottom: 5px;
}

.step-navigation {
    display: flex;
    justify-content: flex-end; 
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Ajuste para el botón anterior */
#prevStepBtn {
    margin-right: auto; 
}

/* Estilo para campos inválidos (Validación del Wizard) */
.form-group input.is-invalid,
.form-group select.is-invalid,
.form-group textarea.is-invalid {
    border-color: var(--color-danger) !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.rotating-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
/* ==================================== */
/* 10. PÁGINA DE LOGIN (SOBREESCRITURA) */
/* ==================================== */

/* Contenedor principal con imagen de fondo */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column; 
    justify-content: center; 
    align-items: center;
    
    /* Configuración del Fondo de Imagen (Asegúrese de que la ruta sea correcta) */
    background: url('../img/login-bg.jpg') no-repeat center center fixed;
    background-size: cover;
    position: relative;
    z-index: 1; 
}

/* Overlay para oscurecer la imagen y mejorar legibilidad */
.login-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.45); 
    z-index: 2;
}

/* Contenedor central que centra la caja de login (solo horizontalmente) */
.login-container {
    position: relative; 
    z-index: 3;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* ------------------------------------------- */
/* 2.1. La caja blanca del formulario (.login-box) */
/* ------------------------------------------- */
.login-box {
    /* CAMBIO CLAVE: Usar rgba para transparencia */
    background-color: rgba(255, 255, 255, 0.7); 
    
    padding: 30px 40px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 340px; 
    text-align: center;
    border-radius: var(--border-radius);
    margin-bottom: 0;
    position: relative;
    z-index: 3;
}

.login-header {
    margin-bottom: 25px;
    text-align: center;
}

.login-brand-logo {
    max-width: 240px;
    height: auto;
    display: block;
    margin: 0 auto 15px auto; /* 15px de separación abajo del logo */
}

.login-title {
    margin-top: 5px; /* Pequeño ajuste para que no pegue al logo */
    font-size: 1.2rem;
    color: #1e293b;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.login-title {
    font-size: 1.2em;
    color: var(--color-text-dark);
    margin-top: 10px;
    font-weight: 500;
}

/* Iconos dentro de los campos de input */
.input-with-icon {
    display: flex;
    align-items: center;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: border-color 0.15s, box-shadow 0.15s;
    background-color: var(--color-card-bg);
    margin-bottom: 15px; /* Espacio entre grupos de input */
}

.input-with-icon:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.input-with-icon .material-icons {
    color: var(--color-secondary);
    padding: 0 10px;
    font-size: 20px;
    flex-shrink: 0;
}

.input-with-icon input {
    border: none;
    flex-grow: 1;
    padding: 10px;
    padding-left: 0; 
    height: 40px;
}

.form-group label {
    display: block;
    text-align: left;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9em;
}

.form-options {
    text-align: left;
    margin: 5px 0 25px 0;
}

.login-btn {
    width: 100%;
    justify-content: center;
    padding: 10px 15px;
    font-size: 1.1em;
}

/* ------------------------------------------- */
/* 2.2. La caja de notas (.login-notes) */
/* ------------------------------------------- */
.login-notes {
    position: relative;
    z-index: 3;
    /* Reducir el margen superior para la separación sutil */
    margin-top: 30px; 
    
    /* Asegurar que las notas usen la misma medida que el login-box y estén centradas */
    max-width: 480px; 
    width: 90%; 
    
    /* Reajustar el fondo y la sombra para que parezca una caja separada */
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: var(--border-radius);
    padding: 15px 40px; 
    text-align: left;
    font-size: 0.8em;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15); 
}
/* ------------------------------------------- */
/* 2.3. Footer */
/* ------------------------------------------- */
.login-page-footer {
    position: absolute; 
    bottom: 0;
    width: 100%;
    text-align: center;
    padding: 10px 0;
    color: white; 
    z-index: 3;
    font-size: 0.75em;
    font-weight: 300;
}

/* =============================================== */
/* ESTILOS NECESARIOS PARA EL SNACKBAR */
/* =============================================== */

.snackbar {
    position: fixed;
    z-index: 10001; 
    bottom: 30px; 
    left: 50%;
    transform: translateX(-50%);
    visibility: hidden; 
    opacity: 0;
    pointer-events: none; /* Bloquea que el snackbar interfiera con los menús */
    transition: opacity 0.5s, visibility 0.5s;
    /* ... resto de tu estilo ... */
}

/* IMPORTANTE: Solo cuando se muestra debe permitir clics */
.snackbar.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto; 
}

.snackbar.success { background-color: #2e7d32; }
.snackbar.error { background-color: #d32f2f; }

/* ==================================== */
/* 11. Media Queries (Responsive)       */
/* ==================================== */

/* =============================================== */
/* AJUSTES PARA COMPACTAR BOTONES DE ACCIÓN SUPERIORES (Añadido) */
/* =============================================== */
.view-actions .btn-action-compact {
    padding: 7px 10px; /* Reducir el padding (margen interior) */
    font-size: 0.85em; /* Reducir el tamaño de la fuente ligeramente */
    height: 36px; /* Establecer una altura fija para uniformidad */
    display: flex;
    align-items: center;
}

/* Reducir el tamaño de los íconos dentro de estos botones */
.view-actions .btn-action-compact .material-icons {
    font-size: 18px; /* Tamaño más pequeño para los íconos */
    margin-right: 5px; /* Reducir el espacio entre ícono y texto */
}

/* Reglas de ocultar/mostrar columnas por clase */
/* Aunque la visibilidad se maneja por JS con style.display, estas clases actúan como fallback o guía */
.data-table th[style*="display: none"], 
.data-table td[style*="display: none"] {
    display: none !important;
}

/* ==================================== */
/* 12. BOTONES DE ACCIÓN EN TABLA       */
/* ==================================== */

/* Ajuste para la celda de la tabla */
.data-table td.col-acciones {
    display: table-cell !important; /* Volvemos al comportamiento de tabla */
    vertical-align: middle;
    text-align: center;
    width: 120px;
    padding: 8px 10px;
}

/* Contenedor interno para alinear los botones sin deformar la celda */
.actions-wrapper {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
}

/* Botones más integrados */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.action-btn .material-icons {
    font-size: 16px; /* Iconos un poco más pequeños para que no se vea tosco */
}

/* Colores sutiles para no saturar */
.view-sim-btn { color: var(--color-primary); }
.edit-sim-btn { color: #f59e0b; }
.delete-sim-btn { color: var(--color-danger); }

.action-btn:hover {
    background-color: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* ==================================== */
/* 13. VISTA DE DETALLE PREMIUM         */
/* ==================================== */

.detail-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    background: #fff;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.detail-operator-logo { max-height: 45px; }

.antiguedad-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-secondary);
    font-size: 0.95em;
}

.detail-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.info-card-modern {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #edf2f7;
}

.info-card-modern h5 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-primary);
    text-transform: uppercase;
    font-size: 0.8em;
    margin-bottom: 20px;
    border-bottom: 1px solid #f7fafc;
    padding-bottom: 10px;
}

.info-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.info-field label {
    display: block;
    font-size: 0.75em;
    color: var(--color-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.info-field span {
    font-size: 1em;
    color: var(--color-text-dark);
    font-weight: 600;
}

.val-highlight { color: var(--color-primary); font-size: 1.2em !important; }
.val-price { color: var(--color-success); font-size: 1.2em !important; }
.val-mono { font-family: 'monospace'; letter-spacing: -0.5px; }

.badge-status-alt {
    background: #ebf4ff;
    color: #3182ce;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.85em !important;
}


/* --- Estilos para el Historial Moderno --- */
.timeline {
    position: relative;
    padding: 20px 0;
    list-style: none;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 40px;
    width: 2px;
    background: #e9ecef;
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    padding-left: 70px;
}

.timeline-marker {
    position: absolute;
    left: 31px;
    top: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 4px solid #fff;
    box-shadow: 0 0 0 2px var(--color-primary);
}

.timeline-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.85em;
}

.timeline-user { font-weight: 700; color: var(--color-text-dark); }
.timeline-date { color: var(--color-secondary); }

.change-badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.change-item {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.field-name { font-weight: 700; color: var(--color-primary); text-transform: uppercase; font-size: 0.75em; margin-right: 5px;}
.old-val { text-decoration: line-through; color: var(--color-danger); opacity: 0.7; }
.new-val { color: var(--color-success); font-weight: 600; }
.arrow-change { color: var(--color-secondary); }


/* Estilos para badges de estado en tabla usuarios */
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.status-activo {
    background-color: #e6fffa;
    color: #28a745;
}

.status-badge.status-rechazado {
    background-color: #fff5f5;
    color: #dc3545;
}

/* Reutilización del estilo de acciones de la tabla */
#usersTable .col-acciones {
    text-align: right;
    width: 100px;
}

#usersTable .action-btn {
    margin-left: 5px;
}

/* Estilos extra para la Paginación Genial */
.pagination-wrapper {
    margin-top: -1px; /* Para que se una perfectamente con la tabla */
    border: 1px solid #e2e8f0;
    border-top: none;
}

/*s Estilo para botones deshabilitados del sistema */
.btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important; /* El cursor indica que no se puede */
    background-color: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
    color: #94a3b8 !important;
    /* ELIMINA pointer-events: none; para que no bloquee la interacción de la capa */
}

/* Efecto sutil al pasar el mouse por el indicador de página */
.page-indicator:hover {
    border-color: var(--color-primary) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Ajuste para que el selector de filas combine con el resto */
#rowsPerPageSelect {
    font-family: 'Inter', sans-serif;
    font-size: 0.85em;
    outline: none;
    transition: border-color 0.2s;
}

#rowsPerPageSelect:focus {
    border-color: var(--color-primary);
}

.nav-group-settings {
    display: block !important;
    margin-top: 10px;
}

.nav-sub-item {
    padding-left: 40px !important; /* Indentado para que se vea como submenú */
    font-size: 0.85em !important;
    opacity: 0.8;
}

#users-view.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background-color: var(--color-background); /* Asegura que no sea transparente */
    min-height: 100vh;
}

/* Ajuste para roles de usuario */
.badge-role {
    background: #ebf4ff;
    color: #3182ce;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9em;
}

#users-view {
    width: 100%;
    min-height: 400px; /* Asegura un espacio mínimo */
    position: relative;
    z-index: 10;
}

#usersTable {
    width: 100% !important;
    border-collapse: collapse;
}

/* Unifica el comportamiento de todas las tablas de datos */
.data-table {
    width: 100% !important; /* Mismo ancho que la tabla SIM */
    table-layout: fixed !important; /* Fuerza a respetar los anchos de columna */
}

.data-table th, .data-table td {
    padding: 12px 15px !important; /* Padding idéntico al de SIM Cards */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Ajusta los anchos de las nuevas clases para que coincidan visualmente */
.col-nombre { width: 180px; }
.col-marca { width: 100px; }
.col-codigo { width: 120px; }
.col-modelo { width: 150px; }
.col-n-serie { width: 150px; }
.col-imei-1, .col-imei-2 { width: 160px; }

/* Estilo global para permitir redimensionamiento */
.data-table th {
    position: relative; /* Necesario para ubicar el "tirador" */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* El "tirador" invisible en el borde derecho de cada celda */
.resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    cursor: col-resize;
    user-select: none;
    height: 100%;
    z-index: 1;
}

.resizer:hover, .resizing {
    border-right: 2px solid var(--color-primary); /* Resalte azul al arrastrar */
}


.modal-large { width: 80% !important; max-width: 1000px; }
.form-section { margin-bottom: 25px; border-bottom: 1px solid #eee; padding-bottom: 15px; }
.form-section h3 { font-size: 1.1rem; color: #2c3e50; display: flex; align-items: center; gap: 8px; margin-bottom: 15px; }
.form-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); 
    gap: 15px; 
}
.input-readonly { background-color: #f8f9fa; cursor: not-allowed; border: 1px solid #ddd; color: #666; }

.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

/* INLINE EDIT · Telefonía Celular */

.phone-inline-cell {
    cursor: cell;
    position: relative;
    transition: background 0.15s;
}
.phone-inline-cell:hover {
    background-color: #f8faff !important;
    box-shadow: inset 0 0 0 1px #dbe4f3;
}
.phone-inline-cell input,
.phone-inline-cell select {
    box-sizing: border-box;
    width: 100%;
    padding: 4px 7px;
    font-size: inherit;
    font-family: inherit;
    color: #1e293b;
    background: #ffffff;
    border: none;
    outline: 1.5px solid #b0c4e8;
    outline-offset: -1px;
    border-radius: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: outline-color 0.15s;
}
.phone-inline-cell input:focus,
.phone-inline-cell select:focus {
    outline-color: #6a9fd8;
    box-shadow: 0 2px 8px rgba(100,150,220,0.15);
}
.phone-inline-cell.saving { background: #fefce8 !important; }
.phone-inline-cell.saved  { background: #f0fdf4 !important; transition: background 1.4s; }
.phone-inline-cell.error  { background: #fff1f0 !important; }

.sim-inline-cell {
    cursor: cell;
    position: relative;
    transition: background 0.15s;
}
.sim-inline-cell:hover {
    background-color: #f8faff !important;
    box-shadow: inset 0 0 0 1px #dbe4f3;
}
.sim-inline-cell input,
.sim-inline-cell select {
    box-sizing: border-box;
    width: 100%;
    padding: 4px 7px;
    font-size: inherit;
    font-family: inherit;
    color: #1e293b;
    background: #ffffff;
    border: none;
    outline: 1.5px solid #b0c4e8;
    outline-offset: -1px;
    border-radius: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: outline-color 0.15s;
}
.sim-inline-cell input:focus,
.sim-inline-cell select:focus {
    outline-color: #6a9fd8;
    box-shadow: 0 2px 8px rgba(100,150,220,0.15);
}
.sim-inline-cell.saving { background: #fefce8 !important; }
.sim-inline-cell.saved  { background: #f0fdf4 !important; transition: background 1.4s; }
.sim-inline-cell.error  { background: #fff1f0 !important; }

/* Tooltip de confirmación */
.inline-confirm-tooltip {
    position: fixed;
    z-index: 9999;
    background: #1e293b;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-family: inherit;
    color: #f1f5f9;
    animation: fadeInTooltip 0.15s ease;
    pointer-events: all;
}
@keyframes fadeInTooltip {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.inline-confirm-tooltip .label { color: #94a3b8; margin-right: 2px; }
.inline-confirm-tooltip .val-preview {
    color: #7dd3fc;
    font-weight: 600;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.inline-confirm-tooltip button {
    border: none;
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.inline-confirm-tooltip button:hover { opacity: 0.85; }
.inline-confirm-tooltip .btn-confirm { background: #22c55e; color: #fff; }
.inline-confirm-tooltip .btn-cancel  { background: #334155; color: #cbd5e1; }

/* N° Solicitud en negrita en Dispositivos Móviles */
#phonesTable .col-phone-solicitud {
    font-weight: 700;
}

/* Igualar altura de filas SIM Cards y Dispositivos Móviles con Asignaciones */
#simCardsTable tbody tr td,
#phonesTable tbody tr td,
#m2mTable tbody tr td,
#bamTable tbody tr td {
    padding: 0 15px !important;
    height: 41px;
    vertical-align: middle;
}
#simCardsTable tbody tr td:first-child,
#phonesTable tbody tr td:first-child,
#m2mTable tbody tr td:first-child,
#bamTable tbody tr td:first-child {
    padding-left: 10px !important;
    padding-right: 5px !important;
}
#simCardsTable .status-badge,
#phonesTable .status-badge,
#m2mTable .status-badge,
#bamTable .status-badge,
#simCardsTable .badge,
#phonesTable .badge,
#m2mTable .badge,
#bamTable .badge {
    padding: 0;
    display: inline;
    font-size: inherit;
    font-weight: inherit;
    border-radius: 0;
    background: none;
    text-transform: none;
}
/* ── Spam Blocker: celdas editables inline ── */
.spam-inline-cell {
    cursor: cell;
    position: relative;
    transition: background 0.15s;
}
.spam-inline-cell:hover {
    background-color: #f8faff !important;
    box-shadow: inset 0 0 0 1px #dbe4f3;
}
.spam-inline-cell input,
.spam-inline-cell select {
    box-sizing: border-box;
    width: 100%;
    padding: 4px 7px;
    font-size: inherit;
    font-family: inherit;
    color: #1e293b;
    background: #ffffff;
    border: none;
    outline: 1.5px solid #b0c4e8;
    outline-offset: -1px;
    border-radius: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: outline-color 0.15s;
}
.spam-inline-cell input:focus,
.spam-inline-cell select:focus {
    outline-color: #6a9fd8;
    box-shadow: 0 2px 8px rgba(100,150,220,0.15);
}
.spam-inline-cell.saving { background: #fefce8 !important; }
.spam-inline-cell.saved  { background: #f0fdf4 !important; transition: background 1.4s; }
.spam-inline-cell.error  { background: #fff1f0 !important; }

/* ── Spam Blocker: fila seleccionada con marco azul ── */
#spamNumerosTable tbody tr:has(.spam-num-check:checked),
#spamCarriersTable tbody tr:has(.spam-num-check:checked),
#spamReglasTable tbody tr:has(.spam-num-check:checked) {
    background-color: #ebf4ff !important;
    outline: 2px solid #93c5fd;
    outline-offset: -2px;
}

/* ── Spam Blocker: padding celdas igual a SIM Cards ── */
#spamNumerosTable tbody tr td,
#spamCarriersTable tbody tr td,
#spamReglasTable tbody tr td {
    padding: 0 15px !important;
    height: 41px;
    vertical-align: middle;
}
#spamNumerosTable tbody tr td:first-child,
#spamCarriersTable tbody tr td:first-child,
#spamReglasTable tbody tr td:first-child {
    padding-left: 10px !important;
    padding-right: 5px !important;
}
