/* Estilos generales */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', 'Roboto', sans-serif;
}

body {
    background-color: #f0f5ff;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

/* Cabecera */
.header {
    background: linear-gradient(135deg, #0d47a1, #1976d2);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.header h1 {
    font-weight: 400;
    font-size: 28px;
    text-align: center;
    flex-grow: 1;
}

/* Animación flotante para marchweb */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0px); }
}

.brand-logo {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-decoration: none;
    animation: float 3s ease-in-out infinite;
}

.actions {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: #2196f3;
    color: white;
}

.btn-success {
    background-color: #4caf50;
    color: white;
}

.btn-warning {
    background-color: #ff9800;
    color: white;
}

.btn-danger {
    background-color: #f44336;
    color: white;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Buscador y filtros */
.search-container {
    padding: 15px 30px;
    background: #e3f2fd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 15px;
}

.search-box {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    background-color: #f0f0f0;
    transition: all 0.3s;
}

.filter-btn:hover {
    background-color: #ddd;
}

.filter-btn.active {
    background-color: #2196f3;
    color: white;
}

.proveedor-filter {
    display: flex;
    gap: 5px;
    align-items: center;
}

.proveedor-filter select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Tabla estilo Excel */
.stock-table {
    width: 100%;
    border-collapse: collapse;
}

.fixed-table {
    table-layout: fixed;
    width: 100%;
}

.fixed-table th, 
.fixed-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fixed-table th:nth-child(1) { width: 70px; }   /* Imagen */
.fixed-table th:nth-child(2) { width: 80px; }  /* Código */
.fixed-table th:nth-child(3) { width: 120px; }  /* Nombre */
.fixed-table th:nth-child(4) { width: 40px; }  /* Descripción */
.fixed-table th:nth-child(5) { width: 60px; }   /* Unidad */
.fixed-table th:nth-child(6) { width: 70px; }   /* S. Inicial */
.fixed-table th:nth-child(7) { width: 70px; }   /* Entradas */
.fixed-table th:nth-child(8) { width: 70px; }   /* Salidas */
.fixed-table th:nth-child(9) { width: 70px; }   /* S. Actual */
.fixed-table th:nth-child(10) { width: 70px; }  /* S. Mínimo */
.fixed-table th:nth-child(11) { width: 100px; } /* F. Vencimiento */
.fixed-table th:nth-child(12) { width: 120px; } /* Proveedor */
.fixed-table th:nth-child(13) { width: 40px; }  /* Observaciones */
.fixed-table th:nth-child(14) { width: 120px; } /* Acciones */

.stock-table th, .stock-table td {
    padding: 12px 15px;
    text-align: left;
    border: 1px solid #e0e0e0;
    vertical-align: middle;
    position: relative;
}

.stock-table th {
    background-color: #e3f2fd;
    color: #0d47a1;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: center;
    font-size: 14px;
    padding: 15px;
    cursor: help;
}

.stock-table th:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 10px 15px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 14px;
    font-weight: normal;
    z-index: 100;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.stock-table td {
    font-size: 14px;
    text-align: center;
    position: relative;
}

.stock-table tr:nth-child(even) {
    background-color: #f8fbff;
}

.stock-table tr:hover {
    background-color: #e1f5fe;
}

.stock-table .stock-bajo {
    background-color: #ffebee !important;
}

/* Imágenes de productos */
.product-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    background-color: #f5f5f5;
}

.no-image {
    color: #999;
    font-style: italic;
}

/* Indicadores de vencimiento */
.vencimiento-info {
    font-size: 12px;
    font-weight: bold;
    display: block;
    margin-top: 5px;
}

.vencido {
    color: #f44336;
}

.critico {
    color: #f44336;
    font-weight: bold;
    animation: blink 1s infinite;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.alerta {
    color: #ff9800;
    font-weight: bold;
}

.aviso {
    color: #2196f3;
}

.normal {
    color: #4caf50;
}

/* Estilo para stock actual bajo */
.stock-actual-bajo {
    color: #f44336;
    font-weight: bold;
}

/* Botones de acción */
.action-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-action {
    padding: 8px;
    border-radius: 4px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    width: 36px;
    height: 36px;
}

.btn-action i {
    font-size: 14px;
    margin-right: 0;
}

/* Modal para descripciones y observaciones */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 15px;
    top: 10px;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-body {
    padding: 20px 0;
    max-height: 400px;
    overflow-y: auto;
    font-size: 16px;
    line-height: 1.6;
}

/* Formularios */
.form-container {
    max-width: 800px;
    margin: 30px auto;
    padding: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #0d47a1;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.form-control:focus {
    border-color: #2196f3;
    outline: none;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-col {
    flex: 1;
}

/* Alertas */
.alert {
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    font-weight: 500;
}

.alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.alert-error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Responsive */
@media (max-width: 1200px) {
    .stock-table {
        display: block;
        overflow-x: auto;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .search-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .stock-table th {
        min-width: 120px;
    }
}

@media (max-width: 768px) {
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-action {
        width: 100%;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .brand-logo {
        position: relative;
        left: 0;
        top: 0;
        transform: none;
        margin-bottom: 10px;
    }
    
    .actions {
        width: 100%;
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
        padding: 15px;
    }

    .filter-buttons {
        flex-direction: column;
    }

    .proveedor-filter {
        width: 100%;
    }

    .proveedor-filter select {
        flex: 1;
    }
}

/* Tooltips para celdas */
.cell-tooltip {
    position: relative;
    cursor: help;
}

.cell-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 13px;
    font-weight: normal;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Ajustes para mostrar texto completo */
.show-full-text {
    white-space: normal;
    word-wrap: break-word;
    max-width: 300px;
    min-width: 100px;
}

/* Icono de ayuda */
.help-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    color: #0d47a1;
    font-size: 14px;
    cursor: help;
}

/* Añadir al final del archivo */

/* Ajustes para celdas de descripción y observaciones */
.desc-obs-cell {
    max-width: 40px;
    text-align: center;
    padding: 0 !important;
}

/* Mejora en tooltips */
.cell-tooltip:hover::after {
    font-size: 12px;
    padding: 6px 10px;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    z-index: 1000;
}

/* Modal */
.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
    background: #f9f9f9;
    border-radius: 4px;
}

.modal-text-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 16px;
    line-height: 1.6;
}