/* Import auth styles */
@import url('components/auth.css');
/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    min-height: 100vh;
}

/* Hide main content by default */
#main-content {
    display: none;
}

/* Show main content only when authenticated */
body.authenticated #main-content {
    display: block;
}

/* Hide auth container when authenticated */
body.authenticated #auth-container {
    display: none;
}

/* Spinner de carga */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.spinner-overlay p {
    font-size: 16px;
    color: #666;
}

/* Contenedor principal */
.main-container {
    padding: 16px;
    width: 100%;
    max-width: none;
    margin: 0;
}

/* Barra de búsqueda */
.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

#search-input {
    flex: 1;
    padding: 10px;
    border: 2px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

#search-input:focus {
    outline: none;
    border-color: #4a90e2;
}

.search-button {
    padding: 10px 20px;
    background-color: #e0e0e0;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.search-button:hover {
    background-color: #d0d0d0;
}

/* Contenedor principal con dos columnas */
.content-wrapper {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

/* Sección izquierda */
.left-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Sección de descripción */
.description-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: normal;
}

.description-content {
    padding: 15px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 80px;
    font-size: 14px;
    color: #666;
}

/* Sección de preview */
.preview-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: normal;
}

.preview-content {
    background-color: #f5f5f5; /* gris igual al resto de la interfaz */
    border-radius: 4px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: #e0e0e0;
    color: #666;
    font-size: 14px;
    border-radius: 4px;
    text-align: center;
    flex-direction: column;
    gap: 5px;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

/* Sección derecha */
.right-section {
    flex: 2;
}

/* Sección de stock */
.stock-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: normal;
}

.table-container {
    background-color: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Tabla de stock */
.stock-table {
    width: 100%;
    border-collapse: collapse;
}

/* Contenedor con scroll para tablas en paneles (Inventario, Catálogos, Reservas) */
.table-wrapper {
    max-height: 70vh; /* evita que exceda el alto visible */
    overflow: auto;   /* scroll vertical/horizontal cuando sea necesario */
    background: #fff;
    border: 1px solid #e5e7eb; /* gris claro */
    border-radius: 8px;
}

.stock-table th {
    background-color: #eef2f7; /* gris muy claro */
    color: #334155; /* slate-700 */
    padding: 6px 6px; /* reducido ~30% */
    text-align: center; /* centrar headers en todas las tablas */
    font-weight: 600;
    font-size: 14px;
    border: 1px solid #e0e0e0; /* agregar bordes verticales */
}

/* Encabezado fijo cuando hay scroll */
.table-wrapper .stock-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.stock-table td {
    padding: 6px 6px; /* reducido ~30% */
    border: 1px solid #e0e0e0; /* bordes en todas las celdas */
    font-size: 14px;
}

/* Utilitario para centrar valores numéricos en columnas específicas */
.stock-table td.numeric { text-align: center; }
/* Utilitario para centrar texto (retailer, size, etc.) */
.stock-table td.center { text-align: center; }

.stock-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.stock-table tbody tr:hover {
    background-color: #e3f2fd;
    cursor: pointer;
}

/* Inventario: mejorar alineación y controles */
.stock-table td {
    vertical-align: middle;
}

/* Botón de icono genérico (Dashboard) */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.icon-btn i { font-size: 18px; line-height: 1; }
.icon-btn:hover { background:#f8fafc; border-color:#cbd5e1; }
.icon-btn:active { background:#eef2f7; }
.icon-btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,.25); }
.icon-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Variantes semánticas si existen por clase */
.icon-fulfill { color: #0f766e; }
.icon-view { color: #1d4ed8; }
.icon-cancel { color: #b91c1c; }

/* Input de cantidad */
.qty-input {
    width: 90px;
    height: 32px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
}
.qty-input:focus { outline: none; border-color: #94a3b8; box-shadow: 0 0 0 3px rgba(148,163,184,.25); }

/* Estado inválido del input de cantidad */
.qty-input.input-invalid {
    border-color: #ef4444; /* rojo-500 */
    background-color: #fef2f2; /* rojo-50 */
}

/* Evitar que toda la fila se considere clickable por hover cuando usamos botones */
.stock-table tbody tr:hover .icon-btn { background: #fff; }

.stock-table tbody tr.selected {
    background-color: #bbdefb !important;
    border-left: 4px solid #4a90e2;
}

/* Botones de acción */
.finish-container {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.add-to-reserve-button {
    padding: 10px 20px;
    background-color: #4a90e2;
    color: white;
    border: 1px solid #4a90e2;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.add-to-reserve-button:hover {
    background-color: #357abd;
}

.add-to-reserve-button:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
    border-color: #ccc;
}

.finish-button {
    padding: 10px 30px;
    background-color: #e0e0e0;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.finish-button:hover {
    background-color: #d0d0d0;
}

/* Responsive */
@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    .search-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-button {
        width: 100%;
    }
}

/* Tabla de items reservados */
.reserved-section {
    margin-top: 30px;
}

.reserved-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: normal;
}

/* Tabla Reserved Items con líneas y buena distribución */
.reserved-table,
.items-table {
    width: 100%;
    border-collapse: collapse; /* para que las líneas se vean continuas */
}

.reserved-table thead th,
.items-table thead th {
    background-color: #eef2f7;
    color: #334155;
    font-weight: 600;
}

.reserved-table th,
.reserved-table td,
.items-table th,
.items-table td {
    border: 1px solid #e5e7eb; /* líneas entre celdas */
    padding: 10px 8px;
    font-size: 14px;
    vertical-align: middle;
}

/* Centrar columnas numéricas y de acciones */
.reserved-table th:nth-child(4), /* Quantity */
.reserved-table th:nth-child(5), /* 2% Extra */
.reserved-table th:nth-child(6), /* Total */
.reserved-table th:nth-child(7), /* Actions */
.reserved-table td:nth-child(4),
.reserved-table td:nth-child(5),
.reserved-table td:nth-child(6),
.reserved-table td:nth-child(7),
.items-table th:nth-child(4), /* Quantity */
.items-table th:nth-child(5), /* 2% Extra */
.items-table th:nth-child(6), /* Total */
.items-table td:nth-child(4),
.items-table td:nth-child(5),
.items-table td:nth-child(6) {
    text-align: center;
}

/* Ajustes visuales para la miniatura */
.reserved-table td:first-child img,
.items-table td:first-child img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Zebra para mejorar legibilidad */
.reserved-table tbody tr:nth-child(even),
.items-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}


/* Estados de carga para la tabla */
.loading-row {
    text-align: center;
    font-style: italic;
    color: #666;
}

.error-row {
    text-align: center;
    color: #e74c3c;
}

/* Botón de eliminar en tabla reservados */
.remove-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.remove-btn:hover {
    background-color: #c0392b;
}
