﻿/* ESTILOS COMPARTIDOS PARA GRILLAS Y FILTROS */

.consulta-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* CARGAR EMISIONES */

.alerta-error {
    background: #fdecea;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
}

.alerta-ok {
    background: #eafaf1;
    border: 1px solid #b7dfca;
    color: #1e4d2b;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.8;
}

/* FILTROS */
.filtros-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.filtros-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}

.btn-filtrar {
    background: #4caf50;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 5px 14px;
    font-size: 13px;
    cursor: pointer;
}

.btn-reset {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
}

.btn-colapsar {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #666;
}

.filtros-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 14px;
}

.filtro-grupo {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .filtro-grupo label {
        font-size: 12px;
        color: #555;
    }

.filtro-input {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 13px;
    width: 100%;
    min-width: 140px;
}

    .filtro-input:focus {
        outline: none;
        border-color: #4caf50;
    }

.filtro-sm {
    max-width: 200px;
}

/* COLUMNAS */
.columnas-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 14px;
}

.columnas-header {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.columnas-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.col-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

.col-toggle {
    accent-color: #4caf50;
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* GRILLA */
.grilla-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    overflow-x: auto;
}

.grilla {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .grilla thead th {
        background: #f5f5f5;
        border-bottom: 2px solid #ddd;
        padding: 8px 10px;
        text-align: left;
        white-space: nowrap;
        font-weight: 600;
        color: #333;
        position: sticky;
        top: 0;
    }

    .grilla tbody td {
        padding: 7px 10px;
        border-bottom: 1px solid #eee;
        white-space: nowrap;
    }

    .grilla tbody tr:hover {
        background: #f9fff9;
    }

.grilla-vacia {
    text-align: center;
    color: #999;
    padding: 40px !important;
}

.grilla-pie {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.paginacion {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-pag {
    background: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 14px;
}

    .btn-pag:hover {
        background: #eee;
    }

.pag-num {
    background: #4caf50;
    color: #fff;
    border-radius: 3px;
    padding: 2px 10px;
    font-size: 13px;
    min-width: 30px;
    text-align: center;
}

.btn-refresh {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #666;
}

/* GRILLAS DENTRO DE MODALES */
.grilla-modal {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border: 1px solid #e0e0e0;
    table-layout: fixed;
}

    .grilla-modal thead th {
        background: #f5f5f5;
        border: 1px solid #e0e0e0;
        padding: 8px 10px;
        text-align: left;
        font-weight: 600;
        color: #333;
    }

    .grilla-modal tbody td {
        padding: 7px 10px;
        border: 1px solid #e0e0e0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .grilla-modal tbody tr:hover {
        background: #f9fff9;
    }

    .grilla-modal tr.excluido td {
        background: #fff3cd;
    }

/* BOTONES DE ACCIÓN */
.btn-accion {
    border: 1px solid;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 4px;
    min-width: 70px;
    text-align: center;
}

.btn-editar {
    color: #fff;
    background: #4caf50;
    border-color: #4caf50;
}

    .btn-editar:hover {
        background: #43a047;
    }

.btn-eliminar {
    color: #fff;
    background: #d32f2f;
    border-color: #d32f2f;
}

    .btn-eliminar:hover {
        background: #b71c1c;
    }

/* LAYOUT GENERAL */
:root {
    --verde: #4caf50;
    --verde-hover: #43a047;
    --sidebar-bg: #2d2d2d;
    --sidebar-text: #cccccc;
    --sidebar-hover: #3d3d3d;
    --sidebar-active: #4caf50;
    --header-height: 48px;
    --sidebar-width: 220px;
}

.sidebar-seccion {
    padding: 10px 20px 4px;
    font-size: 11px;
    text-transform: uppercase;
    color: #FFF;
    letter-spacing: 0.5px;
    margin-top: 8px;
    border-top: 1px solid #3d3d3d;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
    background: #f4f4f4;
}

/* SIDEBAR */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

    #sidebar .sidebar-brand {
        height: var(--header-height);
        display: flex;
        align-items: center;
        padding: 0 16px;
        font-size: 14px;
        font-weight: 600;
        border-bottom: 1px solid #3d3d3d;
        color: #fff;
    }

        #sidebar .sidebar-brand i {
            margin-right: 8px;
        }

    #sidebar nav a {
        display: block;
        padding: 10px 20px;
        color: var(--sidebar-text);
        text-decoration: none;
        font-size: 13px;
        transition: background 0.15s;
    }

        #sidebar nav a:hover {
            background: var(--sidebar-hover);
            color: #fff;
        }

        #sidebar nav a.active {
            color: var(--verde);
            font-weight: 600;
        }

/* HEADER */
#topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--verde);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 999;
    box-shadow: 0 2px 4px rgba(0,0,0,.15);
}

    #topbar .page-title {
        font-size: 15px;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    #topbar .topbar-actions {
        display: flex;
        gap: 8px;
    }

.btn-topbar {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

    .btn-topbar:hover {
        background: rgba(255,255,255,0.25);
    }

    .btn-topbar.btn-buscar {
        background: #fff;
        color: var(--verde);
        border-color: #fff;
        font-weight: 600;
    }

        .btn-topbar.btn-buscar:hover {
            background: #f0f0f0;
        }

/* CONTENIDO */
#main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 20px;
    min-height: calc(100vh - var(--header-height));
}

/* CARGA EMISIONES */
.tab-btn {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    color: #555;
}

.tab-btn.active {
    background: #4caf50;
    color: #fff;
    border-color: #4caf50;
}

.tab-btn:hover:not(.active) {
    background: #eee;
}

.celda-error select {
    border-color: #d32f2f;
    background: #fdecea;
}

.fila-anulada {
    background: #f0f0f0;
    color: #888;
}

/* CUOTAS SIN SPINNER*/
.sin-flechas::-webkit-outer-spin-button,
.sin-flechas::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sin-flechas {
    -moz-appearance: textfield;
}

.btn-primario {
    background: var(--verde);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 16px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 600;
}

.btn-primario:hover {
    background: var(--verde-hover);
}

.btn-secundario {
    background: #fff;
    color: #666;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 6px 16px;
    font-size: 13px;
    cursor: pointer;
}

.btn-secundario:hover {
    background: #f5f5f5;
}

/* CARTEL FLOTANTE (reemplaza alert() nativo del navegador) */
.cartel-flotante {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    padding: 12px 18px;
    border-radius: 6px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 5000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
}

.cartel-visible {
    opacity: 1;
    transform: translateY(0);
}

.cartel-error {
    background: #fdecea;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.cartel-ok {
    background: #eafaf1;
    border: 1px solid #b7dfca;
    color: #1e4d2b;
}

.fila-activa {
    background: #e8f5e9 !important;
}

.fila-cobranza {
    cursor: pointer;
}

.vence-rojo {
    color: red;
}