/* public/reports/css/gastos.css */
/* Estilos específicos para el módulo de Gastos */

/* Tabla de gastos */
.filters-container{
    padding: 25px;
}

/*
.gastos-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.gastos-table thead {
    background: #f9fafb;
}

.gastos-table thead th {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-align: left;
    border-bottom: 2px solid #e5e7eb;
}

.gastos-table tbody td {
    padding: 16px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: #111827;
}

.gastos-table tbody tr:last-child td {
    border-bottom: none;
}

.gastos-table tbody tr:hover {
    background-color: #f9fafb;
}
    */

/* Badges de estado */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Dropdown de estados */
.estado-dropdown {
    position: relative;
}

.estado-menu {
    position: fixed;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    min-width: 150px;
    overflow: hidden;
}

.estado-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.15s;
}

.estado-menu-item:hover {
    background-color: #f9fafb;
}

.estado-menu-item:not(:last-child) {
    border-bottom: 1px solid #f3f4f6;
}

/* Zona de subida de archivos */
.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f9fafb;
}

.upload-zone:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.upload-zone svg {
    margin: 0 auto 16px;
    display: block;
}

.upload-zone button svg {
    margin: 0;
}

/* Modal de documento split-view (estilo OpenAI) */
.modal-documento-split {
    display: flex !important;

    gap: 5px !important;

}

/*.modal-body{
    overflow-y: inherit !important;
    padding: 0 10px !important;
    
}*/

.documento-viewer {
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    border-right: 1px solid #e2e8f0;
    /*padding: 24px;*/
    min-height: 73vh;
    max-width: 50%;
    flex:1;
}

.documento-viewer img,
.documento-viewer iframe {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.documento-datos {
    padding: 0 !important;
    overflow: hidden;
    background: white;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Modal tabs container */
.modal-tabs-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 50%;
    flex: 1;

}

.modal-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 24px;
    gap: 0;
}

.modal-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
}

.modal-tab:hover {
    color: #475569;
    background: #f1f5f9;
}

.modal-tab.active {
    color: #1e293b;
    border-bottom-color: #3b82f6;
    background: #ffffff;
    font-weight: 600;
}

.modal-tab svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.tab-badge {
    height: 25px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s infinite;
    width: 25px;
    border-radius: 50%;
    padding: 0;
    display: flex !important
;
    align-items: center;
    justify-content: center;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.modal-tab-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tab-panel {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding: 24px;
}

.tab-panel.active {
    display: flex;
    flex-direction: column;
}

/* Contenedor de incidencias */
.incidencias-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.incidencias-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.incidencias-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.incidencias-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

/* Items de incidencia */
.incidencia-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
    flex-direction: column;
    align-items: self-start !important
    
}

.incidencia-item:hover {
    background: var(--bg-hover, #f3f4f6) !important;
    border: 1px #b0b0b0 solid !important;
    margin-top: 1px !important;
}

.incidencia-item.resuelta {
    background: #f8fafc;
    border-color: #d1fae5;
}

.incidencia-item.resuelta .incidencia-asunto {
    text-decoration: line-through;
    color: #6b7280;
}

.incidencia-header {
    display: flex;
    justify-content: space-between !important;
    width: 100% !important;
    align-items: flex-start;
    margin-bottom: 0 !important;
}

.incidencia-info {
    flex: 1;
}

.incidencia-asunto {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
}

.incidencia-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #64748b;
    flex-wrap: wrap;
}

.incidencia-fecha {
    font-weight: 500;
}

.incidencia-usuario {
    color: #6b7280;
}

.incidencia-prioridad {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prioridad-baja {
    background: #f0f9ff;
    color: #0369a1;
}

.prioridad-media {
    background: #fef3c7;
    color: #d97706;
}

.prioridad-alta {
    background: #fef2f2;
    color: #dc2626;
}

.prioridad-critica {
    background: #fdf2f8;
    color: #be185d;
}

.incidencia-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.incidencia-resuelta-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #d1fae5;
    color: #065f46;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
}

.incidencia-resuelta-badge svg {
    width: 14px;
    height: 14px;
}

.incidencia-mensaje {
    padding: 5px 16px;
    background: #f8fafc;
    border-left: 3px solid #e2e8f0;
    font-size: 14px;
    color: #475569;
    border-radius: 0;
}

/* Estados vacíos */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #64748b;
}

.empty-state svg {
    margin-bottom: 16px;
    color: #cbd5e1;
}

.empty-state h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #475569;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
    color: #64748b;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #64748b;
}

.loading-state svg {
    margin-bottom: 16px;
    color: #cbd5e1;
    animation: spin 1s linear infinite;
}

.tab-content{
    display: block !important;
}

/* Tabs de datos */
.documento-tabs {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e5e7eb;
}

.documento-tab {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #3b82f6;
    background: none;
    border: none;
    border-bottom: 2px solid #3b82f6;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.2s;
}

.documento-tab:hover {
    color: #111827;
}

.documento-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

/* Sugerencias de precios */
.sugerencia-precio {
    transition: background-color 0.15s;
}

.sugerencia-precio:hover {
    background-color: #f9fafb;
}

.sugerencia-precio td {
    vertical-align: middle;
}

/* Skeleton loaders para estado de carga */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    margin-bottom: 12px;
    width: 60%;
}

/* Filtros */
.filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Acciones de tabla */
.table-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.table-action-btn {
    padding: 6px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.table-action-btn svg {
    width: 16px;
    height: 16px;
    stroke: #6b7280;
}

.table-action-btn:hover {
    background-color: #f3f4f6;
}

.table-action-btn:hover svg {
    stroke: #111827;
}

.table-action-btn-primary:hover {
    background-color: #dbeafe;
}

.table-action-btn-primary:hover svg {
    stroke: #2563eb;
}

.table-action-btn-danger:hover {
    background-color: #fee2e2;
}

.table-action-btn-danger:hover svg {
    stroke: #dc2626;
}

/* Estado vacío */
#pedidos .table-empty-state, #gastos .table-empty-state  {
    padding: 64px 24px !important;
    text-align: center;
    text-align: center;
    width: 100%;
    display: table-cell;
}
.table-empty-state svg {
    margin: 0 auto 16px;
    color: #d1d5db;
}

.table-empty-state h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.table-empty-state p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* Animaciones */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.spinner {
    animation: spin 0.8s linear infinite;
}

/* Transiciones suaves */
.modal-overlay {
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    animation: slideUp 0.3s ease-out;
}

/* Estilos del modal de upload */
.modal-upload-container {
    padding: 24px;
}

.modal-upload-title {
    margin: 0 0 24px 0;
    font-size: 24px;
    font-weight: 600;
}

.upload-zone-svg {
    margin: 0 auto 16px;
}

.upload-zone-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 500;
}

.upload-zone-subtitle {
    margin: 0 0 24px 0;
    color: #6b7280;
    font-size: 14px;
}

.upload-buttons-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.upload-info-text {
    margin-top: 16px;
    font-size: 13px;
    color: #6b7280;
    text-align: center;
}

/* Estilos del modal de edición de gastos */
.gasto-edit-section {
    margin-bottom: 20px;
}

.gasto-edit-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.gasto-edit-readonly {
    background: #f3f4f6;
}

.gasto-edit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.gasto-edit-lineas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.gasto-edit-lineas-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.gasto-ingrediente-results {
    position: fixed;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 10000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    display: none;
    min-width: 300px;
}

.gasto-ingrediente-results.show {
    display: block;
}

/* Secciones de resultados separadas (estilo OpenAI) */
.search-results-section {
    padding: 8px 0;
}

.search-results-section:not(:last-child) {
    border-bottom: 1px solid #f3f4f6;
}

.search-results-section-title {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
}

.ingrediente-result-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ingrediente-result-item:hover {
    background: #f9fafb;
}

.ingrediente-result-nombre {
    font-weight: 500;
    color: #111827;
    font-size: 14px;
    margin-bottom: 4px;
}

.ingrediente-result-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
}

/* Badges minimalistas */
.result-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.result-badge-blue {
    background: #eff6ff;
    color: #1e40af;
}

.result-badge-green {
    background: #f0fdf4;
    color: #15803d;
}

.result-price {
    font-weight: 600;
    color: #111827;
}

/* Estado vacío en búsqueda */
.search-results-empty {
    padding: 32px 16px;
    text-align: center;
    color: #9ca3af;
}

.search-results-empty svg {
    margin: 0 auto 12px;
    display: block;
}

.search-results-empty p {
    margin: 0;
    font-size: 13px;
}

.search-results-empty small {
    display: block;
    margin-top: 8px;
    font-size: 11px;
    color: #6b7280;
}

/* Estado de carga en búsqueda */
.search-results-loading {
    padding: 32px 16px;
    text-align: center;
    color: #6b7280;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-results-loading p {
    margin: 0;
    font-size: 13px;
}

/* Estado de error en búsqueda */
.search-results-error {
    padding: 32px 16px;
    text-align: center;
    color: #dc2626;
}

.search-results-error svg {
    margin: 0 auto 12px;
    display: block;
}

.search-results-error p {
    margin: 0;
    font-size: 13px;
}

.gasto-ingrediente-selected {
    padding: 8px 12px;
    background: #eff6ff;
    border-radius: 6px;
    border: 1px solid #bfdbfe;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gasto-ingrediente-selected-name {
    font-weight: 500;
    color: #1e40af;
}

.gasto-totales-summary {
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 20px;
}

.gasto-totales-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.gasto-totales-row:last-child {
    margin-bottom: 0;
    font-weight: 700;
    font-size: 16px;
    padding-top: 8px;
    border-top: 2px solid #e5e7eb;
}

.gasto-actions-container {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Estilos de buscador de proveedores (similar a pedidos) */
.proveedor-search-container {
    position: relative;
}

.proveedor-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: none;
}

.proveedor-search-results.show {
    display: block;
}

.proveedor-result-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.2s;
}

.proveedor-result-item:hover {
    background: #f9fafb;
}

.proveedor-result-item:last-child {
    border-bottom: none;
}

.proveedor-result-nombre {
    font-weight: 500;
    color: #111827;
}

.proveedor-result-nif {
    font-size: 12px;
    color: #6b7280;
}

/* Estilos de búsqueda de clientes (igual que proveedores) */
.cliente-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: none;
}

.cliente-search-results.show {
    display: block;
}

.cliente-result-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.2s;
}

.cliente-result-item:hover {
    background: #f9fafb;
}

.cliente-result-item:last-child {
    border-bottom: none;
}

.cliente-result-nombre {
    font-weight: 500;
    color: #111827;
}

.cliente-result-nif {
    font-size: 12px;
    color: #6b7280;
}

/* Estilos del menú de estados */
.estado-menu {
    position: absolute;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    min-width: 150px;
}

.estado-menu-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s ease;
}

.estado-menu-item:last-child {
    border-bottom: none;
}

.estado-menu-item.estado-actual {
    background: #f9fafb;
    font-weight: 600;
}

/* Tabs de filtro estilo OpenAI con emojis */
.gastos-filter-tabs {
    display: flex;
    gap: 8px;
    padding: 6px;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.gastos-filter-tabs .filter-tab.active[data-estado-filter="0"] {
    background: #fde2e2;
    color: #991b1c;
    box-shadow: none !important;
    border: 0;
}
.gastos-filter-tabs .filter-tab.active[data-estado-filter="1"] {
    background: #e2fde2;
    color: #1b991c;
    box-shadow: none !important;
    border: 0;
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: fit-content;
    position: relative;
}

.filter-tab:hover {
    background: #f1f5f9;
    color: #475569;
    transform: translateY(-1px);
}

.filter-tab.active {
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transform: translateY(-1px);
}

.filter-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: -1;
}

.filter-tab.active::before {
    opacity: 0.1;
}

/* Emojis para cada filtro */
.filter-tab[data-filter="all"]::after {
    content: "📋";
    font-size: 16px;
    margin-left: 4px;
}

.filter-tab[data-filter="estado"][data-estado="0"]::after {
    content: "⏳";
    font-size: 16px;
    margin-left: 4px;
}

.filter-tab[data-filter="estado"][data-estado="1"]::after {
    content: "👀";
    font-size: 16px;
    margin-left: 4px;
}

.filter-tab[data-filter="estado"][data-estado="2"]::after {
    content: "✅";
    font-size: 16px;
    margin-left: 4px;
}

.filter-tab[data-filter="estado"][data-estado="3"]::after {
    content: "💰";
    font-size: 16px;
    margin-left: 4px;
}

.filter-tab[data-filter="incidencias"]::after {
    content: "⚠️";
    font-size: 16px;
    margin-left: 4px;
}

/* Estilos para filtros */
.filters-bar {
    margin: 10px 0;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filters-bar-search {
    flex: 1;
    max-width: 400px;
}

.filters-bar-select {
    width: 150px;
}

/* Badge de incidencias en tabla */
.incidencias-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    color: #dc2626;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.incidencias-badge:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.1);
}

.incidencias-badge img {
    width: 16px;
    height: 16px;
    filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
}

.incidencias-count {
    font-weight: 600;
    font-size: 13px;
}

/* Estilos para tabla de gastos */

/* Fila de filtros por columna */
.gastos-table .gastos-th-filters th {
    padding: 8px;
    vertical-align: middle;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.gastos-col-filter {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Fechas en una sola fila (misma altura) */
.gastos-col-filter-row {
    flex-direction: row;
    gap: 6px;
}

.gastos-col-filter-row input {
    flex: 1;
    min-width: 0;
}

/* Buscadores (proveedor, estado) */
.gastos-searchable-wrap {
    position: relative;
    width: 100%;
}

.gastos-searchable-dropdown {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 2px;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.gastos-searchable-dropdown.show {
    display: block;
}

.gastos-searchable-item {
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}

.gastos-searchable-item:last-child {
    border-bottom: none;
}

.gastos-searchable-item:hover {
    background: #f1f5f9;
}

.gastos-table .gastos-th-filters .form-input-sm,
.gastos-table .gastos-th-filters .gastos-filter-select {
    width: calc(100% - 16px);
    min-width: 0;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.gastos-table .gastos-th-filters input.form-input-sm:focus,
.gastos-table .gastos-th-filters .gastos-filter-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Cabeceras ordenables */
.gastos-table th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.gastos-table th.sortable:hover {
    color: #3b82f6;
}

.gastos-table th.sortable .sort-indicator {
    display: inline-block;
    margin-left: 4px;
    opacity: 0.4;
    transition: opacity 0.15s ease;
}

.gastos-table th.sortable:hover .sort-indicator,
.gastos-table th.sortable.sort-asc .sort-indicator,
.gastos-table th.sortable.sort-desc .sort-indicator {
    opacity: 1;
}

.gastos-table th.sortable.sort-asc .sort-indicator::after {
    content: '▲';
    font-size: 10px;
}

.gastos-table th.sortable.sort-desc .sort-indicator::after {
    content: '▼';
    font-size: 10px;
}

.gastos-table th.sortable:not(.sort-asc):not(.sort-desc) .sort-indicator::after {
    content: '⇅';
    font-size: 10px;
}

.table-col-proveedor-nombre {
    font-weight: 500;
    color: #111827;
}

.table-col-ai-confidence {
    font-size: 11px;
    color: #9ca3af;
}

input.form-input.linea-nombre{
    width: calc(100% - 24px);
}

/* Tabla líneas gasto: columna Artículo (nombre + descripción) más corta para evitar scroll horizontal */
.table-wrapper-gasto-lineas {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-wrapper-gasto-lineas table {
    table-layout: fixed;
    width: 100%;
    min-width: 720px;
}
.table-wrapper-gasto-lineas .gasto-linea-col-articulo,
.table-wrapper-gasto-lineas td:first-child {
    width: 240px;
}
.table-wrapper-gasto-lineas td:first-child .linea-nombre,
.table-wrapper-gasto-lineas td:first-child .linea-descripcion {
    max-width: 100%;
    box-sizing: border-box;
}
.table-wrapper-gasto-lineas td:first-child textarea.linea-descripcion {
    max-height: 70px;
}

.descripcion_linea{
    font-size: 12px; color: #9ca3af;
    max-width: 300px !important;
    white-space: normal;
}
/* Estilos para buscador de proveedores */
.gasto-proveedor-results {
    position: fixed;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    max-height: 400px;
    overflow-y: auto;
    z-index: 10001;
    display: none;
}

.gasto-proveedor-results.show {
    display: block;
}

.proveedor-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s ease;
}

.proveedor-result-item:hover {
    background: #f9fafb;
}

.proveedor-result-item:last-child {
    border-bottom: none;
}

/* Proveedor seleccionado */
.proveedor-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    gap: 12px;
}

.proveedor-selected-info {
    flex: 1;
}

.proveedor-selected-nombre {
    font-weight: 500;
    color: #111827;
    font-size: 14px;
    margin-bottom: 4px;
}

.proveedor-selected small {
    display: block;
    color: #10b981;
    font-size: 11px;
}

/* Categoría: buscador con dropdown */
.gasto-categoria-search-wrap {
    position: relative;
}

.gasto-categoria-results {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 280px;
    overflow-y: auto;
    z-index: 10002;
    display: none;
}

.gasto-categoria-results.show {
    display: block;
}

.gasto-categoria-result-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    transition: background 0.15s ease;
}

.gasto-categoria-result-item:hover {
    background: #f0f9ff;
}

.gasto-categoria-result-item:last-child {
    border-bottom: none;
}

.gasto-categoria-results-empty {
    padding: 12px 14px;
    color: #6b7280;
    font-size: 13px;
}

/* Líneas gasto: celda total editable */
.gasto-linea-total-cell input.linea-total-gasto {
    width: 100%;
    min-width: 90px;
    text-align: right;
}

/* Input de búsqueda de proveedor */
#search-proveedor {
    width: 100%;
}

/* Estilos de selección múltiple y eliminación */

/* Checkboxes personalizados */
.checkbox-select,
.checkbox-gasto {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3b82f6;
    transition: transform 0.15s ease;
}

.checkbox-select:hover,
.checkbox-gasto:hover {
    transform: scale(1.1);
}

/* Fila seleccionada */
tr.row-selected {
    background-color: #eff6ff !important;
    border-left: 3px solid #3b82f6;
}

tr.row-selected:hover {
    background-color: #dbeafe !important;
}

/* Barra de selección flotante (estilo OpenAI/Linear) */
.selection-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 16px 24px;
    z-index: 9999;
    animation: slideUpFadeIn 0.3s ease-out;
    min-width: 320px;
}

@keyframes slideUpFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.selection-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.selection-bar-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #111827;
}

.selection-bar-info #selection-count {
    font-weight: 700;
    font-size: 16px;
    color: #3b82f6;
}

.selection-bar-actions {
    display: flex;
    gap: 8px;
}

/* Hover en botones dentro de la tabla */
.table-action-btn-danger:hover svg {
    stroke: #dc2626 !important;
}

/* Estilos de botón danger */
.btn-danger {
    background-color: #ef4444;
    color: white;
    border: none;
    transition: all 0.15s ease;
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:active {
    transform: translateY(0);
}

/* Animación de pulsación para acciones destructivas */
@keyframes pulseRed {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

.btn-danger:focus {
    animation: pulseRed 0.6s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-documento-split {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: auto;

    }

    .documento-viewer {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        min-height: 250px;
        max-height: 40vh;
        padding: 12px;
    }
    
    .documento-datos {
        padding: 16px;
        max-height: 50vh;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-bar .form-input {
        max-width: 100% !important;
        width: 100% !important;
    }

    .table-actions {
        flex-wrap: wrap;
    }
    
    .gasto-linea-grid {
        grid-template-columns: 1fr;
    }
    
    .gasto-edit-grid {
        grid-template-columns: 1fr;
    }
    
    /* Mejorar tabla de líneas en móvil */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .gasto-edit-lineas-title {
        font-size: 14px;
    }
    
    .gasto-edit-section {
        margin-bottom: 16px;
    }
    
    /* Barra de selección en móviles */
    .selection-bar {
        bottom: 12px;
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
        min-width: auto;
        padding: 12px 16px;
    }
    
    .selection-bar-content {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .selection-bar-info {
        justify-content: center;
        font-size: 13px;
    }
    
    .selection-bar-actions {
        width: 100%;
    }
    
    .selection-bar-actions button {
        flex: 1;
        font-size: 13px;
    }
}

/* ====================================
   ESTILOS PARA MÓDULO DE PEDIDOS
   ==================================== */

/* Dropdown de búsqueda de items/ingredientes en pedidos */
.pedido-item-results {
    position: fixed;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 10000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    display: none;
    min-width: 300px;
}

.pedido-item-results.show {
    display: block;
}

/* Resultados de búsqueda en pedidos (reutilizar estilos de gastos) */
.item-result-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.item-result-item:hover {
    background: #f9fafb;
}

.item-result-nombre {
    font-weight: 500;
    color: #111827;
    font-size: 14px;
    margin-bottom: 4px;
}

.item-result-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
}

/* Badges para items/ingredientes vinculados */
.badge-borrador {
    background-color: #f3f4f6;
    color: #6b7280;
}

.badge-enviado {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-recibido {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-cancelado {
    background-color: #fee2e2;
    color: #991b1b;
}

/* =============================================
   AÑADIR GASTO - Elección (IA vs Manual)
   Similar a escandallo: cargar desde producto / manual
   ============================================= */

.gasto-crear-choice {
    padding: 8px 0 16px;
}

.gasto-crear-choice-subtitle {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #6b7280;
    text-align: center;
}

.gasto-crear-choice-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 560px;
    margin: 0 auto;
}

@media (max-width: 640px) {
    .gasto-crear-choice-cards {
        grid-template-columns: 1fr;
    }
}

.gasto-crear-choice-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.gasto-crear-choice-card:hover {
    border-color: #3b82f6;
    background: #f8fafc;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.12);
}

.gasto-crear-choice-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.gasto-crear-choice-icon-ia {
    background: #eff6ff;
    color: #3b82f6;
}

.gasto-crear-choice-icon-manual {
    background: #f0fdf4;
    color: #16a34a;
}

.gasto-crear-choice-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.gasto-crear-choice-desc {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.45;
    flex: 1;
}

.gasto-crear-choice-btn {
    font-size: 13px;
    font-weight: 500;
    color: #3b82f6;
}

/* Adjuntar documento en formulario gasto (manual / edición) */
.gasto-adjunto-section {
    margin-top: 16px;
}

.gasto-adjunto-empty,
.gasto-adjunto-has {
    border: 1px dashed #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    background: #f9fafb;
}

.gasto-adjunto-empty {
    text-align: center;
}

.gasto-adjunto-label-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: border-color 0.2s, background 0.2s;
}

.gasto-adjunto-label-btn:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.gasto-adjunto-hint {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #6b7280;
}

.gasto-adjunto-has {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.gasto-adjunto-nombre {
    font-size: 14px;
    color: #111827;
}

.gasto-adjunto-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gasto-adjunto-actions label {
    margin: 0;
    cursor: pointer;
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.btn-outline-danger:hover {
    background: #fef2f2;
}

/* Visor fullscreen del documento adjunto (estilo documento-pdf-preview) */
.gasto-documento-preview-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    background: #525659;
    overflow: hidden;
}

.gasto-documento-preview-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10001;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.gasto-documento-preview-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.gasto-documento-preview-content {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 24px 24px;
}

.gasto-documento-preview-iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

.gasto-documento-preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #fff;
}

