/* ========================================================== */
/* ===                ESTILOS GLOBALES                      === */
/* ========================================================== */
body {
    font-family: Arial, sans-serif;
    background-color: #121212;
    /* Fondo oscuro principal */
    color: #e0e0e0;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

#page-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Contenedores principales de página */
.container {
    background: #1f1f1f;
    /* Color de panel oscuro */
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #444;
    display: none;
}

.container.active {
    display: block;
}

#login-container {
    max-width: 400px;
    margin: 10vh auto;
}

/* Títulos */
h1,
h2,
h3,
h4 {
    color: #ffffff;
    margin-bottom: 20px;
    margin-top: 0;
    text-align: center;
}

hr {
    border: 1px solid #333;
    margin: 40px 0;
}

/* Formularios y Botones */
input,
select,
button {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    font-size: 16px;
    box-sizing: border-box;
}

input::placeholder {
    color: #888;
}

input[type="checkbox"] {
    transform: scale(1.5);
    width: auto;
}

select {
    text-align-last: center;
}

button {
    background-color: #007bff;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #0056b3;
}

/* Mensajes de feedback */
.error-message {
    color: #dc3545;
    font-size: 14px;
    text-align: center;
    height: 20px;
}

.success-message {
    color: #28a745;
    font-size: 14px;
    text-align: center;
    height: 20px;
}

/* Tablas */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    color: #e0e0e0;
}

th,
td {
    padding: 12px;
    border: 1px solid #333;
    text-align: left;
    white-space: nowrap;
}

th {
    background-color: #2a2a2a;
}


/* ========================================================== */
/* ===            ESTILOS DE LA BARRA DE NAVEGACIÓN         === */
/* ========================================================== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #1f1f1f;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid #444;
    margin-bottom: 30px;
}

.nav-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-item {
    color: #f0f0f0;
    text-decoration: none;
    font-size: 16px;
    margin: 0;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.nav-item:hover {
    background-color: #333;
}

.nav-logout-btn {
    background-color: #dc3545;
    font-weight: bold;
}

.nav-logout-btn:hover {
    background-color: #c82333;
}


/* ========================================================== */
/* ===     TERMINAL DE APUESTAS ('vendedor.html')         === */
/* ========================================================== */
.padre {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    padding: 0 20px 20px 20px;
}

.pagos {
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #444;
    display: flex;
    flex-direction: column;
    gap: 30px;
    flex-shrink: 0;
    width: 320px;
    background-color: #1f1f1f;
}

.pagoBoleto,
.anular {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.reprint-btn {
    background-color: #6c757d;
}

.reprint-btn:hover {
    background-color: #5a6268;
}

.generarApuesta {
    background-color: #1f1f1f;
    border: 1px solid #444;
    border-radius: 10px;
    padding: 20px;
    width: 65%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 170px);
}

.miniNav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #444;
}

.miniNav p {
    margin: 0 0 8px 0;
    font-size: 0.9em;
    color: #aaa;
}

.instructions {
    background-color: #333;
    border: 1px solid #555;
    color: #f0f0f0;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    margin-bottom: 15px;
    font-weight: bold;
}

.caballos {
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid #444;
    margin-bottom: 20px;
}

.caballos th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.costos {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-top: 1px solid #444;
    padding-top: 20px;
}

.costos-izquierda {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
}

.costos-derecha {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 25px;
}

.costo-item-vertical p,
.costo-item-horizontal label,
.costo-total p {
    margin: 0 0 5px 0;
    font-size: 0.9em;
    color: #aaa;
}

.valor {
    font-size: 2em;
    color: #ffc107;
    font-weight: bold;
    margin: 0;
}

.valor-total {
    font-size: 2.2em;
    font-weight: bold;
    color: #4CAF50;
    margin: 0 0 10px 0;
}

.monto-input {
    padding: 8px;
    font-size: 1.2em;
    font-weight: bold;
    width: 120px;
    border-color: #007bff;
}

.refresh-btn {
    background-color: #17a2b8;
    padding: 10px 15px;
    font-size: 14px;
    width: auto;
}

.refresh-btn:hover {
    background-color: #138496;
}

.enviar-btn {
    background-color: #28a745;
}

.enviar-btn:hover {
    background-color: #218838;
}


/* ========================================================== */
/* ===       DASHBOARD DE ADMINISTRACIÓN ('index.html')     === */
/* ========================================================== */
.admin-section {
    margin-bottom: 30px;
    border: 1px solid #333;
    padding: 20px;
    border-radius: 5px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #6c757d;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #28a745;
}

input:checked+.slider:before {
    transform: translateX(26px);
}


/* ========================================================== */
/* ===             PÁGINA DE REPORTES                     === */
/* ========================================================== */
.report-header {
    text-align: center;
    margin-bottom: 30px;
}

.report-header h1 {
    font-size: 2.5em;
    margin-bottom: 5px;
}

.report-header p {
    font-size: 1.1em;
    color: #aaa;
}

.report-filters {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    background-color: #2a2a2a;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #444;
}

.report-filters label {
    margin-bottom: 5px;
    font-weight: bold;
    color: #f0f0f0;
}

.report-filters input[type="date"] {
    padding: 8px;
    font-size: 1em;
}

#generate-report-btn {
    padding: 10px 30px;
    width: auto;
    
}

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

.summary-card {
    background: #1f1f1f;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border: 1px solid #444;
}

.summary-card h4 {
    margin: 0 0 10px 0;
    color: #aaa;
    font-size: 1em;
}

.summary-card p {
    font-size: 2em;
    font-weight: bold;
    color: #28a745;
    margin: 0;
}

#summary-bets {
    color: #ffc107;
}

#summary-users {
    color: #17a2b8;
}

.report-details h3 {
    text-align: center;
    margin-bottom: 20px;
}

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

#report-table tbody tr:nth-child(even) {
    background-color: #2a2a2a;
}

.info-message {
    text-align: center;
    color: #aaa;
    margin-top: 20px;
}

/* Estilos para el menú desplegable en la navbar */
.nav-item.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #333;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 1;
    border-radius: 5px;
    overflow: hidden;
    /* Para que los bordes redondeados se apliquen a los items */
}

.dropdown-content a {
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
}

.dropdown-content a:hover {
    background-color: #555;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* ========================================================== */
/* ===         ESTILOS PARA LA IMPRESIÓN DEL CUADRE         === */
/* ========================================================== */

@media print {

    /* Ocultar todo por defecto cuando se va a imprimir */
    body>* {
        display: none !important;
    }

    /* Mostrar ÚNICAMENTE el contenedor de impresión del cuadre y su contenido */
    #print-container,
    #print-container * {
        display: block !important;
        visibility: visible !important;
    }

    /* Posicionar el contenedor en la esquina superior izquierda de la página */
    #print-container {
        position: absolute;
        left: 0;
        top: 0;
        margin: 10px;
        padding: 10px;
        box-shadow: none;
        border: none;
        font-family: 'Courier New', Courier, monospace;
        /* Tipografía de recibo */
        color: #000;
        /* Aseguramos que el texto sea negro para imprimir */
    }

    /* Forzar fondo blanco para el cuerpo del recibo de impresión */
    #print-container .cash-box-body {
        background-color: #fff !important;
        border: 1px solid #000 !important;
    }

    /* Forzar que todos los textos dentro del contenedor sean negros */
    #print-container h1,
    #print-container h4,
    #print-container span,
    #print-container strong,
    #print-container p {
        color: #000 !important;
    }

    /* Estilos específicos para la versión de impresión */
    #print-container .cash-box-header {
        background-color: #eee !important;
        color: #000 !important;
        border-bottom: 1px solid #000;
        font-size: 1.1em;
    }

    #print-container hr {
        border-top: 1px dashed #000;
    }
}

/* Estilos adicionales para management.html */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-item-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.list-item-content small {
    font-size: 0.8em;
    color: #888;
}

.status.active {
    color: #28a745;
}

.status.inactive {
    color: #dc3545;
}

.delete-btn,
.withdraw-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    width: auto;
    /* Ancho automático para botones pequeños */
}

.delete-btn {
    background-color: #dc3545;
}

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

.withdraw-btn:hover {
    background-color: #5a6268;
}

/* EN tu archivo CSS de reportes (ej. reporte.css) */

.admin-row {
    background-color: #2a2a2a;
    /* Un poco más oscuro para destacar */
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.admin-row:hover {
    background-color: #383838;
}

.toggle-icon {
    display: inline-block;
    width: 20px;
    transition: transform 0.2s;
}

.admin-row.expanded .toggle-icon {
    transform: rotate(90deg);
}

.vendedor-row {
    background-color: #222;
    /* Un poco más claro que el fondo */
}

/* ========================================================== */
/* ===    ESTILOS PARA CELDAS EXPANDIBLES (NUEVO)         === */
/* ========================================================== */

/* Estilo para la celda <td> que contendrá el texto largo */
.expandable-cell {
    /* Permite que el contenido interno se posicione relativo a la celda */
    position: relative;
}

/* Un contenedor para el texto, que es el que realmente se truncará */
.expandable-cell .content-wrapper {
    /* Ancho máximo antes de truncar. Puedes ajustar este valor. */
    max-width: 225px;

    /* Propiedades clave para truncar el texto */
    white-space: nowrap;
    /* Evita que el texto salte a la siguiente línea */
    overflow: hidden;
    /* Oculta el texto que se desborda */
    text-overflow: ellipsis;
    /* Añade los "..." al final */

    /* Indicadores visuales para el usuario */
    cursor: pointer;
    transition: all 0.2s ease;

    /* Espacio a la derecha para el texto "Ver más" */
    padding-right: 65px;
}

/* Pseudo-elemento para crear el texto "Ver más" y el efecto de difuminado */
.expandable-cell .content-wrapper::after {
    content: 'Ver más...';
    position: absolute;
    right: 12px;
    /* Alineado con el padding de la celda */
    top: 50%;
    transform: translateY(-50%);

    /* Estilos del texto */
    font-size: 0.8em;
    font-weight: bold;
    color: #00aaff;

    /* Efecto de difuminado para una transición suave */
    background: linear-gradient(to left, #2a2a2a 60%, transparent 100%);
    padding-left: 20px;
}

/* --- ESTADO EXPANDIDO --- */

/* Cuando la celda tiene la clase 'expanded', cambiamos los estilos */
.expandable-cell.expanded .content-wrapper {
    white-space: normal;
    /* Permite que el texto ocupe múltiples líneas */
    overflow: visible;
    /* Muestra todo el texto desbordado */
    max-width: none;
    /* Elimina la restricción de ancho */
    cursor: default;
    /* El cursor vuelve a la normalidad */
    padding-right: 0;
    /* Quitamos el padding extra */
}

/* Ocultamos el "Ver más..." cuando la celda está expandida */
.expandable-cell.expanded .content-wrapper::after {
    display: none;
}

/* EN: reporte.css (reemplazar la sección de etiquetas completa) */

/* ========================================================== */
/* ===    ESTILOS PARA ETIQUETAS VISUALES (Tags/Badges)   === */
/* ========================================================== */

/* -- ESTILO PARA "JUGADOR / TIPO" (Borde y Texto de Color) -- */

.player-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: bold;
    border: 1px solid;
    /* El color se define en las clases de abajo */
}

.player-tag i {
    margin-right: 6px;
}

.player-tag-terminal {
    background-color: rgba(23, 162, 184, 0.2);
    color: #17a2b8;
}

.player-tag-movil {
    background-color: rgba(40, 167, 69, 0.2);
    color: #28a745;
}

.player-info-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

/* -- ESTILO PARA "ESTADO" (Fondo Sólido y Texto Blanco) -- */

.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    color: #ffffff;
    /* Texto siempre blanco */
    text-transform: uppercase;
    text-align: center;
}

/* Clases de color para el fondo del badge de estado */
.badge-ganadora {
    background-color: #28a745;
}

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

.badge-pendiente {
    background-color: #ffc107;
}

.badge-perdedora {
    background-color: #dc3545;
}

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

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

.report-filters {
    display: grid;
    /* Cambiamos a grid para un control perfecto */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    /* Columnas responsivas */
    align-items: end;
    /* Alinea los elementos en la parte inferior */
    gap: 20px;
    background-color: #2a2a2a;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #444;
}

/* EN: reporte.css (añadir al final) */

#pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 25px;
    flex-wrap: wrap;
}

#pagination-controls button {
    background-color: #333;
    border: 1px solid #555;
    width: auto;
    padding: 8px 14px;
    font-size: 14px;
}

#pagination-controls button:hover:not(:disabled) {
    background-color: #007bff;
}

#pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#pagination-controls span {
    padding: 8px 14px;
    font-size: 14px;
    color: #aaa;
}

#pagination-controls span.active {
    background-color: #007bff;
    color: white;
    font-weight: bold;
    border-radius: 5px;
}

/* ========================================================== */
/* ===     ESTILOS PARA EL NUEVO NAVEGADOR DE TICKETS     === */
/* ========================================================== */

/* --- 1. Panel de Filtros Mejorado --- */
.ticket-browser-filters {
    display: grid;
    /* CAMBIO CLAVE: Un minmax más pequeño da más flexibilidad para que los elementos se ajusten */
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-items: end;
    gap: 15px;
    /* Un poco menos de espacio */
    background-color: #2a2a2a;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #444;
}

/* Contenedor para cada par de etiqueta + input/select */
.filter-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Espacio entre la etiqueta y el campo */
}

.filter-item label {
    font-size: 0.9em;
    font-weight: bold;
    color: #ccc;
    text-align: left;
    /* Alineamos las etiquetas a la izquierda */
}

/* El input para buscar por ticket y el botón ocuparán más espacio */
.filter-item.search-item {
    /* Permitimos que ocupe hasta 2 columnas si el espacio está disponible */
    grid-column: span 2 / auto;
}

/* Contenedor específico para el botón de búsqueda */


/* Botón principal de acción */
.primary-action-btn {
    background-color: #007bff;
    font-size: 1.1em;
    font-weight: bold;
    padding: 12px 20px;
    /* Hacemos el botón un poco más alto */
    width: 100%;
    margin: 0;
}

.primary-action-btn:hover {
    background-color: #0056b3;
}

/* --- 2. Ajustes Menores para la Tabla --- */
#detailed-table-body .player-info-container span:first-child {
    font-weight: bold;
    /* Hacer el nombre del vendedor un poco más notorio */
}

/* EN tu reporte.css, modifica también esto para que el puntero cambie */
.ticket-link {
    cursor: pointer;
    /* Indica que es clickeable */
}

/* ========================================================== */
/* ===     ESTILOS REFINADOS PARA EL NAVEGADOR DE TICKETS   === */
/* ========================================================== */

/* --- 1. Panel de Filtros --- */
.ticket-browser-page .ticket-browser-filters {
    background-color: #1f1f1f;
    /* Un fondo un poco más oscuro que el contenedor */
    border: 1px solid #333;
    padding: 20px;
}

/* Redefinimos los campos de formulario dentro de este panel */
.ticket-browser-page .filter-item input,
.ticket-browser-page .filter-item select {
    background-color: #2c2c2c;
    border: 1px solid #444;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Efecto de foco para resaltar el campo activo */
.ticket-browser-page .filter-item input:focus,
.ticket-browser-page .filter-item select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    outline: none;
}

/* --- 2. Estilos Mejorados para la Tabla --- */

/* Cabecera de la tabla */
.ticket-browser-page table thead th {
    background-color: #2a2a2a;
    color: #aaa;
    border-bottom: 2px solid #444;
    /* Borde inferior más grueso para separar */
    text-transform: uppercase;
    /* MAYÚSCULAS para un look más profesional */
    font-size: 0.8em;
    letter-spacing: 0.5px;
    /* Pequeño espaciado entre letras */
}

/* Filas del cuerpo de la tabla */
.ticket-browser-page table tbody tr {
    transition: background-color 0.15s ease-in-out;
}

.ticket-browser-page table tbody tr:hover {
    background-color: #2c2c2e;
    /* Un sutil resaltado al pasar el ratón */
}

/* Celdas de la tabla */
.ticket-browser-page table td {
    border-top: 1px solid #333;
    /* Solo líneas horizontales para un look más limpio */
    border-bottom: 1px solid #333;
    border-left: none;
    border-right: none;
    vertical-align: middle;
}

/* --- 3. Mensaje "Sin Resultados" Mejorado --- */

.no-results-message {
    text-align: center !important;
    /* Forzar alineación al centro */
    padding: 40px 20px !important;
    font-size: 1.1em;
    color: #00aaff;
    /* Usamos un color azul para mensajes informativos */
    font-style: italic;
}