/* 1. Pon esto en la línea 1 de tu estilos.css */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

/* ... mantén tu reseteo con el asterisco (*) ... */

/* 2. Actualiza tu body así: */
body {
    font-family: 'Roboto', sans-serif; /* <-- Aquí cambiamos la fuente global */
    background-color: #1e1e24;
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
}

/* Reseteo básico de márgenes */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Estructura dividida: Menú izquierdo y Contenido derecho */
.contenedor-app {
    display: flex;
    height: 100vh;
}

/* --- BARRA LATERAL --- */
.sidebar {
    width: 260px;
    background-color: #18181e; /* Un tono oscuro distinto para resaltar */
    border-right: 1px solid #333;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
}

.marca {
    color: #E63946; /* Rojo elegante (Alizarin) */
    text-align: center;
    font-size: 26px;
    margin-bottom: 40px;
    font-weight: bold;
    letter-spacing: 1px;
}

/* --- MENÚ DESPLEGABLE --- */
.desplegable {
    margin-bottom: 10px;
}

/* Botón principal del menú */
.desplegable summary {
    padding: 12px 15px;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    transition: background 0.2s ease;
    list-style: none; 
    user-select: none;
    color: #ffffff; /* <-- ESTA ES LA LÍNEA NUEVA PARA EL COLOR */
}

/* Elimina la flecha nativa en navegadores basados en webkit */
.desplegable summary::-webkit-details-marker {
    display: none;
}

.desplegable summary:hover {
    background-color: #2c2c35;
}

/* Opciones secundarias */
.desplegable ul {
    list-style: none;
    padding-left: 20px; /* Sangría para las opciones */
    margin-top: 5px;
}

.desplegable ul li {
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    color: #a0a0a0; /* Texto un poco más atenuado */
    margin-bottom: 2px;
}

.desplegable ul li:hover {
    background-color: #2c2c35;
    color: #ffffff;
}

/* --- ÁREA PRINCIPAL --- */
.contenido-principal {
    flex: 1;
    padding: 40px;
    background-color: #1e1e24;
    display: flex;
    flex-direction: column;
    min-height: 0; /* NUEVO: Obliga a esta área a NO crecer más allá del 100vh de la pantalla */
}

.contenido-principal h2 {
    color: #E63946; /* Cambiado a Rojo */
    margin-bottom: 15px;
}

.caja-principal {
    background-color: #18181e; 
    border-radius: 16px; 
    padding: 35px;
    border: 1px solid #2a2a32;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    
    flex: 1; 
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    min-height: 0; /* NUEVO: El eslabón perdido. Le da permiso a la caja de frenar su crecimiento y activar el scroll interno */
}

/* --- CABECERA PRODUCTOS Y FORMULARIO --- */
.header-productos {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: transparent; /* Quitamos el fondo porque ya lo tiene la caja principal */
    padding: 0 0 25px 0; /* Solo dejamos espacio abajo */
    margin-bottom: 25px;
    border: none;
    border-bottom: 1px solid #2a2a32; /* Línea separadora sutil */
    border-radius: 0;
}

.formulario-inline {
    display: flex;
    gap: 10px;
}

.formulario-inline input {
    background-color: #1e1e24;
    border: 1px solid #444;
    color: #e0e0e0;
    padding: 10px 15px;
    border-radius: 10px; /* Esquinas más redondeadas */
    outline: none;
    min-width: 220px;
    transition: border-color 0.3s ease;
}

.formulario-inline input::placeholder {
    color: #777;
}

.formulario-inline input:focus {
    border-color: #E63946; 
}

/* --- CARPETAS Y TARJETAS DE PRODUCTO --- */
.carpeta {
    margin-bottom: 30px;
}

.header-carpeta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.header-carpeta h3 {
    color: #4a90e2; /* Cambiado a Azul */
    margin: 0;
}

.grid-productos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.tarjeta-producto {
    background-color: #22222a; /* Tono ligeramente más claro para que resalten sobre la caja */
    border: 1px solid #3a3a45;
    padding: 15px 20px;
    border-radius: 14px; /* Bordes mucho más redondeados */
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #e0e0e0;
    font-size: 14px;
    
    cursor: grab;
    transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

/* Efecto Hover: Resplandor Rojo y pequeño salto */
.tarjeta-producto:hover {
    box-shadow: 0 0 12px #E63946;
    border-color: #E63946;
    transform: translateY(-2px); /* Se levanta un poquito al pasar el mouse */
}

.tarjeta-producto:active {
    cursor: grabbing;
}

.tarjeta-producto.arrastrando {
    opacity: 0.5;
    border: 2px dashed #E63946;
    box-shadow: none;
}

.btn-config {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 12px;
}

.btn-config:hover {
    color: #fff;
}

/* --- ESTILOS PARA LOS AJUSTES DE LA TARJETA --- */
.menu-ajustes-container {
    position: relative;
    display: flex;
    align-items: center;
}

.btn-config {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
    transition: transform 0.2s;
}

.btn-config:hover {
    transform: rotate(45deg); /* Efecto giratorio en la tuerca */
}

/* El menú oculto por defecto */
.menu-oculto {
    display: none; /* Oculto inicialmente */
    position: absolute;
    right: 30px; /* Lo movemos a la izquierda de la tuerca */
    background-color: #2c2c35;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 5px;
    gap: 5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 10;
}

.menu-oculto button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-editar:hover {
    background-color: #4a90e2; /* Azul para editar */
}

.btn-borrar:hover {
    background-color: #E63946; /* Rojo para borrar */
}

/* --- ESTILOS DEL MODAL --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Fondo traslúcido */
    display: none; /* Oculto por defecto */
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

/* --- ESTILOS DEL MODAL MODO OSCURO --- */
.modal-caja {
    background: #1e1e24; /* Mismo fondo que la sidebar */
    padding: 30px;
    border-radius: 20px;
    width: 400px;
    text-align: center;
    color: #e0e0e0; /* Texto claro */
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    border: 1px solid #333; /* Borde sutil para definir la caja */
}

.modal-caja h3 {
    color: #E63946; /* Usamos nuestro rojo para el título del modal */
    margin-bottom: 10px;
}

.modal-caja p {
    font-size: 14px;
    color: #a0a0a0; /* Gris atenuado */
    margin-bottom: 20px;
}

#modal-input {
    width: 100%;
    padding: 12px;
    background-color: #121212; /* Fondo input oscuro */
    border: 1px solid #444;
    color: #ffffff;
    border-radius: 8px;
    margin-bottom: 25px;
    font-family: 'Roboto', sans-serif;
    outline: none;
}

#modal-input:focus {
    border-color: #E63946; /* Resalte rojo al escribir */
}

.login-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: #121212;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

.login-caja {
    background-color: #18181e;
    padding: 40px;
    border-radius: 20px;
    width: 350px;
    text-align: center;
    border: 1px solid #2a2a32;
}

.login-caja p {
    color: #a0a0a0;
    margin-bottom: 25px;
    font-size: 14px;
}

.login-caja input {
    width: 100%;
    height: 45px;
    background-color: #1e1e24;
    border: 1px solid #444;
    color: white;
    border-radius: 10px;
    padding: 0 15px;
    margin-bottom: 15px;
    outline: none;
}

.login-caja input:focus {
    border-color: #E63946;
}

.login-caja .btn-primario {
    width: 100%;
}

/* --- BOTÓN CERRAR SESIÓN --- */
.btn-logout {
    margin-top: auto; /* Lo empuja al fondo del sidebar */
    background-color: transparent;
    color: #E63946;
    border: 1px solid #E63946;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-logout:hover {
    background-color: #E63946;
    color: white;
}

/* --- ESTILO INPUT PERFIL --- */
.input-estilizado {
    background-color: #1e1e24;
    border: 1px solid #444;
    color: white;
    padding: 12px;
    border-radius: 10px;
    outline: none;
}

/* --- SCROLL INTERNO PARA CONTENEDORES --- */
#contenedor-carpetas {
    flex: 1; 
    min-height: 0; /* Obliga a que aparezca el scroll si los juegos no caben */
    overflow-y: auto; 
    padding-right: 15px; 
    padding-bottom: 40px; 
}

/* Diseño personalizado de la barra de Scroll */
#contenedor-carpetas::-webkit-scrollbar {
    width: 12px; /* Quitamos el display: block que estaba rompiendo la rueda del ratón */
}

#contenedor-carpetas::-webkit-scrollbar-track {
    background-color: #1e1e24; /* Color sólido oscuro en lugar de transparente */
    border-radius: 10px;
}

#contenedor-carpetas::-webkit-scrollbar-thumb {
    background-color: #4a4a5a; 
    border-radius: 10px;
    border: 3px solid #18181e; 
}

#contenedor-carpetas::-webkit-scrollbar-thumb:hover {
    background-color: #E63946; 
}

/* --- VISTA HISTORIAL GLOBAL --- */
#contenedor-tabla-historial {
    flex: 1; 
    min-height: 0; 
    overflow-y: auto; 
    padding-right: 15px;
    padding-bottom: 20px;
}

/* Reutilizamos el diseño del scrollbar para la tabla */
#contenedor-tabla-historial::-webkit-scrollbar { width: 12px; }
#contenedor-tabla-historial::-webkit-scrollbar-track { background-color: #1e1e24; border-radius: 10px; }
#contenedor-tabla-historial::-webkit-scrollbar-thumb { background-color: #4a4a5a; border-radius: 10px; border: 3px solid #18181e; }
#contenedor-tabla-historial::-webkit-scrollbar-thumb:hover { background-color: #E63946; }

/* Estilos de la tabla */
.tabla-historial {
    width: 100%;
    border-collapse: collapse;
    color: #e0e0e0;
    font-size: 14px;
    text-align: left;
    table-layout: fixed; /* <-- LA MAGIA ANTISALTOS */
}

.tabla-historial th {
    color: #a0a0a0;
    padding: 15px 10px;
    border-bottom: 2px solid #3a3a45;
    font-weight: 600;
    position: sticky; /* Hace que el encabezado se quede fijo al hacer scroll */
    top: 0;
    background-color: #18181e; /* Fondo sólido para que no se traslape al bajar */
    z-index: 2;
}

.tabla-historial td {
    padding: 15px 10px;
    border-bottom: 1px dashed #2a2a32;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tabla-historial tbody tr:hover {
    background-color: #22222a; /* Efecto iluminado al pasar el mouse por la fila */
}

/* Colores de texto para cuentas y montos */
.texto-azul { color: #4a90e2; font-weight: 500; }
.texto-verde { color: #2ecc71; font-weight: 500; }
.monto-negativo { color: #E63946; font-weight: bold; }
.monto-positivo { color: #2ecc71; font-weight: bold; }

/* Estilos para etiquetas de estado */
.badge-estado {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    display: inline-block;
}

.estado-realizado {
    background-color: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 1px solid #2ecc71;
}

.estado-espera {
    background-color: rgba(241, 196, 15, 0.15);
    color: #f1c40f;
    border: 1px solid #f1c40f;
}

/* Permitir que los selectores usen el mismo diseño oscuro de tus inputs */
select.input-estilizado option {
    background-color: #1e1e24;
    color: #e0e0e0;
}

/* --- ESTILOS DE LOS BOTONES DE FILTRO --- */
.btn-filtro {
    background-color: #22222a;
    color: #a0a0a0;
    border: 1px solid #3a3a45;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-filtro:hover {
    background-color: #2c2c35;
    color: #ffffff;
}

.btn-filtro.activo {
    background-color: #4a90e2; /* Azul principal */
    color: #ffffff;
    border-color: #4a90e2;
}

/* --- NUEVOS COLORES DE ESTADOS --- */
.estado-proceso {
    background-color: rgba(52, 152, 219, 0.15);
    color: #3498db;
    border: 1px solid #3498db;
}

.estado-reembolsado {
    background-color: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.estado-basura {
    background-color: rgba(149, 165, 166, 0.15);
    color: #95a5a6;
    border: 1px dashed #95a5a6; /* Borde punteado para la basura */
}

/* Asegurar que las opciones del badge desplegable se vean bien en modo oscuro */
select.badge-estado option {
    background-color: #1e1e24; /* Fondo del menú oscuro */
    color: #e0e0e0;
}

/* --- MEJORAS DEL MENÚ LATERAL (ESTILO GAMER/ELEGANTE) --- */

/* 1. Reseteamos todos los botones a un gris brillante y preparamos la animación */
.desplegable ul li, 
#menu-perfil {
    color: #c8c8c8 !important; /* Gris muy claro, casi blanco */
    position: relative;
    transition: all 0.3s ease;
    border-left: 3px solid transparent; /* Espacio invisible para la barra roja */
    margin-bottom: 5px;
    padding: 10px 15px;
}

/* 2. Efecto al pasar el mouse (Hover) */
.desplegable ul li:hover,
#menu-perfil:hover {
    color: #ffffff !important;
    transform: translateX(6px); /* Pequeño salto elegante a la derecha */
    background-color: transparent; /* Quitamos el fondo viejo */
}

/* 3. EL ESTADO ACTIVO (Tu toque Gamer) */
.activo-menu {
    color: #ffffff !important;
    font-weight: bold;
    border-left: 3px solid #E63946 !important; /* Barra láser roja a la izquierda */
    background: linear-gradient(90deg, rgba(230, 57, 70, 0.15) 0%, rgba(24, 24, 30, 0) 100%) !important; /* Resplandor rojo que se difumina */
    text-shadow: 0 0 10px rgba(230, 57, 70, 0.4); /* Pequeño brillo en las letras */
    transform: translateX(6px); /* Se queda saltado hacia la derecha */
}

/* --- CHIPS DE SALDO Y FILTROS COMPACTOS --- */
.btn-saldo {
    background-color: #22222a;
    border: 1px solid #3a3a45;
    border-radius: 10px;
    padding: 8px 15px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 130px;
    transition: all 0.3s ease;
}

.btn-saldo:hover {
    background-color: #2c2c35;
    border-color: #a0a0a0;
    transform: translateY(-2px); /* Salto gamer */
}

/* El botón seleccionado se enciende */
.btn-saldo.activo {
    background-color: rgba(230, 57, 70, 0.1); /* Fondo rojizo suave */
    border-color: #E63946; /* Borde rojo láser */
    box-shadow: 0 0 10px rgba(230, 57, 70, 0.4);
}

.saldo-titulo {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 4px;
}

.saldo-monto {
    font-size: 15px;
    font-weight: bold;
}

/* Colores para las monedas */
.saldo-dolares .saldo-monto { color: #4a90e2; } /* Azul */
.saldo-bolivares .saldo-monto { color: #2ecc71; } /* Verde */
.saldo-soles .saldo-monto { color: #f1c40f; } /* Dorado */

/* Centrado perfecto para el botón Ver Todo */
.btn-todos {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #18181e;
    color: #ffffff;
}

/* Efecto Gamer: El botón se "hunde" levemente justo al hacer clic */
.btn-saldo:active {
    transform: scale(0.94);
}

/* --- ANIMACIÓN FLUIDA PARA LA TABLA --- */
/* Creamos la magia de aparecer suavemente deslizando hacia arriba */
@keyframes aparecerFluido {
    from { 
        opacity: 0; 
        transform: translateY(15px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Le aplicamos la magia a las filas de la tabla cuando las filtramos */
#body-historial tr {
    animation: aparecerFluido 0.3s ease-out forwards;
}

/* --- CAJAS DE TASAS EN TIEMPO REAL --- */
.caja-tasa {
    display: flex;
    align-items: center;
    background-color: #22222a;
    border: 1px solid #3a3a45;
    border-radius: 8px;
    padding: 6px 12px;
    gap: 8px;
    font-size: 13px;
    color: #888;
    font-weight: bold;
    transition: all 0.3s ease;
}

.caja-tasa:hover {
    border-color: #555;
    background-color: #2c2c35;
}

.caja-tasa input {
    background-color: transparent;
    border: none;
    font-weight: bold;
    font-size: 15px;
    width: 65px;
    text-align: center;
    outline: none;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s ease;
}

/* Subrayado rojo gamer al hacer clic para escribir */
.caja-tasa input:focus {
    border-bottom: 2px solid #E63946;
}

/* Colores representativos de cada moneda */
#input-tasa-soles { color: #f1c40f; } /* Dorado */
#input-tasa-bs { color: #2ecc71; }    /* Verde bolívar */

/* =========================================
   SISTEMA DE DISEÑO GLOBAL: BOTONES
========================================= */

/* 1. BOTÓN PRINCIPAL (Oscuro que se enciende en Rojo Gamer al pasar el mouse) */
.btn-primario {
    background-color: #2c2c35;
    color: #e0e0e0;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: all 0.3s ease;
}

.btn-primario:hover {
    background-color: #E63946;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
}

/* 2. BOTÓN SECUNDARIO (Blanco Elegante que pasa a Rojo al pasar el mouse) */
.btn-secundario {
    background-color: #e0e0e0;
    color: #18181e; /* Letras oscuras para que se lea en el blanco */
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: all 0.3s ease;
}

.btn-secundario:hover {
    background-color: #E63946;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
}

/* 3. BOTÓN FANTASMA / CANCELAR (Transparente con bordes, sutil) */
.btn-fantasma {
    background-color: transparent;
    color: #888;
    border: 1px solid #444;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: all 0.3s ease;
}

.btn-fantasma:hover {
    background-color: #2c2c35;
    color: #ffffff;
    border-color: #888;
}

/* Efecto de arrastre profesional */
.fantasma-arrastre {
    opacity: 0.4;
    background-color: #E63946 !important;
    border: 2px dashed #ffffff !important;
}

/* --- ANIMACIÓN FLIP PARA SALDOS --- */
.contenedor-flip {
    display: inline-flex;
    flex-direction: column;
    height: 18px; /* Alto fijo del cilindro invisible */
    overflow: hidden;
}

.monto-cara-a, .monto-cara-b {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Curva suave y fluida */
    height: 18px;
    line-height: 18px;
    white-space: nowrap;
}

.monto-cara-b {
    color: #a0a0a0; /* El monto escondido tiene color apagado */
    font-weight: 500;
}

/* Al pasar el mouse, subimos todo el texto como un ascensor */
.btn-saldo:hover .monto-cara-a,
.btn-saldo:hover .monto-cara-b {
    transform: translateY(-18px);
}

.btn-saldo:hover .monto-cara-b {
    color: #ffffff; /* Se ilumina al llegar a la vista */
}

/* --- VISTA PERMISOS DE WALLETS --- */
.tarjeta-permiso {
    background-color: #22222a;
    border: 1px solid #3a3a45;
    border-radius: 14px;
    padding: 20px;
    transition: all 0.3s ease;
    height: fit-content; /* <-- ESTO HACE QUE NO SE ESTIRE HASTA ABAJO INNECESARIAMENTE */
}

.tarjeta-permiso:hover {
    border-color: #4a90e2; /* Se ilumina en azul al pasar el mouse */
}

.tarjeta-permiso h3 {
    color: #4a90e2;
    border-bottom: 1px solid #3a3a45;
    padding-bottom: 10px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}

.grid-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 columnas idéntico a tu diseño */
    gap: 15px 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e0e0e0;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

/* Checkbox estilo Gamer/Moderno */
.checkbox-item input[type="checkbox"] {
    appearance: none;
    background-color: #121212;
    border: 1px solid #444;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-item input[type="checkbox"]:checked {
    background-color: #2ecc71; /* Verde de autorizado */
    border-color: #2ecc71;
}

/* La palomita del check */
.checkbox-item input[type="checkbox"]:checked::after {
    content: "✔";
    color: white;
    font-size: 13px;
    position: absolute;
    top: -1px;
    left: 2px;
}

/* --- ESTILO PARA EL LOGO CENTRADO --- */
.logo-centrado {
    display: block; /* Ocupa todo el ancho disponible */
    margin: 0 auto; /* Centrado automático horizontal */
    max-width: 180px; /* Ajusta este valor para cambiar el tamaño del logo */
    height: auto; /* Mantiene la proporción de la imagen */
    padding: 20px 0; /* Espaciado arriba y abajo */
}

.input-estilizado:focus {
    border-color: #E63946; 
}