/*=============================================
SISTEMA DE DISEÑO ESTÁNDAR - POS PREMIUM
=============================================*/

/* 1. TIPOGRAFÍA Y CABECERAS */
.content-header h1 {
    font-family: 'Source Sans Pro', sans-serif;
    font-weight: 300 !important;
    color: #2c3e50 !important;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 24px !important;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 5px;
    text-shadow: none !important;
}

.content-header h1 small {
    font-weight: 400 !important;
    text-transform: none;
    letter-spacing: 0;
    color: #7f8c8d !important;
    font-size: 15px !important;
    border-left: 2px solid #bdc3c7;
    padding-left: 12px;
    display: inline-block;
    text-shadow: none !important;
}

/* 2. CAJAS (BOXES) Y CONTENEDORES */
.box {
    border-top: 3px solid #d2d6de;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    border-top: none !important; /* Quitar la línea de color superior por defecto */
}

.box-header {
    padding: 15px !important;
    border-bottom: 1px solid #f4f4f4 !important;
}

.box-header .box-title {
    font-weight: 600 !important;
    color: #444 !important;
}

/* 3. MENSAJES DE BIENVENIDA */
.box-bienvenida {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    margin-top: 20px;
}

.titulo-bienvenida {
    font-weight: 300 !important;
    color: #34495e !important;
    font-size: 26px !important;
    text-shadow: none !important;
    letter-spacing: 0.5px;
    margin: 0;
}

/* 4. TABLAS DATATABLES */
.table thead th {
    background-color: #f9fafb !important;
    color: #4b5563 !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    font-size: 12px !important;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e5e7eb !important;
    padding: 12px 8px !important;
}

.table tbody td {
    vertical-align: middle !important;
    color: #374151 !important;
}

/* 5. RESPONSIVIDAD */
@media (max-width: 767px) {
    .content-header h1 {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        font-size: 20px !important;
    }
    .content-header h1 small {
        border-left: none;
        padding-left: 0;
    }
    .titulo-bienvenida {
        font-size: 20px !important;
    }

    /* Botones de acción compactos en móviles para todas las tablas */
    .table .btn-group .btn {
        padding: 2px 6px !important;
        font-size: 12px !important;
        line-height: 1.5 !important;
    }
}

/* 6. CORRECCIONES DE MODALES (Z-INDEX) */
.modal {
    z-index: 10050 !important;
}

.modal-backdrop {
    z-index: 10040 !important;
}

/* Modales anidados o especiales */
.modal-lg {
    z-index: 10051 !important;
}

/* Forzar visibilidad y opacidad */
.modal.fade.in {
    opacity: 1 !important;
}

/* 7. FILTROS Y CABECERAS RESPONSIVAS */
@media (max-width: 767px) {
    .box-header .btn-primary:not([type="submit"]),
    .box-header .btn-success:not([type="submit"]),
    .box-header .btn-info:not([type="submit"]) {
        width: 100%;
        margin-bottom: 10px;
    }

    .pull-right.contenedor-filtros {
        float: none !important;
        width: 100%;
        margin-top: 10px;
    }

    .pull-right.contenedor-filtros form {
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
        gap: 10px !important;
        display: flex;
    }

    .pull-right.contenedor-filtros form .input-group,
    .pull-right.contenedor-filtros form div {
        width: 100% !important;
    }

    #daterange-btn,
    .pull-right.contenedor-filtros form [type="submit"],
    .pull-right.contenedor-filtros form .btn-default {
        width: 100% !important;
        margin-bottom: 5px;
    }
}

/* 8. CELDA DE OBSERVACIÓN EDITABLE */
.celda-observacion {
    background: #fff9e6;
    padding: 8px;
    border-radius: 3px;
    font-size: 12px;
    color: #666;
    border-left: 2px solid #f39c12;
    cursor: text;
    min-height: 30px;
    transition: all 0.3s ease;
}

.celda-observacion:empty:not(:focus):before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

/* Evitar que el placeholder se encime con el texto */
.celda-observacion:not(:empty):before,
.celda-observacion:focus:before {
    content: "" !important;
    display: none !important;
}

/* Fallback si no tiene data-placeholder o si es "true" */
.celda-observacion:empty:not(:focus):not([data-placeholder]):before,
.celda-observacion:empty:not(:focus)[data-placeholder="true"]:before {
    content: "Escribe una observación...";
}

.celda-notas:empty:not(:focus):not([data-placeholder]):before,
.celda-notas:empty:not(:focus)[data-placeholder="true"]:before,
.celda-notas-proveedor:empty:not(:focus):not([data-placeholder]):before,
.celda-notas-proveedor:empty:not(:focus)[data-placeholder="true"]:before {
    content: "Escribe una nota...";
}

.celda-observacion:focus {
    outline: 2px solid #f39c12;
    background: #fffef5;
    box-shadow: 0 0 5px rgba(243, 156, 18, 0.3);
}

/* Estado solo lectura (factura enviada/aceptada DIAN) */
.celda-observacion.no-editable {
    cursor: default;
    opacity: 0.75;
    border-left-color: #bdc3c7;
    background: #f9f9f9;
}

/* 8b. CELDA OBSERVACIÓN NC — mismo diseño que .celda-observacion */
.celda-observacion-nc {
    background: #fff9e6;
    padding: 8px;
    border-radius: 3px;
    font-size: 12px;
    color: #666;
    border-left: 2px solid #f39c12;
    cursor: text;
    min-height: 30px;
    transition: all 0.3s ease;
}

.celda-observacion-nc:empty:not(:focus):before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

.celda-observacion-nc:not(:empty):before,
.celda-observacion-nc:focus:before {
    content: "" !important;
    display: none !important;
}

.celda-observacion-nc:empty:not(:focus):not([data-placeholder]):before,
.celda-observacion-nc:empty:not(:focus)[data-placeholder="true"]:before {
    content: "Escribe una observación...";
}

.celda-observacion-nc:focus {
    outline: 2px solid #f39c12;
    background: #fffef5;
    box-shadow: 0 0 5px rgba(243, 156, 18, 0.3);
}

/* Estado solo lectura (nota firmada/enviada DIAN) */
.celda-observacion-nc[contenteditable="false"] {
    cursor: default;
    opacity: 0.75;
    border-left-color: #bdc3c7;
    background: #f9f9f9;
}


/* 9. AYUDAS DE VISUALIZACIÓN MÓVIL */
.solo-movil {
    display: none;
}

@media (max-width: 1250px) {
    .solo-movil {
        display: inline-block !important;
        margin-bottom: 10px !important;
    }

    .btnAgregarProducto.solo-movil {
        background-color: #f39c12 !important;
        color: white !important;
        border: none !important;
        padding: 10px 20px !important;
        font-weight: bold !important;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1) !important;
        transition: all 0.3s ease !important;
    }
    
    .btnAgregarProducto.solo-movil:hover {
        background-color: #e67e22 !important;
        transform: translateY(-2px) !important;
    }
}

/* 10. UNIFICACIÓN DE SELECT2 Y FORMULARIOS */
.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #444 !important;
    font-weight: normal !important;
}

/* 11. MODALES PERSONALIZADOS (CUSTOM MODALS) */
.modal-custom {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10050;
}

.modal-custom-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-custom-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10051;
}

.modal-custom-header {
    background: #3c8dbc;
    color: white;
    padding: 15px 20px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-custom-header h4 {
    margin: 0;
    font-weight: 400;
}

.modal-custom-body {
    padding: 20px;
    text-align: center;
    overflow-y: auto;
    flex: 1;
}

.modal-custom-footer {
    background: #f4f4f4;
    padding: 12px 20px;
    text-align: right;
    border-top: 1px solid #ddd;
    flex-shrink: 0;
}

/* 12. MEJORAS DE CONTENEDOR DE FILTROS */
.contenedor-filtros {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

@media (max-width: 767px) {
    .contenedor-filtros {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .contenedor-filtros > div,
    .contenedor-filtros > form {
        width: 100% !important;
    }

    .contenedor-filtros .input-group {
        width: 100% !important;
    }
}

/* 13. FACTURAS Y VENTAS */
.invoice {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 30px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    background: white;
}

.invoice-info {
    background-color: #f8f9fa;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 4px;
    border-left: 4px solid #3c8dbc;
}

.invoice-col address {
    margin-bottom: 0;
    color: #555;
}

.invoice-col strong {
    color: #333;
    font-size: 1.1em;
}

.page-header {
    border-bottom: 2px solid #3c8dbc;
    color: #444;
    padding-bottom: 15px;
}

.lead {
    font-size: 16px;
    font-weight: bold;
    color: #444;
    background: #e9ecef;
    padding: 8px 15px;
    border-radius: 3px;
    margin-bottom: 15px;
    border-left: 4px solid #d2d6de;
}

@media (max-width: 767px) {
    /* Campos de ancho completo */
    .formularioVenta .form-group .input-group.col-xs-12,
    .formularioVenta .form-group .col-xs-6 {
        width: 100% !important;
        max-width: 100%;
        padding: 0 !important;
    }

    /* Productos - diseño de tarjetas (cards) en móvil */
    .nuevoProducto .row {
        background: #fdfdfd;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        margin: 0 0 12px 0 !important;
        padding: 12px !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.02);
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        width: 100% !important;
    }

    /* Columna de descripción (Toma todo el ancho superior) */
    .nuevoProducto .row > div:nth-child(1) {
        width: 100% !important;
        padding: 0 !important;
        margin-bottom: 8px;
    }

    /* Columnas inferiores (Impuesto, Cantidad, Precio) - 3 columnas de 33.3% para Ventas y Documento Soporte */
    .formularioVenta .nuevoProducto .row > div:nth-child(2),
    .formularioVenta .nuevoProducto .row > div:nth-child(3),
    .formularioVenta .nuevoProducto .row > div:nth-child(4),
    .formularioDocumentoSoporte .nuevoProducto .row > div:nth-child(2),
    .formularioDocumentoSoporte .nuevoProducto .row > div:nth-child(3),
    .formularioDocumentoSoporte .nuevoProducto .row > div:nth-child(4) {
        width: 33.333% !important;
        padding: 0 4px !important;
        margin-bottom: 0 !important;
        box-sizing: border-box;
    }

    /* Etiquetas superiores para las 3 columnas inferiores de Ventas y Documento Soporte */
    .formularioVenta .nuevoProducto .row > div:nth-child(2)::before,
    .formularioDocumentoSoporte .nuevoProducto .row > div:nth-child(2)::before {
        content: "Impuesto";
        display: block;
        font-size: 10px;
        color: #7f8c8d;
        font-weight: bold;
        margin-bottom: 3px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .formularioVenta .nuevoProducto .row > div:nth-child(3)::before,
    .formularioDocumentoSoporte .nuevoProducto .row > div:nth-child(3)::before {
        content: "Cant.";
        display: block;
        font-size: 10px;
        color: #7f8c8d;
        font-weight: bold;
        margin-bottom: 3px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .formularioVenta .nuevoProducto .row > div:nth-child(4)::before,
    .formularioDocumentoSoporte .nuevoProducto .row > div:nth-child(4)::before {
        content: "Total";
        display: block;
        font-size: 10px;
        color: #7f8c8d;
        font-weight: bold;
        margin-bottom: 3px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Inputs de menor tamaño en móvil */
    .nuevoProducto .row input {
        height: 32px !important;
        padding: 4px 6px !important;
        font-size: 12px !important;
        border-radius: 4px !important;
    }

    /* Descuento - ancho completo */
    .col-xs-10 {
        width: 100% !important;
    }
}

/*=====================================
ESTILOS PARA TABLAS CON SCROLL HORIZONTAL
======================================*/
.dataTables_wrapper {
    width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

table.tablaVentas {
    width: 100% !important;
}

/*=====================================
ESTILOS GENERALES
======================================*/

/*=============================================
14. FACTURACIÓN ELECTRÓNICA Y UTILIDADES
=============================================*/
/* Prevenir layout-shift al cargar la página */
.fe-ui-hidden {
    display: none;


