/* --- Configuración General --- */
body {
    font-family: 'Public Sans', sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 30px;
}

.main-container {
    max-width: 1175px;
    margin: 0 auto;
}

/* --- Tarjeta Contenedora --- */
.table-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* --- Encabezado Superior --- */
.header-table {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #f4f7f6;
    padding-bottom: 15px;
}

.title-section h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5rem;
}

.title-section p {
    margin: 5px 0 0 0;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* --- Barra de Herramientas (Búsqueda) --- */
.toolbar {
    margin-bottom: 20px;
}

.search-group {
    display: flex;
    max-width: 400px;
    gap: 5px;
}

.search-group input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #dcdde1;
    border-radius: 6px;
    outline: none;
    font-size: 14px;
}

.search-group input:focus {
    border-color: #3498db;
}

.btn-search, .btn-clear {
    padding: 8px 15px;
    border-radius: 6px;
    border: 1px solid #dcdde1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    text-decoration: none;
}

.btn-search {
    background-color: #2c3e50;
    color: white;
}

.btn-search:hover { background-color: #1a252f; }

.btn-clear {
    background-color: #ecf0f1;
    color: #e74c3c;
}

.btn-clear:hover { background-color: #dcdde1; }


/* --- Botón Regresar de arriba --- */
.btn-back-header {
    background-color: #ecf0f1;
    color: #7f8c8d;
    padding: 8px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #dcdde1;
    transition: 0.3s;
}

.btn-back-header:hover {
    background-color: #bdc3c7;
    color: #2c3e50;
}


/* --- Tabla --- */
.table-wrapper {
    overflow-x: auto; /* Permite el scroll horizontal en pantallas pequeñas */
    border-radius: 8px; /* Un toque estético opcional */
}

table {
    width: 100%;
    min-width: 1000px; /* <--- EL TRUCO: Obliga a la tabla a tener un tamaño decente y activa el scroll si no cabe */
    border-collapse: collapse;
    margin-top: 10px;
}

table thead tr th {
    background-color: #2c3e50;
    color: white;
    text-align: left;
    padding: 12px 15px;
    white-space: nowrap; /* Evita que títulos como "Código" o "Stock" se partan */
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid #edf2f7;
    font-size: 14px;
}

table tbody tr:hover {
    background-color: #f8fafc;
}

/* --- ESTILOS ESPECÍFICOS PARA LA COLUMNA DE ACCIONES --- */
.text-center { 
    text-align: center; 
}

/* Evitamos que las acciones se colapsen y usamos Flexbox para alinearlas */
td.text-center {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px; /* Espacio entre Modificar y Eliminar */
    height: 100%; 
    min-width: 160px; /* Ancho reservado solo para las acciones */
    white-space: nowrap;
}



table td a {
    text-decoration: none;
    color: #3498db;
    font-weight: 600;
}

table td a:hover {
    text-decoration: underline;
    color: #2980b9; 
}

/* --- Alinear precios a la derecha (Columnas 5 y 6) --- */
table th:nth-child(5),
table td:nth-child(5),
table th:nth-child(6),
table td:nth-child(6) {
    text-align: right;
    /* Opcional: Un poco de espacio extra a la derecha para que no pegue con la línea */
    padding-right: 25px; 
}

/* --- Centrar los registros de la columna STOCK (Columna 4) --- */
table td:nth-child(4) {
    text-align: center;
}


/* Centrar el texto de todos los encabezados */
table thead tr th {
    text-align: center !important; /* Usamos !important por si había un "left" heredado de antes */
}

table {
    width: 100%;
    min-width: 1100px; /* Le damos un poco más de espacio total a la tabla */
    border-collapse: collapse;
    margin-top: 10px;
    table-layout: fixed; /* ¡ESTA ES LA CLAVE! Fuerza a respetar los porcentajes */
}

/* Centrar el texto de todos los encabezados */
table thead tr th {
    text-align: center !important; 
    padding: 12px 10px;
}

/* --- TAMAÑOS DE COLUMNAS ESTRICTOS --- */

/* 1. Columna CÓDIGO (10%) */
table th:nth-child(1), table td:nth-child(1) {
    width: 15%; 
}

/* 2. Columna NOMBRE (20%) */
table th:nth-child(2), table td:nth-child(2) {
    width: 20%;
}

/* 3. Columna PROVEEDOR (25% - Le damos más porque suele ser largo) */
table th:nth-child(3), table td:nth-child(3) {
    width: 25%;
}

/* 4. Columna STOCK (10%) */
table th:nth-child(4), table td:nth-child(4) {
    width: 10%;
    text-align: center; /* Centramos el registro */
}

/* 5 y 6. COLUMNAS DE PRECIOS (10% cada una = 20%) */
table th:nth-child(5), table td:nth-child(5),
table th:nth-child(6), table td:nth-child(6) {
    width: 10%;
    text-align: right; /* Alineamos a la derecha */
    padding-right: 15px;
}

/* 7. Columna ACCIONES (15% - El sobrante exacto para llegar al 100%) */
table th:nth-child(7), table td:nth-child(7) {
    width: 15%;
    white-space: nowrap !important; /* Prohíbe el salto de línea */
    text-align: center;
}

/* Estilo de los enlaces Modificar | Eliminar */
table td:nth-child(7) a {
    text-decoration: none;
    color: #3498db;
    font-weight: 600;
    margin: 0 3px;
}

table td:nth-child(7) a:hover {
    text-decoration: underline;
    color: #2980b9; 
}