/*
 * estilos.css
 * Archivo de estilos global para la aplicación Chess ERP API Client.
 */

/* --- Estilos Generales --- */
body { 
    font-family: Arial, sans-serif; 
    background-color: #f4f4f4; 
    margin: 0; 
    padding: 0; 
}

.container { 
    max-width: 800px; 
    margin: 30px auto; 
    background: #fff; 
    padding: 20px; 
    box-shadow: 0 0 10px rgba(0,0,0,0.1); 
    border-radius: 8px; 
}

h1, h2, h3 { 
    color: #333; 
    margin-top: 15px; /* Espaciado superior para títulos */
    margin-bottom: 10px; /* Espaciado inferior para títulos */
}
h1 { font-size: 2em; } /* Título principal */
h2 { font-size: 1.5em; } /* Subtítulos de sección */
h3 { font-size: 1.2em; } /* Títulos de sub-sección (ej. Agrupaciones) */

/* --- Header y Navegación --- */
.header-top { 
    display: flex; 
    justify-content: space-between; /* Espacio entre logo y nav */
    align-items: center; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 15px; 
    margin-bottom: 15px; 
}

.logo-header { 
    max-height: 50px; /* Tamaño máximo del logo */
    width: auto;
}

nav { 
    text-align: right; 
}

nav a { 
    text-decoration: none; 
    color: #007bff; 
    font-weight: bold; 
    padding: 5px 10px; 
    margin-left: 10px; /* Espacio entre enlaces */
    border-radius: 4px; /* Bordes redondeados para los enlaces */
    transition: background-color 0.3s ease; /* Transición suave al pasar el ratón */
}

nav a:hover {
    background-color: #e9ecef; /* Fondo claro al pasar el ratón */
}

nav a.active { 
    text-decoration: none; /* Quitamos el subrayado activo */
    background-color: #0056b3; /* Fondo para el enlace activo */
    color: white; /* Texto blanco para el enlace activo */
}

/* --- Formularios --- */
form { 
    display: flex; 
    flex-wrap: wrap; /* Permite que los elementos salten de línea */
    gap: 15px; /* Espacio entre elementos del formulario */
    align-items: center; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 20px; 
    margin-bottom: 20px; 
}

form div {
    flex-grow: 1; /* Permite que los divs crezcan para ocupar espacio */
}

label { 
    font-weight: bold; 
    display: block; /* Cada label en su propia línea */
    margin-bottom: 5px;
}

input[type="text"], input[type="date"], select, textarea { 
    padding: 8px; 
    border-radius: 4px; 
    border: 1px solid #ccc; 
    width: 100%; /* Ocupa el 100% del ancho de su contenedor div */
    box-sizing: border-box; /* Asegura que el padding no afecte el ancho total */
    margin-bottom: 5px;
}

textarea {
    resize: vertical; /* Permite redimensionar verticalmente */
    min-height: 60px; /* Altura mínima para el textarea */
}

button { 
    padding: 10px 15px; 
    background-color: #007bff; 
    color: white; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    transition: background-color 0.3s ease;
}

button:hover { 
    background-color: #0056b3; 
}

/* --- Tablas de Datos --- */
table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-bottom: 20px; 
    background-color: #fff; /* Fondo blanco para las tablas */
    box-shadow: 0 0 5px rgba(0,0,0,0.05); /* Sombra suave */
    border-radius: 5px; /* Bordes ligeramente redondeados */
}

table th, table td { 
    border: 1px solid #ddd; 
    padding: 10px; 
    text-align: left; 
    vertical-align: top; /* Alinear contenido arriba */
}

table th { 
    background-color: #f9f9f9; 
    font-weight: bold;
}

/* Estilos específicos para la tabla de artículos principal */
table.article-main-data th { width: 35%; }
table.article-main-data td { width: 65%; }

/* Estilos específicos para la tabla de agrupaciones */
table.agrupaciones-table th:first-child { width: 25%; }
table.agrupaciones-table th:nth-child(2) { width: 35%; }
table.agrupaciones-table th:nth-child(3) { width: 20%; }
table.agrupaciones-table th:last-child { width: 20%; }

/* Estilos específicos para la tabla de campos adicionales */
table.additional-data-table th:first-child { width: 40%; }
table.additional-data-table th:last-child { width: 60%; }

/* Estilos específicos para la tabla de clientes principal */
table.client-main-data th { width: 35%; }
table.client-main-data td { width: 65%; }

/* Estilos específicos para las tablas de alias y fuerza de venta */
table.alias-data-table, table.fuerza-data-table {
    margin-top: 10px; /* Un poco de espacio extra */
    margin-bottom: 15px; 
}
table.alias-data-table th, table.fuerza-data-table th {
    width: 35%;
}
table.alias-data-table td, table.fuerza-data-table td {
    width: 65%;
}

/* Estilos específicos para la tabla de precios comparativa */
table.prices-comparison-table th { background-color: #e0f2f7; }
table.prices-comparison-table td { white-space: nowrap; } /* Para que los precios no se corten */

/* Estilos para la tabla pivot de stock */
table.stock-pivot-table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 20px;
}
table.stock-pivot-table th, table.stock-pivot-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center; /* Centrar el stock para mejor lectura */
    white-space: nowrap; /* Evitar que el contenido se rompa en varias líneas */
}
table.stock-pivot-table thead th {
    background-color: #f0f0f0;
    font-weight: bold;
    vertical-align: middle; /* Centrar verticalmente los encabezados */
}
table.stock-pivot-table thead th:first-child,
table.stock-pivot-table thead th:nth-child(2) {
    text-align: left; /* Mantener la alineación izquierda para "Código" y "Descripción" */
}
table.stock-pivot-table tbody td:first-child, /* Código de Artículo */
table.stock-pivot-table tbody td:nth-child(2) /* Descripción Artículo */ {
    text-align: left; /* Mantener la alineación izquierda para texto descriptivo */
}
table.stock-pivot-table tbody tr:hover {
    background-color: #f5f5f5;
}

/* --- Estilos para Tablas Responsivas --- */
.table-responsive {
    overflow-x: auto; /* Permite el scroll horizontal */
    -webkit-overflow-scrolling: touch; /* Mejora el scroll en dispositivos táctiles */
    margin-bottom: 20px; /* Espacio debajo del contenedor */
}


/* --- Mensajes de Estado (Error, Activo, Anulado) --- */
p.error { 
    color: #d9534f; 
    background-color: #f2dede; 
    border: 1px solid #ebccd1; 
    padding: 10px; 
    border-radius: 4px; 
    margin-bottom: 20px; 
}

span.status-anulado { 
    color: #dc3545; /* Rojo más oscuro */
    font-weight: bold; 
}

span.status-activo { 
    color: #28a745; /* Verde más oscuro */
    font-weight: bold; 
}

/* --- Barra de Progreso --- */
#loadingProgressBarContainer { /* Usar ID para mayor especificidad */
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 20px;
    display: none; /* Oculta la barra por defecto */
    height: 20px; /* Asegurar una altura visible */
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); /* Sombra interna */
}

#loadingProgressBar { /* Usar ID para mayor especificidad */
    width: 0%;
    height: 100%;
    background-color: #4CAF50; /* Color verde */
    text-align: left; /* Alinear el texto a la izquierda */
    line-height: 20px;
    color: white;
    font-size: 0.8em;
    transition: width 0.5s ease-in-out;
    box-sizing: border-box;
    padding-left: 10px; /* Padding para el texto "Cargando..." */
    white-space: nowrap; /* Evitar que el texto "Cargando..." se rompa */
}

/* --- Consola de Depuración --- */
.debug-console {
    background-color: #1e1e1e; /* Fondo oscuro */
    color: #d4d4d4; /* Texto gris claro */
    font-family: Consolas, "Courier New", monospace;
    padding: 20px;
    margin-top: 40px;
    border-radius: 8px;
    border: 1px solid #333;
    max-height: 400px;
    overflow-y: auto; /* Scroll vertical */
    text-align: left;
    white-space: pre-wrap; /* Mantiene el formato y permite saltos de línea */
    word-wrap: break-word; /* Rompe palabras largas */
}

.debug-console h2 {
    color: #569cd6; /* Título azul */
    margin-top: 0;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
}

.debug-console pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #9cdcfe;
    margin: 0; /* Eliminar márgenes predeterminados de <pre> */
    padding: 0;
    border: none; /* Eliminar bordes predeterminados de <pre> */
    background-color: transparent; /* Fondo transparente */
}