/*
 * styles.css - Hoja de estilos principal para Atedes Enforcement Platform
 *
 * Convenciones principales:
 * - Clases compartidas: .navbar, .form-group, .list-container, .pagination, .footer, .error-messages, .loading-message
 * - Clases de botones: .saveButton, .rejectButton, .button-group, .dropbtn
 * - Estilos de formularios/inputs: .styled-select, input, select, button
 * - Clases dinámicas desde JS: .edit, .delete, .navbar-item, .image-container, .new-tab-btn
 * - Los IDs se usan para elementos únicos (ej: #errorMessages, #menu-container)
 *
 * Mantén esta sección actualizada con cualquier nueva convención relevante de clases o IDs.
 * Última actualización: 2025-04-27
 */

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f9;
    color: #333;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    height: 100vh;
    flex-direction: column; /* Asegura que los elementos se alineen en una columna */
    overflow: auto;
    /* Elimina fondo para que el vídeo sea visible */
    background: transparent !important;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2 {
    color: #444;
}

/* Navbar styles */
.navbar {
    width: 1150px;
    /*width: 100%;*/
    background-color: #333;
    overflow: visible;
    display: flex;
    justify-content: space-between; /* Logo a la izquierda, menú en el centro, usuario a la derecha */
    align-items: center;
    padding: 10px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 3;
    flex-wrap: nowrap; /* Evitar que los elementos se envuelvan */
}

.navbar-logo img {
    max-height: 35px;
}

/* Información del usuario en la navbar */
.navbar-user-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    color: white;
    font-size: 12px;
    padding: 6px 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-left: 10px;
    min-width: 100px;
    flex-shrink: 0;
    height: fit-content;
    align-self: center;
    gap: 10px;
}

.navbar-user-info .user-text-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex: 1;
}

.navbar-user-info .user-name {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 1px;
    text-align: right;
    color: #fff;
    white-space: nowrap;
}

.navbar-user-info .user-login-time {
    color: #ccc;
    font-size: 10px;
    text-align: right;
    line-height: 1.2;
    margin-bottom: 0;
    white-space: nowrap;
}

.navbar-user-info .user-logout-icon {
    color: #fff;
    opacity: 0.8;
    transition: opacity 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.navbar-user-info .user-logout-icon:hover {
    opacity: 1;
    color: #ffcb05;
}

/* Breadcrumbs styles */
.breadcrumbs {
    width: 1150px;
    background-color: #f8f9fa;
    padding: 8px 20px;
    font-size: 12px;
    color: #6c757d;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 0;
}

.breadcrumb-item {
    display: inline;
    color: #6c757d;
}

.breadcrumb-item.active {
    color: #495057;
    font-weight: 500;
}

.breadcrumb-separator {
    color: #6c757d;
    margin: 0 6px;
}

.navbar-logos-right {
    display: flex;
    gap: 15px; /* Espaciado entre los logos */
    align-items: center; /* Alinear verticalmente con el resto de la navbar */
}

.right-logo {
    max-height: 35px; /* Asegura un tamaño consistente con el logo izquierdo */
}

.navbar-menu {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    height: 44px;
    align-items: center;
}

.navbar-item {
    padding: 14px 12px;
}

.navbar-item a {
    color: white;
    text-decoration: none;
    display: block;
}

.navbar-item a:hover {
    background-color: #ddd;
    color: black;
}

/* Dropdown para menú de infracciones */
.navbar-menu .dropdown {
    position: relative;
    z-index: 50;
    /* Añade un fondo invisible para ampliar el área activa */
}

.navbar-menu .dropdown .dropbtn {
    position: relative;
    z-index: 101;
}

.navbar-menu .dropdown-content {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    background-color: #222c3a;
    min-width: 170px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    z-index: 100;
    border-radius: 0 0 6px 6px;
    overflow: visible;
    margin-top: 0;
    padding: 6px 0;
    /* Aumenta el área vertical para evitar saltos de cursor */
    pointer-events: auto;
}

.navbar-menu .dropdown-content a {
    padding: 18px 26px;
    margin: 6px 0;
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: 0.01em;
    border-radius: 3px;
    background-color: #222c3a;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.navbar-menu .dropdown-content a:last-child {
    border-bottom: none;
}

.navbar-menu .dropdown-content a:hover {
    background-color: #1a2230;
    color: #ffcb05;
    box-shadow: 0 2px 8px rgba(0,0,0,0.09);
}

.navbar-menu .dropdown:hover .dropdown-content,
.navbar-menu .dropdown:focus-within .dropdown-content {
    display: block;
}

.navbar-menu .dropdown:hover > .dropbtn,
.navbar-menu .dropdown:focus-within > .dropbtn {
    background-color: #1a2230;
    color: #ffcb05;
}

/* Opcional: área "buffer" invisible para mejorar aún más la usabilidad */
.navbar-menu .dropdown::after {
    content: '';
    display: block;
    position: absolute;
    left: 0;
    top: 100%;
    width: 100%;
    height: 18px;
    z-index: 99;
    background: transparent;
    pointer-events: auto;
}

/* Unifica altura y estilo de todos los ítems del menú superior */
.navbar-menu .navbar-item, .navbar-menu .dropbtn {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 12px;
    color: #fff;
    background: none;
    border: none;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    box-sizing: border-box;
}

.navbar-menu .navbar-item a, .navbar-menu .dropbtn {
    text-decoration: none;
    color: #fff;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: none;
    border: none;
}

.navbar-menu .navbar-item a:hover, .navbar-menu .dropbtn:hover, .navbar-menu .dropdown:hover > .dropbtn {
    background-color: #1a2230;
    color: #ffcb05;
}

@media (max-width: 600px) {
    .navbar-menu .dropdown-content {
        min-width: 120px;
        font-size: 0.95em;
    }
}

/* Container para login */
.login-container {
    background: rgba(255,255,255,0.83);
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-default);
    max-width: 1150px;
    height: 100vh;
    width: 100%;
    text-align: center;
    margin-top: 10px;
    position: relative;
    z-index: 2;

    display: flex;
    flex-direction: column; /* Hace que los elementos sean verticales */
    justify-content: center; 
}

/* Styles for the form inputs */
form input[type="text"],
form input[type="number"],
form input[type="email"],
form input[type="tel"],
form input[type="password"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Styles for the form button */
form button {
    background-color: #27AAE1;
    color: white;
    border: none;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    transition: background-color 0.3s ease;
}

form {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-default);
    max-width: 400px;
    width: 100%;
    margin-bottom: 20px;
    margin: 0 auto;
    display: inline-block;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

input[type="file"] {
    border: 1px solid #ddd;
    padding: 10px;
    width: calc(100% - 22px);
    margin-bottom: 10px;
    border-radius: 4px;
}

button {
    background-color: #27AAE1;
    color: white;
    border: none;
    padding: 5px 8px;
    margin: 3px 2px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
button:disabled {
    background-color: #999999;
    cursor: not-allowed;
}
button:disabled:hover {
    background-color: #999999;
}
button:hover {
    background-color: #33AFE3;
}

#fileContent {
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 1150px; /* Aumentar el ancho máximo para acomodar dos columnas */
    width: 100%;
    margin-top: 20px; /* Añade un margen superior para separación */
    display: block;
    z-index: 1;
}


#textSection {
    width: 32%; 
    display: inline-block; /* Muestra el elemento en línea como bloque */
    vertical-align: top; /* Alinea verticalmente en la parte superior */
    margin-right: 2%; /* Espacio entre las dos columnas */
}

#infractionTable td:first-child {
    text-align: left;
    padding-left: 1em; /* Opcional: añade un espacio con tabulador simulado */
}

#editSection {
    text-align: center;
}

#editSection label {
    font-weight: bold;
    font-size: 14px;
    color: #444;
    display: block; /* Para que quede encima del input */
    margin-bottom: 5px;
}

#editLicensePlate {
    width: 150px; /* Suficiente para 10 caracteres */
    padding: 8px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s ease-in-out;
}

/* Efecto cuando el input está en foco */
#editLicensePlate:focus {
    border-color: #27AAE1;
    box-shadow: 0 2px 6px rgba(39, 170, 225, 0.5);
    outline: none;
}


#imageEditModal {
    overflow: auto;
    align-items: center;    
    justify-content: center;
}

/* Contenedor de imagen para edición */
.image-container {
    display: inline-block;
    position: relative;
    margin: 0px;
}

/* Botón de editar oculto por defecto */
.image-container .new-tab-btn {
    display: none;
    position: absolute;
    top: 5px;
    right: 15px;
    z-index: 10;
    /* Puedes mantener o ajustar otros estilos (por ejemplo, tamaño o color) aquí */
}

/* Mostrar el botón al pasar el ratón sobre el contenedor */
.image-container:hover .new-tab-btn {
    display: inline-flex;
}



#imageSection {
    width: 65%;
    display: inline-block; /* Muestra el elemento en línea como bloque */
    vertical-align: top; /* Alinea verticalmente en la parte superior */
}

#imageContent {
    display: block;
}

#videoContent {
    width: 100%;
}

#imageContent img {
    max-width: 350px;
    margin: 5px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

button.acceptButton {
    background-color: #27AAE1;
    margin-right: 10px;
    padding: 16px 15px;
}
button.acceptButton:hover {
    background-color: #33AFE3;
}

button.rejectButton  {
    background-color: #D7000F;
    margin-right: 10px;
    padding: 16px 15px;
}
button.rejectButton:hover  {
    background-color: #ac2925;
}

.button-group {
    display: flex;
    justify-content: space-between; /* Espacia los botones uno a la izquierda y otro a la derecha */
    margin-top: 20px; /* Espaciado con el resto del formulario */
}

button.saveButton {
    background-color: #27AAE1; /* Azul claro */
}
button.saveButton:hover {
    background-color: #33AFE3; /* Azul más oscuro */
}

button.cancelButton {
    background-color: #D7000F; /* Rojo */
}
button.cancelButton:hover {
    background-color: #c82333; /* Rojo más oscuro */
}

/* botón nueva pestaña */
.new-tab-btn {
    background-color: #000;
    border: none;
    padding: 2px;
    margin-left: 1px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /*width: 40px;*/
}
.new-tab-btn img {
    filter: invert(1); /* Hace que el icono sea visible en botones oscuros */
    width: 16px;
    height: 16px;
}


/* Modal (background) */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Mayor que el z-index del navbar (3) para que aparezca por encima */
    padding-top: 60px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0, 0, 0); /* Fallback color */
    background-color: rgba(0, 0, 0, 0.9); /* Black w/ opacity */
}

/* Modal Content (image) */
.modal-content {
    /*transition: transform 0.2s ease; /* Animación suave al hacer zoom */
    /*transform-origin: center; /* Centrar el zoom en el medio de la imagen */
    /*max-height: 90%;
    width: auto;
    height: auto;*/
    /*margin: auto;
    display: block;*/
    display: block;
    margin: auto; /* Centrar horizontalmente */
    max-width: 90vw; /* Máximo ancho: 90% del viewport */
    max-height: 80vh; /* Máximo alto: 90% del viewport */
    width: auto; /* Mantiene el tamaño original si es más pequeño */
    height: auto; /* Mantiene la proporción */
}

/* Caption of Modal Image */
#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    height: auto;
}

/* Add Animation - Zoom in the Modal */
.modal-content, #caption {
    animation-name: zoom;
    animation-duration: 0.6s;
}

@keyframes zoom {
    from {transform: scale(0)}
    to {transform: scale(1)}
}

/* The Close Button */
.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Estilos para los metadatos */
.metadata-line {
    margin-bottom: 5px;
    padding: 2px;
    border-bottom: 1px solid #ddd;
}

.metadata-label {
    font-weight: bold;
    font-size: 12px;
    color: #555;
    display: inline-block;
    width: 120px;
}

.metadata-value {
    font-size: 12px;
    color: #333;
}


/* Container para listados */
.list-container {
    display: block !important;
    width: 100%;
    max-width: 1150px;
    margin: 0 auto;
    padding: 0 10px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    margin-top: 10px;
    flex: 1 0 auto;
}

.list-container h1 {    
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    font-size: 1.4rem;
    color: #444;
    text-align: center;
    margin-top: 2px;
    margin-bottom: 10px;
    padding-bottom: 4px;
    letter-spacing: 0.5px;
    position: relative;
    background: #fff;
}

.list-container h1::after {
    content: "";
    display: block;
    width: 700px;
    height: 3px;
    margin: 10px auto 0 auto;
    background: linear-gradient(90deg, #00b4d8 0%, #90e0ef 100%);
    border-radius: 2px;
    opacity: 0.5;
}

#tarFileList {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#tarFileList li {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
}

#tarFileList li:hover {
    background-color: #f0f0f0;
}

#acceptedList {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#acceptedList li {
    padding: 10px;
    border-bottom: 1px solid #009E49;
    cursor: pointer;
}

#acceptedList li:hover {
    background-color: #f0f0f0;
}

#rejectedList {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#rejectedList li {
    padding: 10px;
    border-bottom: 1px solid #D7000F;
    cursor: pointer;
}

#rejectedList li:hover {
    background-color: #f0f0f0;
}



table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
    text-align: center;
}

table thead tr {
    background-color: #505050;
    color: #ffffff;
    text-align: center;
    font-weight: bold;
}

table th {
    padding: 8px 7px;
}

table td {
    padding: 2px 7px;
    margin: 0px;
}

.filename {
    text-align: center;
}

table tbody tr {
    border-bottom: 1px solid #dddddd;
}

table tbody tr:nth-of-type(even) {
    background-color: #f3f3f3;
}

table tbody tr:last-of-type {
    border-bottom: 2px solid #505050;
}

table tbody tr td:last-child {
    display: flex;
    justify-content: space-around;
}

/* Estilos para columnas ordenables */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    white-space: nowrap;
}

.sortable:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sort-icon {
    width: 12px;
    height: 12px;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
    margin-left: 5px;
    vertical-align: middle;
}

.sortable:hover .sort-icon {
    opacity: 1;
}

.sortable.sort-asc .sort-icon {
    transform: rotate(0deg);
    opacity: 1;
}

.sortable.sort-desc .sort-icon {
    transform: rotate(180deg);
    opacity: 1;
}

button.edit {
    background-color: #27AAE1;
}

button.delete {
    background-color: #D7000F;
}

button.edit:hover {
    background-color: #33AFE3;
}

button.delete:hover {
    background-color: #c82333;
}


/* Icon buttons */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px; 
}

.btn-icon img {
    width: 16px;
    height: 16px;
    filter: invert(1);
}

/* Estado activo para botones de icono (ej: sonido activado) */
.btn-icon.active {
    background-color: #009E49;
}
.btn-icon.active:hover {
    background-color: #00b359;
}

/* formularios */
form .form-group {
    margin-bottom: 5px;
}

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

form .form-group input,
form .form-group select {
    width: 100%;
    box-sizing: border-box;
}

form select {
    margin-bottom: 15px;
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Combo estilo plataforma para vehicleList.html */
.styled-select,
.styled-select option {
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    color: #333;
    margin-bottom: 10px;
    width: 220px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.styled-select:focus {
    border-color: #27AAE1;
    outline: none;
}
.styled-select option {
    background: #fff;
    color: #333;
}

/* mensaje de carga de registros */
.loading-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: #555;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    text-align: center;
    z-index: 1000;
}

/* Contenedor de filtros */
.filters {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 16px 24px;
    align-items: flex-start;
    justify-content: flex-start;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    width: 98%;
    max-width: 1150px;
}
.filters label {
    font-weight: 500;
    color: #3a3a3a;
    margin-right: 7px;
    margin-bottom: 0;
    min-width: 70px;
    text-align: left;
}
.filters input,
.filters select {
    min-width: 100px;
    max-width: 180px;
    width: auto;
    margin-bottom: 0;
    margin-right: 8px;
}
@media (max-width: 900px) {
    .filters {
        flex-direction: column;
        align-items: stretch;
        gap: 8px 0;
    }
    .filters label {
        min-width: 0;
    }
}

/* Contenedor de paginación */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 0;
}

/* Botones de paginación */
.pagination button {
    background-color: #007BFF;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

/* Hover en botones activos */
.pagination button:hover {
    background-color: #0056b3;
}

/* Botones deshabilitados */
.pagination button:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
}

/* Información de paginación */
.pagination span {
    font-size: 1rem;
    color: #495057;
}

/* Búsqueda de infracciones */
#searchResults {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 14px;
    text-align: center;
}

#searchResults thead tr {
    background-color: #505050;
    color: #ffffff;
    text-align: center;
    font-weight: bold;
}

#searchResults th, #searchResults td {
    padding: 2px 7px;
    border-bottom: 1px solid #ddd;
}


/* Mapa de dispositivos */
#map {
    width: 100%;
    height: 400px;
    margin: 20px auto;
    border: 2px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background-color: #f9f9f9;
    z-index: 1;
}

/* Mapa de infracciones */
#map-violations {
    width: 100%;
    height: 600px;
    margin: 20px auto;
    border: 2px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background-color: #f9f9f9;
}

/* Estadísticas */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    justify-items: center;
    align-items: center;
    margin: 20px;
    padding-bottom: 30px;
}

.chart-container {
    width: 100%;
    max-width: 500px;
    height: 400px;
    text-align: center;
}

#infractionTypesChart {
    max-height: 300px;
    width: 100%;
}

canvas {
    max-width: 100%;
}


/* pie de página */
main {
    flex: 1 0 auto;
}

.footer {
    width: 1150px;
    background-color: #333;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.footer-logo {
    width: 100px;
    margin-left: 20px;
}

/* Mejor presentación formulario de edición de lista */
.edit-list-form {
  background: #fff;
  border-radius: 8px;
  padding: 20px 30px 10px 30px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.07);
  margin-bottom: 10px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.form-row {
  display: flex;
  gap: 24px;
  margin-bottom: 10px;
}
.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.edit-list-form label {
  font-weight: 500;
  margin-bottom: 3px;
  color: #333;
}
.edit-list-form input[type="text"],
.edit-list-form input[type="date"],
.edit-list-form select {
  padding: 7px 8px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 15px;
  margin-bottom: 2px;
}
.edit-list-form input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 7px;
}
.edit-list-form button[type="submit"] {
  margin-top: 10px;
  width: auto;
  align-self: flex-end;
}
@media (max-width: 700px) {
  .form-row { flex-direction: column; gap: 0; }
}

.section-separator {
  margin: 24px 0 18px 0;
  border: none;
  border-top: 2px solid #e0e0e0;
  width: 100%;
}

.add-entry-form {
  background: #f7fafd;
  border-radius: 8px;
  padding: 18px 28px 8px 28px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
  margin-bottom: 10px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid #e4e8ee;
}
.add-entry-form .form-row {
  display: flex;
  gap: 22px;
  margin-bottom: 8px;
}
.add-entry-form .form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.add-entry-form label {
  font-weight: 500;
  margin-bottom: 3px;
  color: #246;
}
.add-entry-form input[type="text"],
.add-entry-form input[type="date"] {
  padding: 7px 8px;
  border: 1px solid #bcd;
  border-radius: 4px;
  font-size: 15px;
  margin-bottom: 2px;
}
.add-entry-form button[type="submit"] {
  margin-top: 10px;
  margin-right: 10px;
  width: auto;
  align-self: flex-end;
}
.add-entry-form button[type="button"] {
  margin-top: 10px;
  width: auto;
  align-self: flex-end;
  background: #eee;
  color: #333;
  border: 1px solid #ccc;
}
@media (max-width: 700px) {
  .add-entry-form .form-row { flex-direction: column; gap: 0; }
}

/* ----- ESTILOS BÁSICOS PARA FILTROS GENERALES (listados, formularios simples) ----- 
.filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    width: 98%;
    max-width: 1150px;
}
.filters-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.filters label {
    font-weight: 500;
    color: #3a3a3a;
    margin-bottom: 4px;
    min-width: 90px;
}
.filters input[type="date"],
.filters input[type="text"],
.filters select {
    padding: 5px 10px;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 5px;
    background-color: white;
    color: #495057;
    min-width: 100px;
    max-width: 120px;
    width: auto;
    margin-right: 8px;
    margin-bottom: 0;
    box-shadow: none;
}
.filters input[type="date"]:focus,
.filters input[type="text"]:focus,
.filters select:focus {
    border-color: #4b8df8;
    outline: none;
}
*/
/* ----- ESTILOS ESPECÍFICOS PARA BÚSQUEDA DE INFRACCIONES ----- */
.infraction-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    width: 98%;
    max-width: 1150px;
}
.infraction-filters-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 24px;
    margin-bottom: 0;
}
.infraction-filters label {
    font-weight: 500;
    color: #3a3a3a;
    margin-right: 7px;
    margin-bottom: 0;
    min-width: 30px;
}
.infraction-filters input[type="date"],
.infraction-filters input[type="text"],
.infraction-filters select {
    padding: 5px 10px;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 5px;
    background-color: white;
    color: #495057;
    min-width: 100px;
    max-width: 120px;
    width: auto;
    margin-right: 8px;
    margin-bottom: 0;
    box-shadow: none;
}
.infraction-filters input[type="date"]:focus,
.infraction-filters input[type="text"]:focus,
.infraction-filters select:focus {
    border-color: #4b8df8;
    outline: none;
}
#searchButton {
    background-color: #27AAE1;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-left: 10px;
}
#searchButton:hover {
    background-color: #33AFE3;
}
@media (max-width: 900px) {
    .infraction-filters-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px 0;
    }
    .infraction-filters {
        padding: 12px 6px 8px 6px;
    }
    .infraction-filters label {
        min-width: 0;
    }
}

/* Estilos para los campos de fecha en los listados */
.list-container input[type="date"] {
    padding: 5px 10px;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 5px;
    background-color: white;
    color: #495057;
    min-width: 100px;
    max-width: 120px;
    width: auto;
    margin-bottom: 0;
    margin-right: 8px;
    box-shadow: none;
}
.list-container input[type="date"]:focus {
    border-color: #4b8df8;
    outline: none;
}

/* Estilo específico para listbox de dispositivos (dual listbox) */
.device-listbox,
.device-listbox option {
    padding: 6px;
    font-size: 12px;
    border: 1px solid #bbb;
    border-radius: 3px;
    background: #fafbfc;
    color: #222;
    margin-bottom: 6px;
    width: 180px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.device-listbox:focus {
    border-color: #0078d7;
    outline: none;
}
.device-listbox option {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 4px;
    padding-right: 4px;
}

/* Enlaces de acción en listviolations (Validar/Visualizar) */
.review-link, .view-link {
    display: inline-block;
    padding: 5px 8px;
    margin: 3px 2px;
    font-size: 15px;
    font-weight: 400;
    color: #fff;
    background-color: #27AAE1;
    border-radius: 4px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(30,60,114,0.08);
    border: none;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    width: 100px;
    text-align: center;
}
.review-link:hover, .view-link:hover {
    background-color: #33AFE3;
    color: #ffcb05;
    box-shadow: 0 4px 16px rgba(30,60,114,0.14);
}

/* Hace más altas las filas de las tablas de infracciones */
.infractions-table tr {
    height: 46px;
}
.infractions-table td, .infractions-table th {
    padding-top: 10px;
    padding-bottom: 10px;
}

/* Imágenes miniatura de detecciones en listado */
.detection-img-context,
.detection-img-ocr {
    max-width: 60px;
    max-height: 60px;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    margin: 2px 0;
    transition: box-shadow 0.2s;
}
.detection-img-context:hover,
.detection-img-ocr:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.28);
}

/* Modal de imagen de detección */
#imgModal.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
}
#imgModal .modal-img-large {
    max-width: 80vw;
    max-height: 80vh;
    border: 4px solid #fff;
    box-shadow: 0 0 20px #000;
    z-index: 1001;
}
#closeModal {
    position: absolute;
    top: 30px;
    right: 50px;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    z-index: 1001;
}

/* Variables CSS para sombras y hover unificado */
:root {
    --shadow-default: 0 2px 4px rgba(0,0,0,0.1);
    --navbar-hover-bg: #1a2230;
    --navbar-hover-color: #ffcb05;
}

/* Estilo específico para el selector de dispositivos en la página de estadísticas */
.stats-device-select {
    max-width: 250px !important; /* Anulamos el max-width de 120px definido para los selectores generales */
    min-width: 200px !important; /* Establecemos un ancho mínimo mayor */
}

/* Estilos para la página de limpieza de datos */
.cleanup-section {
    margin: 20px 0;
}

.warning-text {
    color: #ff6b35;
    font-weight: bold;
    font-size: 16px;
    margin: 15px 0;
    padding: 10px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 5px;
}

.data-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.stat-card h3 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 18px;
    font-weight: 600;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #007bff;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
}

.stat-description {
    color: #6c757d;
    font-size: 14px;
    margin-top: 10px;
}

.cleanup-actions {
    margin: 30px 0;
    text-align: center;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s ease;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-secondary:disabled {
    background-color: #adb5bd;
    cursor: not-allowed;
}

.cleanup-notice {
    background-color: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 20px;
    margin: 30px 0;
}

.cleanup-notice h3 {
    color: #1976d2;
    margin: 0 0 10px 0;
}

.cleanup-notice p {
    color: #424242;
    margin: 0;
}

/* Estilos para los controles de eliminación */
.cleanup-controls {
    background-color: #f8f9fa;
    border: 2px solid #dc3545;
    border-radius: 8px;
    padding: 25px;
    margin: 30px 0;
}

.cleanup-controls h3 {
    color: #dc3545;
    margin: 0 0 15px 0;
    font-size: 20px;
}

.cleanup-instructions {
    color: #495057;
    margin: 15px 0 25px 0;
    font-size: 16px;
}

.date-range-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0 30px 0;
}

.date-input-group {
    display: flex;
    flex-direction: column;
}

.date-input-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 14px;
}

.date-input-group input[type="datetime-local"] {
    padding: 10px;
    border: 2px solid #ced4da;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.date-input-group input[type="datetime-local"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.cleanup-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-danger:hover {
    background-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.btn-danger:disabled {
    background-color: #adb5bd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cleanup-preview {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin: 25px 0;
}

.cleanup-preview h4 {
    color: #856404;
    margin: 0 0 15px 0;
    font-size: 18px;
}

.preview-info {
    background-color: white;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
    border-left: 4px solid #007bff;
}

.preview-info p {
    margin: 8px 0;
    color: #495057;
}

.delete-count {
    font-weight: bold;
    color: #dc3545;
    font-size: 18px;
}

.warning-final {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #f5c6cb;
    margin: 15px 0;
    font-weight: 600;
}

.preview-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.btn-danger-confirm {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-danger-confirm:hover {
    background-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* Responsive design para pantallas pequeñas */
@media (max-width: 768px) {
    .date-range-selector {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .cleanup-buttons {
        grid-template-columns: 1fr;
    }
    
    .preview-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .preview-actions button {
        width: 100%;
        max-width: 300px;
    }
}

/* Bloques comentados por presunto código muerto (no se encontraron usos en HTML) */
/* .styled-select option {
    background: #fff;
    color: #333;
} */

/* .add-entry-form .form-row {
  display: flex;
  gap: 22px;
  margin-bottom: 8px;
} */

/* .review-link, .view-link {
    display: inline-block;
    padding: 8px 22px;
    margin: 5px 2px;
    font-size: 15px;
} */

.navbar-menu .dropdown-content a:hover {
    background-color: var(--navbar-hover-bg);
    color: var(--navbar-hover-color);
}

.navbar-menu .navbar-item a:hover, .navbar-menu .dropbtn:hover, .navbar-menu .dropdown:hover > .dropbtn {
    background-color: var(--navbar-hover-bg);
    color: var(--navbar-hover-color);
}

/* Fondo de vídeo para login */
#bg-video {
    position: fixed;
    top: 0;
    left: 0;
    min-width: 100vw;
    min-height: 100vh;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -2;
    background: #000;
    pointer-events: none;
}

/* Estilos para botones de edición superpuestos en imágenes */
.edit-btn-overlay {
    position: absolute;
    top: 5px;
    right: 3px;
    z-index: 10;
}

/* Estilos para modal de edición activo */
.modal-active {
    display: flex !important;
}

/* Estilos para canvas centrado */
.canvas-centered {
    display: block;
    margin: 0 auto;
}

/* Estilos para imágenes de detección */
.detection-image {
    max-width: 300px;
    margin: 10px;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 5px;
    transition: border-color 0.2s ease;
}

.detection-image:hover {
    border-color: #007bff;
}

/*
============================================================
 Estilos exclusivos para el modal de detalles de detecciones
============================================================
*/
#detectionDetailsModal {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.45);
}
#detectionDetailsModal .modal-content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 32px rgba(0,0,0,0.25);
  padding: 32px 24px 24px 24px;
  max-width: 1400px;
  width: 95vw;
  margin: 0 auto;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
#detectionDetailsModal .close {
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 32px;
  cursor: pointer;
}
#detectionDetailsModal h2 {
  text-align: center;
  margin-bottom: 22px;
}
#detectionDetailsModal .details-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 32px;
  margin-bottom: 32px;
}
#detectionDetailsModal .details-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 0;
  margin-bottom: 0;
}
#detectionDetailsModal .details-label {
  font-weight: bold;
  color: #444;
  background: #f2f2f2;
  padding: 7px 8px;
  border-radius: 4px 0 0 4px;
  text-align: right;
  min-width: 90px;
}
#detectionDetailsModal .details-value {
  background: #f9f9f9;
  padding: 7px 8px;
  border-radius: 0 4px 4px 0;
  text-align: left;
  color: #222;
  min-width: 80px;
}
#detectionDetailsModal .details-images {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 18px;
}
#detectionDetailsModal .details-images img {
  display: block;
  margin: 0 auto;
  max-width: 350px;
  max-height: 250px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid #eee;
  box-shadow: 0 2px 8px rgba(0,0,0,0.09);
  background: #fff;
}
@media (max-width: 900px) {
  #detectionDetailsModal .modal-content { padding: 10px 2vw; }
  #detectionDetailsModal .details-columns { grid-template-columns: 1fr; gap: 0; }
  #detectionDetailsModal .details-images img { max-width: 98vw; height: 170px; }
}
@media (max-width: 600px) {
  #detectionDetailsModal .modal-content { padding: 6px 1vw; }
  #detectionDetailsModal .details-columns { grid-template-columns: 1fr; }
  #detectionDetailsModal .details-grid { grid-template-columns: 1fr 1fr; }
  #detectionDetailsModal .details-images img { height: 120px; }
}

/* ============================================
   ESTILOS PARA AUDITORÍA
   ============================================ */

/* Sección de filtros */
.filters-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filters-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 1.3em;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
}

.filter-group select,
.filter-group input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95em;
}

.filter-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

/* Sección de estadísticas */
.stats-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stats-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 1.3em;
}

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

.stat-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #27AAE1;
}

.stat-card h3 {
    margin: 0 0 10px 0;
    font-size: 1em;
    color: #555;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #27AAE1;
    margin: 0;
}

.stat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.stat-list li {
    padding: 5px 0;
    border-bottom: 1px solid #e0e0e0;
}

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

/* Sección de tabla */
.table-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.table-header h2 {
    margin: 0;
    font-size: 1.3em;
}

.table-info {
    color: #666;
    font-size: 0.9em;
}

/* Badges para acciones y severidad */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background-color: #28a745;
    color: white;
}

.badge-info {
    background-color: #17a2b8;
    color: white;
}

.badge-warning {
    background-color: #ffc107;
    color: #333;
}

.badge-danger {
    background-color: #dc3545;
    color: white;
}

.badge-primary {
    background-color: #007bff;
    color: white;
}

.badge-secondary {
    background-color: #6c757d;
    color: white;
}

.badge-default {
    background-color: #e9ecef;
    color: #333;
}

/* Botones pequeños */
.btn-sm {
    padding: 4px 8px;
    font-size: 0.85em;
}

/* Modal de detalles del evento */
.event-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.detail-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.detail-item strong {
    display: block;
    margin-bottom: 5px;
    color: #555;
}

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

.detail-item pre {
    background: #fff;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 5px 0 0 0;
    font-size: 0.9em;
}

/* Responsive para auditoría */
@media (max-width: 768px) {
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .event-details-grid {
        grid-template-columns: 1fr;
    }
    
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ========================================
   LIVEVIEW - Vista en directo de cámaras
   ======================================== */
/*
.liveview-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}*/

.device-selector {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.device-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.device-selector select {
    width: 100%;
    max-width: 500px;
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.video-player {
    width: 100%;
    height: auto;
    min-height: 400px;
    display: block;
}

.video-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background-color: #2c3e50;
    color: white;
    font-size: 18px;
    text-align: center;
    padding: 20px;
}

.video-placeholder.hidden {
    display: none;
}

/* Grid de múltiples streams */
.multi-stream-grid {
    display: grid;
    gap: 10px;
    padding: 10px;
    background-color: #000;
    min-height: 400px;
}

/* 1 stream: pantalla completa */
.multi-stream-grid.streams-1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

/* 2 streams: lado a lado */
.multi-stream-grid.streams-2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

/* 3 streams: 2 arriba, 1 abajo centrado */
.multi-stream-grid.streams-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.multi-stream-grid.streams-3 .stream-wrapper:nth-child(3) {
    grid-column: 1 / -1;
}

/* 4 streams: cuadrícula 2x2 */
.multi-stream-grid.streams-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* Contenedor de cada stream */
.stream-wrapper {
    position: relative;
    background-color: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    min-height: 200px;
}

.stream-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.stream-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
}

.stream-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    text-align: center;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    /* En móvil, todos los streams en columna */
    .multi-stream-grid.streams-2,
    .multi-stream-grid.streams-3,
    .multi-stream-grid.streams-4 {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
    
    .multi-stream-grid.streams-3 .stream-wrapper:nth-child(3) {
        grid-column: 1;
    }
    
    .stream-wrapper {
        min-height: 250px;
    }
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

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

.device-info {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
}

.device-info-item {
    margin-bottom: 8px;
}

.device-info-label {
    font-weight: bold;
    color: #555;
    display: inline-block;
    min-width: 120px;
}

.controls {
    margin-top: 15px;
    text-align: center;
}

.controls button {
    margin: 0 5px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
}

/* Secciones de detecciones e infracciones */
.detections-section,
.violations-section {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.section-header h3 {
    margin: 0;
    color: #333;
    font-size: 20px;
}

.section-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.section-controls label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    cursor: pointer;
}

.section-controls input[type="checkbox"] {
    cursor: pointer;
}

/* Grid de detecciones */
.detections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.detection-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.detection-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.detection-card-image {
    width: 100%;
    height: 126px;
    object-fit: cover;
    background-color: #e9ecef;
}

.detection-card-content {
    padding: 12px;
}

.detection-card-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.detection-card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detection-card-plate {
    font-size: 17px;
    font-weight: bold;
    color: #333;
}

.detection-card-status {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    white-space: nowrap;
}

.detection-card-status.processed {
    background-color: #d1e7dd;
    color: #0f5132;
}

.detection-card-status.pending {
    background-color: #fff3cd;
    color: #664d03;
}

.detection-card-status.error {
    background-color: #f8d7da;
    color: #842029;
}

.detection-card-date {
    font-size: 11px;
    color: #999;
}

.detection-card-info {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
    line-height: 1.4;
}

.detection-card-info strong {
    color: #333;
}

.detection-card.new-highlight {
    animation: cardHighlight 2s ease-in-out;
}

@keyframes cardHighlight {
    0% { box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.5); }
    100% { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
}

/* Tabla de infracciones */
#recentViolationsTable tbody tr {
    cursor: pointer;
}

#recentViolationsTable tbody tr:hover {
    background-color: #e9ecef;
}

.violation-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.violation-status-inserted {
    background-color: #fff3cd;
    color: #664d03;
}

.violation-status-validated {
    background-color: #d1e7dd;
    color: #0f5132;
}

.violation-status-rejected {
    background-color: #f8d7da;
    color: #842029;
}

.violation-status-whitelisted {
    background-color: #cfe2ff;
    color: #084298;
}

/* Responsive para grid de detecciones */
@media (max-width: 768px) {
    .detections-grid {
        grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
        gap: 12px;
    }
    
    .detection-card-image {
        height: 110px;
    }
    
    .detection-card-content {
        padding: 10px;
    }
}
