/* ==========================================================================
   VARIABLES DE DISEÑO (Para fácil personalización)
   ========================================================================== */
:root {
    --primary-color: #2563eb;       /* Azul moderno y vibrante */
    --primary-hover: #1d4ed8;
    --success-color: #10b981;       /* Verde esmeralda */
    --danger-color: #ef4444;        /* Rojo moderno */
    --warning-color: #f59e0b;       /* Ámbar */
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --text-main: #1e293b;           /* Gris oscuro sofisticado */
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   ESTILOS BASE Y LAYOUT (Reemplaza el viejo truco de heights negativos)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css?family=Exo:300,400,500,600,700&display=swap');

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Exo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    background: var(--bg-gradient);
    background-attachment: fixed;
}

/* Contenedor principal usando Flexbox para empujar el footer abajo correctamente */
.wrap {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.wrap > .container {
    flex: 1;
    padding: 100px 24px 40px;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.footer {
    background: var(--card-bg);
    border-top: 1px solid #e2e8f0;
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    box-shadow: 0 -4px 6px -1px rgba(0,0,0,0.05);
}

/* ==========================================================================
   NAVBAR (Actualizada a un estilo premium semi-transparente)
   ========================================================================== */
.navbar-inverse {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.navbar-inverse .navbar-brand {
    color: var(--primary-color) !important;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -0.5px;
}

.navbar-inverse .navbar-nav > li > a {
    color: var(--text-main) !important;
    font-weight: 500;
    transition: var(--transition);
}

.navbar-inverse .navbar-nav > li > a:hover {
    color: var(--primary-color) !important;
}

/* Botón de Logout limpio en la Navbar */
.nav li > form > button.logout {
    padding: 8px 16px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-main);
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: pointer;
}

.nav li > form > button.logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

@media(max-width:767px) {
    .nav li > form > button.logout {
        display: block;
        text-align: left;
        width: 100%;
        padding: 12px 20px;
    }
}

/* ==========================================================================
   COMPONENTES DE LOGIN Y FORMULARIOS
   ========================================================================== */
.body-bg {
    background: var(--bg-gradient);
}

.container-login {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.loginsss {
    background: var(--card-bg);
    padding: 40px 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    height: auto; /* Dejamos que respire según el contenido */
    text-align: center;
    border: 1px solid rgba(255,255,255,0.8);
}

.login-img {
    width: 90px;
    height: 90px;
    margin: 0 auto 24px;
    display: block;
    object-fit: cover;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

/* Campos de entrada estilizados */
.campo {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-md);
    font-size: 15px;
    color: var(--text-main);
    background-color: #f8fafc;
    transition: var(--transition);
    margin-bottom: 16px;
}

.campo:focus {
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
    outline: none;
}

.campoautocomplete {
    width: 100%;
    max-width: 500px;
}

ul.ui-autocomplete {
    z-index: 1100;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid #e2e8f0;
}

/* ==========================================================================
   BOTONES Y VISTAS DE ACCIÓN
   ========================================================================== */
/* Botón general (asumiendo clases Bootstrap o personalizadas) */
.btn, .boton-centro {
    background: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn:hover, .boton-centro:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px -1px rgba(37, 99, 235, 0.3);
}

.jumbotron {
    text-align: center;
    background: rgba(255, 255, 255, 0.4);
    padding: 60px 30px;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(8px);
    margin-bottom: 30px;
}

.jumbotron .btn {
    font-size: 18px;
    padding: 16px 32px;
}

/* ==========================================================================
   SECCIONES DE PAGOS Y CONTENEDORES (Adiós Floats, Hola Grid/Flex)
   ========================================================================== */
/* Reemplazo de caja-izquierda y caja-derecha obsoletas por un Grid Responsive */
.caja-padre-pagos { 
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.caja-izquierda, .caja-derecha {
    width: 100% !important; /* Reseteamos los anchos viejos */
    float: none !important;  /* Eliminamos el float */
    height: auto !important; /* Altura dinámica */
    top: 0 !important;       /* Reseteamos el hack de top negativo */
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    box-sizing: border-box;
}

/* Cajas de estado / alertas de pago */
.box-pago-primario {
    background-color: #eff6ff;
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: 16px;
    color: #1e40af;
}

.box-pago-secundario {
    background-color: #ecfdf5;
    border-left: 4px solid var(--success-color);
    border-radius: var(--radius-md);
    padding: 16px;
    color: #065f46;
}

.caja-totales {
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-md);
    background: #f8fafc;
    padding: 20px;
}

/* Dashboard / Cuadros de inicio (Estilo Tarjetas Modernas) */
.cuadro-inicio-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.cuadro-inicio-left, .cuadro-inicio-centre, .cuadro-inicio-right {
    padding: 24px;
    border-radius: var(--radius-md) !important;
    border: 1px solid rgba(255,255,255,0.6) !important;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    color: #1e293b;
    font-weight: 600;
}

.cuadro-inicio-left:hover, .cuadro-inicio-centre:hover, .cuadro-inicio-right:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.cuadro-inicio-left { background-color: #f0fdf4; border-bottom: 4px solid var(--success-color) !important; }
.cuadro-inicio-centre { background-color: #eff6ff; border-bottom: 4px solid var(--primary-color) !important; }
.cuadro-inicio-right { background-color: #fff7ed; border-bottom: 4px solid var(--warning-color) !important; }

/* ==========================================================================
   TABLAS / GRIDVIEW
   ========================================================================== */
.grid-view {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid #e2e8f0;
}

.grid-view table {
    border-collapse: collapse;
    width: 100%;
}

.grid-view th {
    white-space: nowrap;
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    border-bottom: 2px solid #e2e8f0;
}

.grid-view td {
    padding: 14px 16px;
    border-bottom: 1px solid #edf2f7;
    font-size: 14px;
}

.bordecelda {
    border: 1px solid #e2e8f0;
    text-align: center;
}

/* Iconos de ordenamiento modernos mediante pseudo-elementos */
a.asc:after, a.desc:after {
    position: relative;
    display: inline-block;
    font-family: 'Glyphicons Halflings', sans-serif;
    padding-left: 6px;
    transition: var(--transition);
    opacity: 0.7;
}
a.asc:after { content: " ↑"; }
a.desc:after { content: " ↓"; }

/* ==========================================================================
   MODALES Y AJUSTES DE POSICIÓN
   ========================================================================== */
.modal-body-2 {
    min-height: 400px;
    height: auto;
    padding: 24px;
}

.modal-titulo {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background-color: var(--danger-color);
    padding: 12px;
    border-radius: var(--radius-sm);
}

/* En lugar de usar posiciones absolutas rotas, maneja la alineación en un contenedor flex */
.contenedor-posicion-pago {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.boton-pago-posicion {
    position: static; /* Cambiado de absolute */
}

.texto-tasa-posicion {
    position: static; /* Cambiado de absolute */
    font-size: 16px;
    color: var(--text-main);
}

/* ==========================================================================
   FEEDBACK Y MENSAJES DE ERROR
   ========================================================================== */
.error-summary {
    color: #991b1b;
    background: #fef2f2;
    border-left: 4px solid var(--danger-color);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin: 0 0 20px 0;
    box-shadow: var(--shadow-sm);
    font-size: 14px;
}

.hint-block {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 13px;
}

.not-set {
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-style: normal;
}

.hr-lightblue {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(37, 99, 235, 0.4), rgba(0, 0, 0, 0));
    margin: 24px 0;
}