/**
 * Estilos para el módulo de Mermas/Pérdidas
 */

/* Contenedor principal */
.mermas-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.mermas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e74c3c;
}

.mermas-header h2 {
    color: #e74c3c;
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.mermas-header i {
    margin-right: 8px;
}

/* Botón crear merma */
.btn-crear-merma {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 3px 5px;
    border-radius: 3px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    width: auto;
    min-width: 92px;
    max-width: 138px;
}

.btn-crear-merma:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.btn-crear-merma i {
    font-size: 10px;
}

/* Formulario para crear merma */
.formulario-merma-container {
    background: #fff;
    border: 2px solid #e74c3c;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.1);
}

.formulario-merma h3 {
    color: #e74c3c;
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
}

.formulario-merma .form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.formulario-merma .form-group {
    flex: 1;
}

.formulario-merma label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
}

.formulario-merma input,
.formulario-merma textarea,
.formulario-merma select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.formulario-merma input:focus,
.formulario-merma textarea:focus,
.formulario-merma select:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* Búsqueda de productos */
.campo-busqueda-producto {
    position: relative;
    margin-bottom: 20px;
}

.resultados-productos {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e74c3c;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.resultado-producto {
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.resultado-producto:hover {
    background-color: #f8f9fa;
}

.resultado-producto:last-child {
    border-bottom: none;
}

.producto-info {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
}

.producto-sku {
    font-weight: 700;
    color: #e74c3c;
    min-width: 80px;
}

.producto-descripcion {
    font-weight: 600;
    color: #2c3e50;
}

.producto-marca {
    color: #7f8c8d;
    font-style: italic;
}

.producto-stock {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #7f8c8d;
}

.stock-actual {
    font-weight: 600;
    color: #27ae60;
}

.resultado-vacio,
.resultado-error {
    padding: 15px;
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
}

.resultado-error {
    color: #e74c3c;
}

/* Producto seleccionado */
.producto-seleccionado {
    background: #e8f5e8;
    border: 2px solid #27ae60;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.info-producto {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stock-disponible {
    font-weight: 600;
    color: #27ae60;
    background: #d5f4e6;
    padding: 5px 10px;
    border-radius: 4px;
}

/* Acciones del formulario */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-guardar-merma {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-guardar-merma:hover {
    background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
    transform: translateY(-2px);
}

.btn-cancelar-merma {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-cancelar-merma:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Filtros */
.filtros-mermas {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.filtros-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    align-items: end;
}

.filtros-mermas .form-group {
    display: flex;
    flex-direction: column;
}

.filtros-mermas label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    font-size: 13px;
}

.filtros-mermas input,
.filtros-mermas select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.btn-limpiar {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-limpiar:hover {
    background: #138496;
}

/* Botón Toggle Fecha */
.btn-toggle-fecha {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 600;
}

.btn-toggle-fecha:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
}

.btn-toggle-fecha.activo {
    background: #27ae60;
}

.btn-toggle-fecha.activo:hover {
    background: #229954;
}

.btn-toggle-fecha i {
    font-size: 16px;
}

/* Campos de fecha */
#campos-fecha {
    display: none;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    align-items: end;
    margin-top: 10px;
    padding: 15px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

#campos-fecha.show {
    display: grid;
}

/* Resumen */
.resumen-mermas {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-radius: 8px;
    border-left: 4px solid #e17055;
}

.resumen-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.resumen-label {
    font-size: 12px;
    color: #2d3436;
    font-weight: 600;
    margin-bottom: 5px;
}

.resumen-valor {
    font-size: 20px;
    font-weight: 700;
    color: #2d3436;
}

/* Tabla de mermas */
.tabla-mermas-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tabla-mermas {
    width: 100%;
    border-collapse: collapse;
}

.tabla-mermas th {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.tabla-mermas td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    font-size: 13px;
}

.tabla-mermas tr:hover {
    background-color: #f8f9fa;
}

.tabla-mermas tr:nth-child(even) {
    background-color: #fdfdfd;
}

.tabla-mermas tr:nth-child(even):hover {
    background-color: #f8f9fa;
}

.cantidad-merma {
    text-align: center;
    font-weight: 700;
    color: #e74c3c;
    background: #fdf2f2;
    border-radius: 4px;
    padding: 5px;
}

.fecha-hora-merma {
    display: flex;

/* Clases para columnas de tabla */
.col-pequeña {
    width: 80px;
    max-width: 80px;
    text-align: center;
}

.col-sku {
    width: 100px;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-cantidad {
    width: 80px;
    max-width: 80px;
    text-align: center;
}

.col-detalle {
    min-width: 200px;
    word-wrap: break-word;
    white-space: pre-wrap;
    max-width: 300px;
}

.detalle-texto {
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.fecha-merma {
    font-weight: 600;
    color: #2c3e50;
    font-size: 13px;
}

.hora-merma {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: 500;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
}

.detalle-merma {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.acciones-merma {
    text-align: center;
}

.btn-eliminar-merma {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.btn-eliminar-merma:hover {
    background: #c82333;
    transform: scale(1.05);
}

.sin-acciones {
    color: #6c757d;
    font-style: italic;
}

.mensaje-vacio {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
    background: #f8f9fa;
}

.error-message {
    text-align: center;
    padding: 40px;
    color: #e74c3c;
    font-weight: 600;
    background: #fdf2f2;
}

/* Responsive */
@media (max-width: 768px) {
    .mermas-container {
        padding: 15px;
    }

    .mermas-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .formulario-merma .form-row {
        flex-direction: column;
    }

    .filtros-row {
        grid-template-columns: 1fr;
    }

    .resumen-mermas {
        flex-direction: column;
        text-align: center;
    }

    .tabla-mermas-container {
        overflow-x: auto;
    }

    .tabla-mermas {
        min-width: 800px;
    }

    .producto-info {
        flex-direction: column;
        gap: 5px;
    }

    .producto-stock {
        flex-direction: column;
        gap: 2px;
    }
}

@media (max-width: 480px) {
    .mermas-header h2 {
        font-size: 20px;
    }

    .formulario-merma-container {
        padding: 15px;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-crear-merma,
    .btn-guardar-merma,
    .btn-cancelar-merma {
        width: 100%;
        justify-content: center;
    }
}

/* === CSS ACTUALIZADO: 06/08/2025 - 21:57 - VERSIÓN 1.3 === */

/* === VERSIÓN CSS: 1.2 - Actualizado 06/08/2025 === */
